Esempio n. 1
0
 private void gridViewDiem_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
 {
      e.Handled = true;
     SolidBrush brush = new SolidBrush(Color.FromArgb(0xC6, 0x64, 0xFF));
     e.Graphics.FillRectangle(brush, e.Bounds);
     e.Graphics.DrawRectangle(Pens.Black, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height));
     Size size = ImageCollection.GetImageListSize(e.Info.ImageCollection);
     Rectangle r = e.Bounds;
     ImageCollection.DrawImageListImage(e.Cache, e.Info.ImageCollection, e.Info.ImageIndex,
             new Rectangle(r.X + (r.Width - size.Width) / 2, r.Y + (r.Height - size.Height) / 2, size.Width, size.Height));
     brush.Dispose();
 }
Esempio n. 2
0
        private void OnCustomDrawRowHeaderCell(object sender, CustomDrawRowHeaderCellEventArgs e)
        {
            Point hitPoint = MousePosition;
            //if (!(e.Row is CategoryRow)) return;
            VGridControl grid    = (VGridControl)sender;
            VGridHitInfo hitInfo = ((VGridControl)sender).CalcHitInfo(grid.PointToClient(hitPoint));

            if (hitInfo.Row != e.Row)
            {
                return;
            }
            BaseRowViewInfo rowInfo = null;

            foreach (BaseRowViewInfo info in grid.ViewInfo.RowsViewInfo)
            {
                if (info is CategoryRowViewInfo)
                {
                    continue;
                }
                rowInfo = info;
                break;
            }
            if (rowInfo == null)
            {
                return;
            }
            RowValueInfo valueInfo = null;

            foreach (RowValueInfo info in rowInfo.ValuesInfo)
            {
                if (info.Bounds.X < hitInfo.PtMouse.X &&
                    info.Bounds.Right > hitInfo.PtMouse.X)
                {
                    valueInfo = info;
                    break;
                }
            }
            if (valueInfo == null)
            {
                return;
            }
            e.Handled = true;
            e.Appearance.DrawBackground(e.Cache, e.Bounds);
            e.Appearance.DrawString(e.Cache, e.Caption, e.CaptionRect);
            if (e.ImageIndex > 0)
            {
                ImageCollection.DrawImageListImage(e.Cache, e.Row.Properties.Images, e.ImageIndex,
                                                   e.ImageRect);
            }
            if (e.Focused)
            {
                XPaint.Graphics.DrawFocusRectangle(e.Graphics, e.FocusRect, e.Appearance.ForeColor,
                                                   e.Appearance.BackColor);
            }
            Rectangle hotTrackRect = new Rectangle(valueInfo.Bounds.X, e.Bounds.Y,
                                                   valueInfo.Bounds.Width, e.Bounds.Height);

            hotTrackRect.Inflate(-1, -1);
            e.Graphics.FillRectangle(Brushes.AliceBlue, hotTrackRect);
            e.Graphics.DrawRectangle(Pens.Blue, hotTrackRect);
        }