?? editgoto.cs
字號(hào):
?using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace jishiben
{
public delegate void gotoEventHandler(object sender, int gotocharline);
public partial class Editgoto : Form
{
public event gotoEventHandler gotol;
private int charline = 0;
private void Ongotol()
{
gotoEventHandler handler = gotol;
if (handler != null)
{
if (handler.Target is System.ComponentModel.ISynchronizeInvoke)
{
System.ComponentModel.ISynchronizeInvoke aSynch = handler.Target as System.ComponentModel.ISynchronizeInvoke;
if (aSynch.InvokeRequired)
{
object[] args = new object[] { this, charline };
aSynch.Invoke(handler, args);
}
else
{
handler(this, charline);
}
}
else
{
handler(this, charline);
}
}
else
{
MessageBox.Show("事件為空!");
}
}
public Editgoto()
{
InitializeComponent();
}
private void btnNo_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOk_Click(object sender, EventArgs e)
{
foreach (char c in tBline.Text)
{
int i = (int)c;
if (i < 0x30 || i > 0x39)
{
MessageBox.Show("請(qǐng)輸入正整數(shù)");
}
else
{
int gotoline = Convert.ToInt32(tBline.Text);
int maxline = jishiben.Lines.Length;
if (gotoline > 0 && gotoline <= maxline)
{
for (int j = gotoline-1; j > 0; j--)
{
//jishiben.Selects += jishiben.Lines[j].Length + 1;
charline += jishiben.Lines[j - 1].Length + 1;
Ongotol();
this.Close();
}
}
else
{
MessageBox.Show("輸入數(shù)字1到" + maxline + "之間的數(shù)字");
break;
}
}
}
}
private void Editgoto_Load(object sender, EventArgs e)
{
int j = jishiben.Selects;
for (int i = 0; i < jishiben.Lines.Length;i++ )
{
j = j - (jishiben.Lines[i].Length+1);
if (j <= 0)
{
tBline.Text = (i+1).ToString();
break;
}
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -