void ListBoxDrawItem(object sender, DrawItemEventArgs e) { //get the selected element and its associated image if (0 <= e.Index && e.Index < this.Items.Count) { UML.Extended.UMLItem selectedElement = this.Items[e.Index] as UML.Extended.UMLItem; if (selectedElement != null) { Image elementImage = this.navigatorVisuals.getImage(selectedElement); //draw standard background and focusrectangle e.DrawBackground(); e.DrawFocusRectangle(); //draw the name of the element e.Graphics.DrawString(this.navigatorVisuals.getNodeName(selectedElement), e.Font, new SolidBrush(e.ForeColor), new Point(elementImage.Width + 2, e.Bounds.Y)); // draw the icon e.Graphics.DrawImage(elementImage, new Point(e.Bounds.X, e.Bounds.Y)); // draw tooltip if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { //this.itemTooltip.Show(selectedElement.fqn,this, e.Bounds.Right, e.Bounds.Bottom); this.itemTooltip.Show(selectedElement.fqn, this, e.Bounds.Left + 20, (int)(e.Bounds.Bottom + e.Bounds.Height * 1.5)); } else { this.itemTooltip.Hide(this); } } } }
public UML_SM.StateMachine getContainingStateMachine(UML.Extended.UMLItem umlItem) { if (umlItem != null) { if (umlItem.owner is UML_SM.StateMachine) { return(umlItem.owner as UML_SM.StateMachine); } else { return(this.getContainingStateMachine(umlItem.owner)); } } return(null); }