?? gotolineform.cs
字號:
// DINAMIC XML Editor
//
// Copyright (c) 2002-2003 Dusan Hlavaty
// mailto: duddo@atlas.cz
//
// This software is licensed under the terms of
// GNU General Public license
//
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace XML_editor.MyForms
{
/// <summary>
/// Formular v ktorom uzivatel zadava cislo riadku, kam sa chce v dokumente
/// presunut.
/// </summary>
public class GotoLineForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxNumber;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
// -------------------------------------------------------------------------
/// <summary>
/// Vrati cislo, ktore zadal uzivatel
/// </summary>
public int GetLineNumber
{
get
{
try
{
int x = System.Convert.ToInt32( this.textBoxNumber.Text.Trim() );
return x;
}
catch
{
}
return 1;
}
}
// -------------------------------------------------------------------------
/// <summary>
/// Inicializuje instanciu <see cref="GotoLineForm"/>
/// </summary>
public GotoLineForm()
{
this.MyInitializeComponent();
}
// -------------------------------------------------------------------------
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
// -------------------------------------------------------------------------
/// <summary>
/// Moj design support
/// </summary>
private void MyInitializeComponent()
{
this.textBoxNumber = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBoxNumber
//
this.textBoxNumber.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBoxNumber.Location = new System.Drawing.Point(19, 42);
this.textBoxNumber.Name = "textBoxNumber";
this.textBoxNumber.Size = new System.Drawing.Size(180, 20);
this.textBoxNumber.TabIndex = 0;
this.textBoxNumber.Text = "1";
this.textBoxNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxNumber_KeyPress);
//
// label1
//
this.label1.AutoSize = true;
this.label1.CausesValidation = false;
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label1.Location = new System.Drawing.Point(17, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Go to line:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// buttonOK
//
this.buttonOK.CausesValidation = false;
this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonOK.Location = new System.Drawing.Point(20, 80);
this.buttonOK.Name = "buttonOK";
this.buttonOK.TabIndex = 1;
this.buttonOK.Text = "OK";
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.CausesValidation = false;
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonCancel.Location = new System.Drawing.Point(124, 80);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.TabIndex = 2;
this.buttonCancel.Text = "Cancel";
//
// GotoLineForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(218, 119);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.buttonCancel,
this.buttonOK,
this.label1,
this.textBoxNumber});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GotoLineForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Go to";
this.ResumeLayout(false);
}
// -------------------------------------------------------------------------
/// <summary>
/// Stlacenie tlacidla OK
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOK_Click(object sender, System.EventArgs e)
{
if (this.textBoxNumber.Text == String.Empty)
{
this.textBoxNumber.Text = "1";
}
this.DialogResult = DialogResult.OK;
}
// -------------------------------------------------------------------------
/// <summary>
/// Stlacenie tlacidla na textboxe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void textBoxNumber_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
System.Globalization.UnicodeCategory x = System.Char.GetUnicodeCategory(e.KeyChar);
if ((x == System.Globalization.UnicodeCategory.DecimalDigitNumber) ||
(x == System.Globalization.UnicodeCategory.Control))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
} // public class GotoLineForm : ...
} // namespace XML_editor.MyForms
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -