protected override void DrawListItem(DrawItemEventArgs e, Rectangle rect, ListItem <MindMapLayoutType> listItem) { var value = listItem.Value; Brush brushFore = ((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? SystemBrushes.HighlightText : SystemBrushes.WindowText; bool isdefault = value == MindMapLayoutType.MindMap; rect.Inflate(-1, -1); // draw icon //Image image = MindMapLayoutTypeEditor.GetIcon(value); var image = listItem.Image; if (image != null) { Rectangle rectImage = new Rectangle(rect.Left + 2, rect.Y + (rect.Height - 16) / 2, 16, 16); e.Graphics.DrawImage(image, rectImage, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); } rect.X += 20; rect.Width -= 20; // draw text StringFormat sf = new StringFormat(PaintHelper.SFLeft); sf.FormatFlags |= StringFormatFlags.NoWrap; Font font = e.Font; string str = MindMapLayoutTypeConverter._ConvertToString(value); if (isdefault) { font = new Font(font, font.Style | FontStyle.Bold); //str += string.Format(" ({0})", LanguageManage.GetText("Default")); } e.Graphics.DrawString(str, font, brushFore, rect, sf); }
protected override IEnumerable <ListItem <MindMapLayoutType> > GetStandardItems() { foreach (MindMapLayoutType lt in Enum.GetValues(typeof(MindMapLayoutType))) { yield return(new ListItem <MindMapLayoutType>( MindMapLayoutTypeConverter._ConvertToString(lt), lt, GetIcon(lt))); } //return base.GetStandardItems(); }