Esempio n. 1
0
        private void DGV_DragDrop_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            if (e.RowIndex == _DragOver_RowIndex)
            {
                e.Handled = true;

                var rc = DGV.GetRowDisplayRectangle(e.RowIndex, true);
                rc.Width = DGV.RowHeadersWidth + DGV.Columns.Cast <DataGridViewColumn>().Where(c => c.Visible).Sum(c => c.Width);

                var color = Color.FromArgb(75, DGV.DefaultCellStyle.SelectionBackColor);
                using (var br = new HatchBrush(HatchStyle.ForwardDiagonal, color, Color.Transparent))
                {
                    e.Graphics.FillRectangle(br, rc);
                }
                using (var pen = new Pen(color, 2.0f))
                {
                    rc.Inflate(-1, -1);
                    e.Graphics.DrawRectangle(pen, rc);
                }
            }
        }