예제 #1
0
        /// <summary>
        /// Handles dropping non-grid data on a grid column header
        /// </summary>
        /// <param name="e"></param>
        /// <param name="header"></param>
        /// <param name="pt"></param>
        private void DropColumnHeader(
            DragEventArgs e, GridColumnHeader header, Point pt)
        {
            GridColumn column = header.GetHitColumn(pt);

            if (column != null)
            {
                GridPanel panel = column.GridPanel;

                GridRow row = new GridRow();
                panel.Rows.Add(row);

                if (e.Data.GetDataPresent(typeof(string)) == true)
                {
                    string s = (string)e.Data.GetData(typeof(string));

                    DropTextRow(row, s.Split(','));
                }
                else if (e.Data.GetDataPresent(typeof(TreeNode)) == true)
                {
                    TreeNode tnode = (TreeNode)e.Data.GetData(typeof(TreeNode));

                    DropTextRow(row, tnode.Text.Split(','));
                }
                else if (e.Data.GetDataPresent(typeof(Node)) == true)
                {
                    Node node = (Node)e.Data.GetData(typeof(Node));

                    DropNodeRow(row, node.Cells);
                }
                else if (e.Data.GetDataPresent(typeof(Node[])) == true)
                {
                    Node[] nodes = (Node[])e.Data.GetData(typeof(Node[]));

                    foreach (Node node in nodes)
                    {
                        if (row == null)
                        {
                            row = new GridRow();

                            panel.Rows.Add(row);
                        }

                        DropNodeRow(row, node.Cells);

                        row = row.NextVisibleRow as GridRow;
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Handles dropping data onto a ColumnHeader
        /// </summary>
        /// <param name="item"></param>
        /// <param name="items"></param>
        /// <param name="pt"></param>
        private void DropSgColumnHeader(GridColumnHeader item,
                                        IEnumerable <GridElement> items, Point pt)
        {
            GridColumn column = item.GetHitColumn(pt);

            if (column != null)
            {
                if (_SrcElement is GridColumn)
                {
                    DropSgColumns(column, items);
                }
                else
                {
                    DropSgPanel(item.GridPanel, items);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Gives column 3 (Process State) some extra feedback
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SuperGridControl1MouseMove(object sender, MouseEventArgs e)
        {
            SuperGridControl sg = sender as SuperGridControl;

            if (sg != null)
            {
                GridColumnHeader header =
                    sg.GetElementAt(e.Location) as GridColumnHeader;

                if (header != null)
                {
                    Point      pt     = header.SuperGrid.PointToClient(MousePosition);
                    GridColumn column = header.GetHitColumn(pt);

                    if (column != null && column.ColumnIndex == 3)
                    {
                        Rectangle r = header.GetImageBounds(column);

                        if (r.Contains(pt) == true)
                        {
                            if (column.HeaderStyles.MouseOver.ImageIndex < 0)
                            {
                                column.HeaderStyles.MouseOver.ImageIndex = 7;
                            }
                        }
                        else
                        {
                            if (column.HeaderStyles.MouseOver.ImageIndex >= 0)
                            {
                                column.HeaderStyles.MouseOver.ImageIndex = -1;
                            }
                        }
                    }
                }
            }
        }