namespace SHNDecrypt.Search { using SHNDecrypt; using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; public class searchGoTo : Form { private Button btnGo; private IContainer components; private frmMain GoTo; private Label label1; private Label label2; private Label label3; private TextBox txtCurrentPos; private TextBox txtGoToPos; private TextBox txtPosLimit; public searchGoTo(frmMain main) { this.GoTo = main; this.InitializeComponent(); } private void btnGo_Click(object sender, EventArgs e) { try { this.GoTo.dataGrid.CurrentCell = this.GoTo.dataGrid.Rows[Convert.ToInt32(this.txtGoToPos.Text)].Cells[0]; this.txtCurrentPos.Text = this.GoTo.dataGrid.CurrentCell.RowIndex.ToString(); } catch (Exception exception) { MessageBox.Show("An error occured: " + exception.Message); } } protected override void Dispose(bool disposing) { if (disposing && (this.components != null)) { this.components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { ComponentResourceManager manager = new ComponentResourceManager(typeof(searchGoTo)); this.label1 = new Label(); this.txtCurrentPos = new TextBox(); this.txtPosLimit = new TextBox(); this.label2 = new Label(); this.txtGoToPos = new TextBox(); this.label3 = new Label(); this.btnGo = new Button(); base.SuspendLayout(); this.label1.AutoSize = true; this.label1.Location = new Point(12, 15); this.label1.Name = "label1"; this.label1.Size = new Size(0x54, 13); this.label1.TabIndex = 0; this.label1.Text = "Current Position:"; this.txtCurrentPos.Enabled = false; this.txtCurrentPos.ForeColor = SystemColors.WindowText; this.txtCurrentPos.Location = new Point(0x66, 12); this.txtCurrentPos.Name = "txtCurrentPos"; this.txtCurrentPos.Size = new Size(0x9f, 20); this.txtCurrentPos.TabIndex = 1; this.txtPosLimit.Enabled = false; this.txtPosLimit.Location = new Point(0x66, 0x26); this.txtPosLimit.Name = "txtPosLimit"; this.txtPosLimit.Size = new Size(0x9f, 20); this.txtPosLimit.TabIndex = 3; this.label2.AutoSize = true; this.label2.Location = new Point(0x19, 0x29); this.label2.Name = "label2"; this.label2.Size = new Size(0x47, 13); this.label2.TabIndex = 2; this.label2.Text = "Position Limit:"; this.txtGoToPos.Location = new Point(0x66, 0x40); this.txtGoToPos.Name = "txtGoToPos"; this.txtGoToPos.Size = new Size(0x9f, 20); this.txtGoToPos.TabIndex = 5; this.txtGoToPos.KeyDown += new KeyEventHandler(this.txtGoToPos_KeyDown); this.txtGoToPos.KeyPress += new KeyPressEventHandler(this.txtGoToPos_KeyPress); this.label3.AutoSize = true; this.label3.Location = new Point(0x10, 0x43); this.label3.Name = "label3"; this.label3.Size = new Size(80, 13); this.label3.TabIndex = 4; this.label3.Text = "Go To Position:"; this.btnGo.Location = new Point(0x66, 90); this.btnGo.Name = "btnGo"; this.btnGo.Size = new Size(0x9f, 30); this.btnGo.TabIndex = 6; this.btnGo.Text = "Go"; this.btnGo.UseVisualStyleBackColor = true; this.btnGo.Click += new EventHandler(this.btnGo_Click); this.btnGo.KeyDown += new KeyEventHandler(this.txtGoToPos_KeyDown); base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(0x111, 0x81); base.Controls.Add(this.btnGo); base.Controls.Add(this.txtGoToPos); base.Controls.Add(this.label3); base.Controls.Add(this.txtPosLimit); base.Controls.Add(this.label2); base.Controls.Add(this.txtCurrentPos); base.Controls.Add(this.label1); base.Icon = (Icon) manager.GetObject("$this.Icon"); base.MaximizeBox = false; base.MinimizeBox = false; base.Name = "searchGoTo"; base.StartPosition = FormStartPosition.CenterParent; this.Text = "Go To"; base.Load += new EventHandler(this.searchGoTo_Load); base.KeyDown += new KeyEventHandler(this.txtGoToPos_KeyDown); base.ResumeLayout(false); base.PerformLayout(); } private void searchGoTo_Load(object sender, EventArgs e) { this.txtCurrentPos.Text = this.GoTo.dataGrid.CurrentCell.RowIndex.ToString(); this.txtPosLimit.Text = (this.GoTo.dataGrid.Rows.Count - 1).ToString(); this.txtGoToPos.Text = "0"; } private void txtGoToPos_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { this.btnGo.PerformClick(); e.SuppressKeyPress = true; } if (e.KeyCode == Keys.Escape) { e.SuppressKeyPress = true; base.Close(); } } private void txtGoToPos_KeyPress(object sender, KeyPressEventArgs e) { if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar)) { e.Handled = true; } } } }