public override Rectangle GetLabelTextRect(Rectangle itemRect, PropertyEnumerator enumSelf) { Font underlinedFont = new Font(Font, FontStyle.Underline); Graphics graphics = ParentGrid.CreateGraphics(); Size textSize = Win32Calls.GetTextExtent(graphics, DisplayName, underlinedFont); Rectangle labelColumnRect = GetLabelColumnRect(itemRect, enumSelf); labelColumnRect.Inflate(-ParentGrid.GlobalTextMargin, 0); Rectangle labelRect = labelColumnRect; if (textSize.Width <= labelColumnRect.Width) { labelRect.X = labelColumnRect.Right - textSize.Width; labelRect.Width = textSize.Width; } else { labelRect.Width = labelColumnRect.Right - labelRect.Left; } graphics.Dispose(); underlinedFont.Dispose(); return(labelRect); }
public virtual Rectangle GetLabelTextRect(Rectangle itemRect, PropertyEnumerator enumSelf) { Rectangle labelRect = itemRect; Rectangle imgRect = GetImageRect(itemRect, enumSelf); if (imgRect != Rectangle.Empty) { labelRect.X = imgRect.Right; } else { Rectangle checkboxRect = GetManuallyDisableRect(itemRect, enumSelf); if (checkboxRect != Rectangle.Empty) { labelRect.X = checkboxRect.Right; } else { Rectangle signRect = GetSignRect(itemRect, enumSelf); if (signRect != Rectangle.Empty) { labelRect.X = signRect.Right; } else { labelRect.X = ParentGrid.LeftColumnWidth + 1 + (enumSelf.Depth - 1) * (_grid.GlobalTextMargin + TreeGlyphWidth); } } } labelRect.X += _grid.GlobalTextMargin; Graphics graphics = ParentGrid.CreateGraphics(); labelRect.Width = Win32Calls.GetTextExtent(graphics, DisplayName, Font).Width; graphics.Dispose(); int maxRight = ParentGrid.LeftColumnWidth + 1 + ParentGrid.LabelColumnWidth; if ((ParentGrid.EllipsisMode & PropertyGrid.EllipsisModes.EllipsisOnLabels) != 0) { maxRight -= _grid.GlobalTextMargin; } if (labelRect.Right > maxRight) { labelRect.Width = maxRight - labelRect.Left; } return(labelRect); }
internal virtual void OnPropertyClicked(PropertyEnumerator enumSelf, Point point, Rectangle itemRect) { if ((Control.ModifierKeys == Keys.Control) && (HyperLinkFormat.Length > 0)) { Rectangle valueRect = GetValueRect(itemRect); Graphics graphics = ParentGrid.CreateGraphics(); Rectangle strRect = Value.GetStringValueRect(graphics, valueRect, point); graphics.Dispose(); if (strRect.Contains(point)) { ParentGrid.OnHyperLinkPropertyClicked(new PropertyHyperLinkClickedEventArgs(enumSelf, HyperLink)); } } }
public virtual bool OverrideCursor(Point mouseLocation, Rectangle itemRect, PropertyEnumerator propEnum) { if ((HyperLinkFormat.Length != 0) && (Control.ModifierKeys == Keys.Control) && (Value != null)) { Rectangle valueRect = GetValueRect(itemRect); Graphics graphics = ParentGrid.CreateGraphics(); Rectangle strRect = Value.GetStringValueRect(graphics, valueRect, mouseLocation); graphics.Dispose(); if (strRect.Contains(mouseLocation) && Enabled) { ParentGrid.Grid.Cursor = Cursors.Hand; return(true); } } return(false); }