示例#1
0
        private void dataGridTextColumn1_DataCellMouseHover(object sender, DataGridDataCellMouseEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }
            int iconIndex = GetIconInfoAtPos(e.Row, e.CellArgs.CellRect, e.CellArgs.InCellX, e.CellArgs.InCellY);

            if (iconIndex >= 0)
            {
                Point toolTipPos = e.CellArgs.GridMouseArgs.Location;
                toolTipPos.Y = toolTipPos.Y + 24;
                toolTip1.Show("Click the Icon to delete transport type", dataGrid1, toolTipPos, 2000);
            }
        }
示例#2
0
        private void dataGridTextColumn1_DataCellMouseMove(object sender, DataGridDataCellMouseEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }
            int iconIndex = GetIconInfoAtPos(e.Row, e.CellArgs.CellRect, e.CellArgs.InCellX, e.CellArgs.InCellY);

            if (mouseIconIndex != iconIndex)
            {
                dataGrid1.InvalidateCell(e.CellArgs.ColIndex, e.CellArgs.RowIndex);
                mouseIconIndex = iconIndex;
                dataGrid1.RestartMouseHoverEvent();
                toolTip1.Hide(dataGrid1);
            }
        }
示例#3
0
        private void dataGridTextColumn1_DataCellMouseDown(object sender, DataGridDataCellMouseEventArgs e)
        {
            var icons = new List <IconData>();

            GetIconsList(e.Row, icons);

            Rectangle iconRect = e.CellArgs.CellRect;

            iconRect.Width = 20;
            iconRect.X     = iconRect.X - 20;

            foreach (IconData id in icons)
            {
                iconRect.Offset(20, 0);
                if (iconRect.Contains(e.CellArgs.GridMouseArgs.Location))
                {
                    DataRowView rowView = (DataRowView)e.Row.SourceItem;
                    rowView.Row[id.DataColumn] = false;
                    e.Handled = true;
                    return;
                }
            }
        }
示例#4
0
        private void dataGridTextColumn4_DataCellMouseClick(object sender, DataGridDataCellMouseEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }
            FileSystemFolterTreeNode node = (FileSystemFolterTreeNode)e.Row.SourceItem;
            long size = CalcFolderSize(node.Path);

            if (size > 1024 * 10)
            {
                size = size / 1024;

                if (size > 1024 * 10)
                {
                    size = size / 1024;

                    if (size > 1024 * 10)
                    {
                        size      = size / 1024;
                        node.Size = size.ToString("N0") + " Gb";
                    }
                    else
                    {
                        node.Size = size.ToString("N0") + " Mb";
                    }
                }
                else
                {
                    node.Size = size.ToString("N0") + " Kb";
                }
            }
            else
            {
                node.Size = size.ToString("N0") + " b";
            }
        }