namespace SHNDecrypt
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    public class searchFind : Form
    {
        private BindingSource bindingSource1;
        private Button btnCopy;
        private Button btnSearch;
        private Button button1;
        private Button button2;
        private ComboBox cmbIn;
        private IContainer components;
        private ToolStripMenuItem copyToolStripMenuItem;
        private DataGridView dataGrid;
        private ToolStripMenuItem fileToolStripMenuItem;
        private frmMain frmParent;
        private GroupBox groupBox1;
        private int horizontalScrollOffset;
        private Label label1;
        private Label label2;
        private MenuStrip menuStrip1;
        private Dictionary<int, int> originIndex = new Dictionary<int, int>();
        private ToolStripMenuItem pasteToolStripMenuItem;
        private int previouslySelectedColumn;
        private int previouslySelectedRow;
        private RadioButton radioContains;
        private RadioButton radioEndsWith;
        private RadioButton radioEquals;
        private RadioButton radioStartsWith;
        private ToolStripMenuItem selectToolStripMenuItem;
        private StatusStrip statusStrip1;
        private ToolTip toolTip1;
        private ToolStripStatusLabel tStatus;
        private TextBox txtFor;
        private int verticalScrollOffset;

        public searchFind(frmMain Handle)
        {
            this.frmParent = Handle;
            this.InitializeComponent();
            this.dataGrid.DoubleBuffered(true);
        }

        private void btnEnter_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.btnSearch.PerformClick();
                e.SuppressKeyPress = true;
            }
            if (e.KeyCode == Keys.Escape)
            {
                e.SuppressKeyPress = true;
                base.Hide();
            }
        }

        private void btnSearch_Click(object Sender, EventArgs Args)
        {
            Program.searchParam0 = this.txtFor.Text;
            Program.searchParam1 = this.cmbIn.SelectedIndex;
            Program.searchFile = this.frmParent.FileTab.SelectedTab.Text;
            string[] strArray = this.cmbIn.Text.Split(new char[] { ':' });
            try
            {
                this.bindingSource1.ResetBindings(true);
                this.bindingSource1.RaiseListChangedEvents = true;
                if (string.IsNullOrEmpty(this.txtFor.Text))
                {
                    this.frmParent.file.table.DefaultView.RowFilter = null;
                }
                else if (this.radioContains.Checked)
                {
                    this.frmParent.file.table.DefaultView.RowFilter = $"Convert({strArray[1]}, 'System.String') LIKE '%{this.txtFor.Text}%'";
                    this.resetRadioChecks(false);
                    Program.radioContains = true;
                }
                else if (this.radioEquals.Checked)
                {
                    this.frmParent.file.table.DefaultView.RowFilter = $"Convert({strArray[1]}, 'System.String') = '{this.txtFor.Text}'";
                    this.resetRadioChecks(false);
                    Program.radioEquals = true;
                }
                else if (this.radioStartsWith.Checked)
                {
                    this.frmParent.file.table.DefaultView.RowFilter = $"Convert({strArray[1]}, 'System.String') LIKE '{this.txtFor.Text}*'";
                    this.resetRadioChecks(false);
                    Program.radioStartsWith = true;
                }
                else if (this.radioEndsWith.Checked)
                {
                    this.frmParent.file.table.DefaultView.RowFilter = $"Convert({strArray[1]}, 'System.String') LIKE '*{this.txtFor.Text}'";
                    this.resetRadioChecks(false);
                    Program.radioEndsWith = true;
                }
                this.bindingSource1.RaiseListChangedEvents = false;
                this.bindingSource1.ResetBindings(false);
                this.tStatus.Text = "Found " + ((this.dataGrid.Rows.Count - 1)).ToString() + " Rows.";
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if ((this.frmParent.file != null) && (this.dataGrid != null))
            {
                this.dataGrid.AllowUserToAddRows = false;
                MemoryStream output = new MemoryStream();
                BinaryWriter writer = new BinaryWriter(output);
                new DataTable();
                this.frmParent.file.table.Clone();
                IOrderedEnumerable<DataGridViewRow> enumerable = from row in this.dataGrid.SelectedRows.Cast<DataGridViewRow>()
                    orderby row.Index
                    select row;
                writer.Write(this.dataGrid.SelectedRows.Count);
                foreach (DataGridViewRow row in enumerable)
                {
                    try
                    {
                        object[] itemArray = (row.DataBoundItem as DataRowView).Row.ItemArray;
                        writer.Write(itemArray.Length);
                        for (int i = 0; i < itemArray.Length; i++)
                        {
                            writer.Write(this.frmParent.file.table.Columns[i].ColumnName);
                            writer.Write(itemArray[i].ToString());
                        }
                        writer.Write((byte) 0);
                    }
                    catch (NullReferenceException exception)
                    {
                        MessageBox.Show("You have selected an invalid row: " + Environment.NewLine + exception.Message);
                    }
                    catch (Exception exception2)
                    {
                        MessageBox.Show("An unknown error has occured: " + Environment.NewLine + exception2.Message);
                    }
                }
                output.Position = 0L;
                byte[] buffer = new byte[output.Length];
                output.Read(buffer, 0, (int) output.Length);
                Clipboard.SetData("Bytes", buffer);
                writer.Close();
                this.tStatus.Text = "Copied to clipboard.";
                this.dataGrid.AllowUserToAddRows = true;
            }
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            if (this.dataGrid.SelectedRows.Count == 1)
            {
                try
                {
                    foreach (DataGridViewRow row in (IEnumerable) this.frmParent.dataGrid.Rows)
                    {
                        string str = this.frmParent.dataGrid.Rows[row.Index].Cells[0].Value.ToString();
                        string str2 = this.dataGrid.Rows[this.dataGrid.CurrentCell.RowIndex].Cells[0].Value.ToString();
                        if (str == str2)
                        {
                            this.frmParent.dataGrid.CurrentCell = this.frmParent.dataGrid.Rows[row.Index].Cells[0];
                            this.frmParent.dataGrid.Rows[row.Index].Selected = true;
                            return;
                        }
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show("Could not locate row. " + exception.Message);
                }
            }
            else if (this.dataGrid.SelectedCells.Count == 1)
            {
                try
                {
                    foreach (DataGridViewRow row2 in (IEnumerable) this.frmParent.dataGrid.Rows)
                    {
                        string str3 = this.frmParent.dataGrid.Rows[row2.Index].Cells[0].Value.ToString();
                        string str4 = this.dataGrid.Rows[this.dataGrid.CurrentCell.RowIndex].Cells[0].Value.ToString();
                        if (str3 == str4)
                        {
                            this.frmParent.dataGrid.Rows[row2.Index].Selected = false;
                            this.frmParent.dataGrid.CurrentCell = this.frmParent.dataGrid.Rows[row2.Index].Cells[this.dataGrid.CurrentCell.ColumnIndex];
                            return;
                        }
                    }
                }
                catch (Exception exception2)
                {
                    MessageBox.Show("Could not locate cell. " + exception2.Message);
                }
            }
            else
            {
                MessageBox.Show("Please select a row or cell to find.");
            }
        }

        private void dataGrid_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {
        }

        private void dataGrid_SelectionChanged(object sender, EventArgs e)
        {
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(searchFind));
            this.groupBox1 = new GroupBox();
            this.button2 = new Button();
            this.button1 = new Button();
            this.menuStrip1 = new MenuStrip();
            this.fileToolStripMenuItem = new ToolStripMenuItem();
            this.copyToolStripMenuItem = new ToolStripMenuItem();
            this.pasteToolStripMenuItem = new ToolStripMenuItem();
            this.selectToolStripMenuItem = new ToolStripMenuItem();
            this.btnCopy = new Button();
            this.radioEndsWith = new RadioButton();
            this.radioStartsWith = new RadioButton();
            this.radioEquals = new RadioButton();
            this.radioContains = new RadioButton();
            this.btnSearch = new Button();
            this.cmbIn = new ComboBox();
            this.label2 = new Label();
            this.label1 = new Label();
            this.txtFor = new TextBox();
            this.statusStrip1 = new StatusStrip();
            this.tStatus = new ToolStripStatusLabel();
            this.dataGrid = new DataGridView();
            this.toolTip1 = new ToolTip(this.components);
            this.bindingSource1 = new BindingSource(this.components);
            this.groupBox1.SuspendLayout();
            this.menuStrip1.SuspendLayout();
            this.statusStrip1.SuspendLayout();
            ((ISupportInitialize) this.dataGrid).BeginInit();
            ((ISupportInitialize) this.bindingSource1).BeginInit();
            base.SuspendLayout();
            this.groupBox1.Controls.Add(this.button2);
            this.groupBox1.Controls.Add(this.button1);
            this.groupBox1.Controls.Add(this.menuStrip1);
            this.groupBox1.Controls.Add(this.btnCopy);
            this.groupBox1.Controls.Add(this.radioEndsWith);
            this.groupBox1.Controls.Add(this.radioStartsWith);
            this.groupBox1.Controls.Add(this.radioEquals);
            this.groupBox1.Controls.Add(this.radioContains);
            this.groupBox1.Controls.Add(this.btnSearch);
            this.groupBox1.Controls.Add(this.cmbIn);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.txtFor);
            this.groupBox1.Dock = DockStyle.Top;
            this.groupBox1.Location = new Point(0, 0);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x2e7, 100);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.button2.Location = new Point(0x296, 0x29);
            this.button2.Name = "button2";
            this.button2.Size = new Size(0x4b, 0x17);
            this.button2.TabIndex = 10;
            this.button2.Text = "Paste";
            this.toolTip1.SetToolTip(this.button2, "Paste the copied row(s) - Ctrl + Shift + V");
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Visible = false;
            this.button2.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.button1.Location = new Point(0x296, 70);
            this.button1.Name = "button1";
            this.button1.Size = new Size(0x4b, 0x17);
            this.button1.TabIndex = 9;
            this.button1.Text = "Select";
            this.toolTip1.SetToolTip(this.button1, "Go to the selected row/cell on main grid - Ctrl + Shift + S");
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new EventHandler(this.button1_Click_1);
            this.button1.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.menuStrip1.Dock = DockStyle.None;
            this.menuStrip1.Items.AddRange(new ToolStripItem[] { this.fileToolStripMenuItem });
            this.menuStrip1.Location = new Point(0x1a6, 0x10);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new Size(0x2d, 0x18);
            this.menuStrip1.TabIndex = 8;
            this.menuStrip1.Text = "menuStrip1";
            this.menuStrip1.Visible = false;
            this.fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.copyToolStripMenuItem, this.pasteToolStripMenuItem, this.selectToolStripMenuItem });
            this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
            this.fileToolStripMenuItem.Size = new Size(0x25, 20);
            this.fileToolStripMenuItem.Text = "File";
            this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
            this.copyToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.Shift | Keys.C;
            this.copyToolStripMenuItem.Size = new Size(0xb1, 0x16);
            this.copyToolStripMenuItem.Text = "Copy";
            this.copyToolStripMenuItem.Click += new EventHandler(this.button1_Click);
            this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
            this.pasteToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.Shift | Keys.V;
            this.pasteToolStripMenuItem.Size = new Size(0xb1, 0x16);
            this.pasteToolStripMenuItem.Text = "Paste";
            this.selectToolStripMenuItem.Name = "selectToolStripMenuItem";
            this.selectToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.Shift | Keys.S;
            this.selectToolStripMenuItem.Size = new Size(0xb1, 0x16);
            this.selectToolStripMenuItem.Text = "Select";
            this.btnCopy.Location = new Point(0x296, 12);
            this.btnCopy.Name = "btnCopy";
            this.btnCopy.Size = new Size(0x4b, 0x17);
            this.btnCopy.TabIndex = 7;
            this.btnCopy.Text = "Copy";
            this.toolTip1.SetToolTip(this.btnCopy, "Copy the selected row(s) - Ctrl + Shift + C");
            this.btnCopy.UseVisualStyleBackColor = true;
            this.btnCopy.Click += new EventHandler(this.button1_Click);
            this.btnCopy.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.radioEndsWith.AutoSize = true;
            this.radioEndsWith.Location = new Point(0x119, 70);
            this.radioEndsWith.Name = "radioEndsWith";
            this.radioEndsWith.Size = new Size(0x4a, 0x11);
            this.radioEndsWith.TabIndex = 6;
            this.radioEndsWith.TabStop = true;
            this.radioEndsWith.Text = "Ends With";
            this.radioEndsWith.UseVisualStyleBackColor = true;
            this.radioEndsWith.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.radioStartsWith.AutoSize = true;
            this.radioStartsWith.Location = new Point(0x119, 0x35);
            this.radioStartsWith.Name = "radioStartsWith";
            this.radioStartsWith.Size = new Size(0x4d, 0x11);
            this.radioStartsWith.TabIndex = 5;
            this.radioStartsWith.TabStop = true;
            this.radioStartsWith.Text = "Starts With";
            this.radioStartsWith.UseVisualStyleBackColor = true;
            this.radioStartsWith.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.radioEquals.AutoSize = true;
            this.radioEquals.Location = new Point(0x119, 0x24);
            this.radioEquals.Name = "radioEquals";
            this.radioEquals.Size = new Size(0x39, 0x11);
            this.radioEquals.TabIndex = 4;
            this.radioEquals.TabStop = true;
            this.radioEquals.Text = "Equals";
            this.radioEquals.UseVisualStyleBackColor = true;
            this.radioEquals.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.radioContains.AutoSize = true;
            this.radioContains.Location = new Point(0x119, 0x13);
            this.radioContains.Name = "radioContains";
            this.radioContains.Size = new Size(0x42, 0x11);
            this.radioContains.TabIndex = 3;
            this.radioContains.TabStop = true;
            this.radioContains.Text = "Contains";
            this.radioContains.UseVisualStyleBackColor = true;
            this.radioContains.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.btnSearch.Location = new Point(80, 0x44);
            this.btnSearch.Name = "btnSearch";
            this.btnSearch.Size = new Size(0xc2, 0x18);
            this.btnSearch.TabIndex = 2;
            this.btnSearch.Text = "Search";
            this.btnSearch.UseVisualStyleBackColor = true;
            this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
            this.btnSearch.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.cmbIn.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cmbIn.FormattingEnabled = true;
            this.cmbIn.Location = new Point(80, 0x2a);
            this.cmbIn.Name = "cmbIn";
            this.cmbIn.Size = new Size(0xc2, 0x15);
            this.cmbIn.TabIndex = 1;
            this.cmbIn.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.label2.AutoSize = true;
            this.label2.Location = new Point(15, 0x2d);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x37, 13);
            this.label2.TabIndex = 2;
            this.label2.Text = "Search in:";
            this.label1.AutoSize = true;
            this.label1.Location = new Point(15, 0x13);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x3b, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Search for:";
            this.txtFor.Location = new Point(80, 0x10);
            this.txtFor.Name = "txtFor";
            this.txtFor.Size = new Size(0xc2, 20);
            this.txtFor.TabIndex = 0;
            this.txtFor.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.statusStrip1.Items.AddRange(new ToolStripItem[] { this.tStatus });
            this.statusStrip1.Location = new Point(0, 0x219);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new Size(0x2e7, 0x16);
            this.statusStrip1.TabIndex = 8;
            this.statusStrip1.Text = "statusStrip1";
            this.tStatus.Name = "tStatus";
            this.tStatus.Size = new Size(0x2a, 0x11);
            this.tStatus.Text = "Ready.";
            this.dataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGrid.Dock = DockStyle.Fill;
            this.dataGrid.Location = new Point(0, 100);
            this.dataGrid.Name = "dataGrid";
            this.dataGrid.Size = new Size(0x2e7, 0x1b5);
            this.dataGrid.TabIndex = 9;
            this.dataGrid.TabStop = false;
            this.dataGrid.DataError += new DataGridViewDataErrorEventHandler(this.dataGrid_DataError);
            this.dataGrid.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x2e7, 0x22f);
            base.Controls.Add(this.dataGrid);
            base.Controls.Add(this.statusStrip1);
            base.Controls.Add(this.groupBox1);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MainMenuStrip = this.menuStrip1;
            base.MinimizeBox = false;
            this.MinimumSize = new Size(500, 300);
            base.Name = "searchFind";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Find";
            base.FormClosing += new FormClosingEventHandler(this.searchFind_Closing);
            base.Shown += new EventHandler(this.searchFind_Shown);
            base.KeyDown += new KeyEventHandler(this.btnEnter_KeyDown);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            ((ISupportInitialize) this.dataGrid).EndInit();
            ((ISupportInitialize) this.bindingSource1).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void loadSettings()
        {
            if (this.frmParent.file != null)
            {
                this.cmbIn.Items.Clear();
                this.originIndex.Clear();
                this.radioContains.Checked = true;
                for (int i = 0; i < this.frmParent.file.table.Columns.Count; i++)
                {
                    DataColumn column = this.frmParent.file.table.Columns[i];
                    this.cmbIn.Items.Add(i.ToString("00") + ": " + column.ToString());
                }
                this.cmbIn.SelectedIndex = 0;
                this.bindingSource1.DataSource = this.frmParent.file.table.DefaultView;
                this.dataGrid.DataSource = this.bindingSource1;
                this.frmParent.dataGrid.DataSource = this.frmParent.file.table.Copy();
            }
        }

        private void resetRadioChecks(bool checkToF = false)
        {
            Program.radioContains = checkToF;
            Program.radioEndsWith = checkToF;
            Program.radioEquals = checkToF;
            Program.radioStartsWith = checkToF;
        }

        private void searchFind_Closing(object Sender, FormClosingEventArgs e)
        {
            try
            {
                this.horizontalScrollOffset = this.frmParent.dataGrid.FirstDisplayedScrollingColumnIndex;
                this.verticalScrollOffset = this.frmParent.dataGrid.FirstDisplayedScrollingRowIndex;
                this.previouslySelectedRow = this.frmParent.dataGrid.CurrentCell.RowIndex;
                this.previouslySelectedColumn = this.frmParent.dataGrid.CurrentCell.ColumnIndex;
                if (this.dataGrid.DataSource != null)
                {
                    this.frmParent.file.table.DefaultView.RowFilter = null;
                    this.frmParent.dataGrid.DataSource = this.frmParent.file.table;
                    this.frmParent.file.table.DefaultView.Sort = string.Empty;
                    this.setCellViewPosition();
                }
                e.Cancel = true;
                base.Hide();
            }
            catch
            {
                if (MessageBox.Show("Error saving edits, would you still like to close the form?", "SHN", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    e.Cancel = true;
                }
                base.Hide();
                this.frmParent.SQLStatus.Text = "Error saving search form edits.";
            }
        }

        private void searchFind_Shown(object Sender, EventArgs Args)
        {
            this.horizontalScrollOffset = this.frmParent.dataGrid.FirstDisplayedScrollingColumnIndex;
            this.verticalScrollOffset = this.frmParent.dataGrid.FirstDisplayedScrollingRowIndex;
            this.previouslySelectedRow = this.frmParent.dataGrid.CurrentCell.RowIndex;
            this.previouslySelectedColumn = this.frmParent.dataGrid.CurrentCell.ColumnIndex;
            this.loadSettings();
            if ((this.frmParent.FileTab.SelectedTab.Text == Program.searchFile) && (Program.searchParam0 != null))
            {
                this.txtFor.Text = Program.searchParam0;
                this.cmbIn.SelectedIndex = Program.searchParam1;
                if (Program.radioEndsWith)
                {
                    this.radioEndsWith.Checked = true;
                }
                else if (Program.radioEquals)
                {
                    this.radioEquals.Checked = true;
                }
                else if (Program.radioStartsWith)
                {
                    this.radioStartsWith.Checked = true;
                }
                else
                {
                    this.radioContains.Checked = true;
                }
                this.btnSearch.PerformClick();
                this.txtFor.Select(this.txtFor.Text.Length, 0);
            }
            this.setCellViewPosition();
        }

        private void setCellViewPosition()
        {
            if (this.previouslySelectedColumn == 0)
            {
                this.frmParent.dataGrid.CurrentCell = this.frmParent.dataGrid.Rows[this.previouslySelectedRow].Cells[this.previouslySelectedColumn];
                this.frmParent.dataGrid.Rows[this.previouslySelectedRow].Selected = true;
                this.frmParent.dataGrid.FirstDisplayedScrollingColumnIndex = this.horizontalScrollOffset;
                this.frmParent.dataGrid.FirstDisplayedScrollingRowIndex = this.verticalScrollOffset;
            }
            else
            {
                this.frmParent.dataGrid.CurrentCell = this.frmParent.dataGrid.Rows[this.previouslySelectedRow].Cells[this.previouslySelectedColumn];
                this.frmParent.dataGrid.FirstDisplayedScrollingColumnIndex = this.horizontalScrollOffset;
                this.frmParent.dataGrid.FirstDisplayedScrollingRowIndex = this.verticalScrollOffset;
            }
        }

        protected override System.Windows.Forms.CreateParams CreateParams
        {
            get
            {
                System.Windows.Forms.CreateParams createParams = base.CreateParams;
                createParams.ExStyle |= 0x2000000;
                return createParams;
            }
        }
    }
}

