protected override void OnPaintAdornments(PaintEventArgs pe) { BaseLineItem label = (BaseLineItem)Control; if (selectionService != null) { if (selectionService.GetComponentSelected(label)) { // Paint grab handles. Rectangle grapRectangle = GetHandle(label.FromPoint); ControlPaint.DrawGrabHandle(pe.Graphics, grapRectangle, true, true); grapRectangle = GetHandle(label.ToPoint); ControlPaint.DrawGrabHandle(pe.Graphics, grapRectangle, true, true); } } }
public override void Initialize(IComponent component) { if (component == null) { throw new ArgumentNullException("component"); } base.Initialize(component); this.baseLine = (BaseLineItem)component; this.componentChangeService = (IComponentChangeService)component.Site.GetService(typeof(IComponentChangeService)); if (componentChangeService != null) { componentChangeService.ComponentChanging += OnComponentChanging; componentChangeService.ComponentChanged += OnComponentChanged; } selectionService = GetService(typeof(ISelectionService)) as ISelectionService; if (selectionService != null) { selectionService.SelectionChanged += OnSelectionChanged; } }
protected override void OnSetCursor( ) { // Get mouse cursor position relative to // the control's coordinate space. BaseLineItem label = (BaseLineItem)Control; Point p = label.PointToClient(Cursor.Position); // Display a resize cursor if the mouse is // over a grab handle; otherwise show a // normal arrow. if (GetHandle(label.FromPoint).Contains(p) || GetHandle(label.ToPoint).Contains(p)) { Cursor.Current = Cursors.SizeAll; } else { Cursor.Current = Cursors.Default; } }
public override void Initialize(IComponent component) { if (component == null) { throw new ArgumentNullException("component"); } base.Initialize(component); this.baseLine = (BaseLineItem)component; this.componentChangeService = (IComponentChangeService)component.Site.GetService(typeof(IComponentChangeService)); if (componentChangeService != null) { componentChangeService.ComponentChanging += OnComponentChanging; componentChangeService.ComponentChanged += OnComponentChanged; } selectionService = GetService(typeof(ISelectionService)) as ISelectionService; if (selectionService != null) { selectionService.SelectionChanged += OnSelectionChanged; } }