private bool ClickInEditor(MouseEventArgs e, out Rectangle editorBounds)
        {
            editorBounds = Rectangle.Empty;
            Point           location = e.Location;
            VGridHitInfo    hitInfo  = _VGrid.CalcHitInfo(location);
            BaseRowViewInfo viewInfo = _VGrid.ViewInfo[location];

            if (hitInfo.HitInfoType == HitInfoTypeEnum.HeaderCell && _Row == viewInfo.Row)
            {
                editorBounds = viewInfo.HeaderInfo.HeaderCellsRect;
                return(editorBounds.Contains(location));
            }
            return(false);
        }
        private BaseRowViewInfo GetRowInfo(CustomDrawRowValueCellEventArgs e)
        {
            RowViewInfoReadOnlyCollection rowsViewInfo = propertyGridControl1.ViewInfo.RowsViewInfo;

            for (int i = 0; i < rowsViewInfo.Count; i++)
            {
                BaseRowViewInfo info = rowsViewInfo[i] as BaseRowViewInfo;
                if (info.Row == e.Row)
                {
                    return(info);
                }
            }
            return(null);
        }
        private void propertyGridControl1_CustomDrawRowValueCell(object sender, CustomDrawRowValueCellEventArgs e)
        {
            if (e.CellValue != null)
            {
                return;
            }
            BaseRowViewInfo  rowInfo      = GetRowInfo(e);
            BaseEditViewInfo editViewInfo = GetEditorViewInfo(rowInfo, e);

            editViewInfo.ErrorIconText  = "IsNull";
            editViewInfo.ShowErrorIcon  = true;
            editViewInfo.FillBackground = true;
            editViewInfo.ErrorIcon      = DXErrorProvider.GetErrorIconInternal(ErrorType.Critical);
            editViewInfo.CalcViewInfo(e.Graphics);
        }
Пример #4
0
 public BaseEditViewInfo GetEditorViewInfo(BaseRowViewInfo rowInfo, CustomDrawRowValueCellEventArgs e)
 {
     if (rowInfo == null)
     {
         return(null);
     }
     for (var i = 0; i < rowInfo.ValuesInfo.Count; i++)
     {
         var valuesInfo = rowInfo.ValuesInfo[i];
         if (valuesInfo.RecordIndex == e.RecordIndex && valuesInfo.RowCellIndex == e.CellIndex)
         {
             return(valuesInfo.EditorViewInfo);
         }
     }
     return(null);
 }
Пример #5
0
        private static Rectangle GetFirstMergedCellBounds(CustomDrawRowValueCellEventArgs e, BaseViewInfo vi)
        {
            int recordIndex = e.RecordIndex + 1;

            while (NeigbourEqual(e, recordIndex))
            {
                recordIndex++;
            }
            BaseRowViewInfo ri             = vi.RowsViewInfo[e.Row.Index] as BaseRowViewInfo;
            Rectangle       lastCellBounds = GetValueBoundsByRecordIndex(ri, recordIndex);

            if (lastCellBounds.Right < e.Bounds.Left)
            {
                lastCellBounds = ri.RowRect;
            }
            return(new Rectangle(e.Bounds.Left, e.Bounds.Top, lastCellBounds.Right - e.Bounds.Left, e.Bounds.Height));
        }
Пример #6
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);
        }