Пример #1
0
        /// <summary>
        /// Display the folder browser dialog.
        /// </summary>
        private void gridControl1_CellButtonClicked(object sender, GridCellButtonClickedEventArgs e)
        {
            GridRangeInfo rg = GridRangeInfo.Cell(e.RowIndex, e.ColIndex);

            if (e.ColIndex == 7)
            {
                MessageBox.Show("Clicked button at " + rg.ToString());
            }
            if (e.ColIndex == 8)
            {
                DialogResult result = openFileDialog1.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string file = openFileDialog1.FileName;
                    try
                    {
                        setFile(file);
                    }
                    catch (IOException)
                    {
                    }
                }
            }
            if (e.ColIndex == 6)
            {
                DialogResult result = openFileDialog1.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string file = openFileDialog1.FileName;
                    try
                    {
                        MessageBox.Show("File is selected");
                    }
                    catch (IOException)
                    {
                    }
                }
            }
            if (e.ColIndex == 4 && e.RowIndex == 6)
            {
                MessageBox.Show("Clicked Button: " + e.Button.Text + "\nRow Index: " + e.RowIndex + "\nColumn Index: " + e.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// User has release mouse button. Stop automatic scrolling.
        /// </summary>
        /// <param name="e"></param>
        public void MouseUp(MouseEventArgs e)
        {
            // Stop automatic scrolling
            owner.AutoScrolling = ScrollBars.None;

            int   rowIndex, colIndex;
            Point point = new Point(e.X, e.Y);

            owner.PointToRowCol(point, out rowIndex, out colIndex);

            dragWindow.Visible = false;
            dragWindow         = null;

            GridRangeInfo range = GridRangeInfo.Cells(activeRange.Top, activeRange.Left, rowIndex, colIndex);

            MessageBox.Show(owner.Selections.Ranges.ActiveRange.ToString() + " expanded to " + range.ToString());
        }