protected override void DrawNodeImageCore(CustomDrawNodeImagesEventArgs e, Rectangle bounds, Point location, object imageList, int imageIndex) { e.Appearance.FillRectangle(e.Cache, bounds); MyTreeListNode node = e.Node as MyTreeListNode; if (node == null) { return; } Image img = node.AvatarImage; if (img != null) { e.Cache.DrawImage(img, node.AvatarImageBounds); } else { e.Cache.DrawRectangle(Pens.Gray, node.AvatarImageBounds); } string caption = node.AvatarCaption; if (caption != string.Empty) { e.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Top; e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; e.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.FormatFlags = StringFormatFlags.NoWrap; e.Cache.DrawString(caption, e.Appearance.GetFont(), e.Appearance.GetForeBrush(e.Cache), node.AvatarCaptionBounds, sf); } }
public override void DrawNodePreview(CustomDrawNodePreviewEventArgs e) { MyTreeListNode node = e.Node as MyTreeListNode; e.Appearance.FillRectangle(e.Cache, e.Bounds); for (int i = 0; i < node.Buttons.Count; i++) { node.Buttons[i].Painter.Draw(new MyToolButtonDrawEventArgs(e.Appearance, node.Buttons[i].ViewInfo, e.Cache)); } }
protected override void CalcSelectImageBounds(RowInfo rInfo, Rectangle indentBounds) { base.CalcSelectImageBounds(rInfo, indentBounds); MyTreeListNode node = rInfo.Node as MyTreeListNode; if (node == null) { return; } Rectangle rect = rInfo.SelectImageBounds; rect.Height += minAvatarCaptionHeight; rInfo.SelectImageBounds = rect; node.CalcAvatarBounds(rInfo.SelectImageBounds); }
public override void ShowEditor() { RowInfo ri = FocusedRow; if (ri != null) { MyTreeListNode node = ri.Node as MyTreeListNode; if (node != null) { if (node.IsPosted) { return; } } } base.ShowEditor(); }
public override TreeListHitTest GetHitTest(Point pt) { TreeListHitTest ht = base.GetHitTest(pt); if (ht.HitInfoType == HitInfoType.RowPreview) { MyTreeListNode node = ht.Node as MyTreeListNode; node.HitTest(pt); nodeWithFocusedPreview = node; } else { if (nodeWithFocusedPreview != null) { nodeWithFocusedPreview.HitTest(pt); nodeWithFocusedPreview = null; } } return(ht); }
protected virtual void CalcPreviewElementBounds(RowInfo ri) { MyTreeListNode node = ri.Node as MyTreeListNode; if (!node.IsPosted) { int posX = ri.PreviewBounds.Right - 20, posY = ri.PreviewBounds.Y + 2; for (int i = node.Buttons.Count - 1; i >= 0; i--) { node.Buttons[i].ViewInfo.CalcBounds(new Rectangle(posX, posY, node.Buttons[i].Width, node.Buttons[i].Height)); posX -= (node.Interval + node.Buttons[i].Width); } } else { if (node.Buttons.Count > 0) { node.Buttons[0].ViewInfo.CalcBounds(new Rectangle(ri.PreviewBounds.X + 2, ri.PreviewBounds.Y, node.Buttons[0].Width, node.Buttons[0].Height)); } } }
internal void AddNewNode(MyTreeListNode parentNode) { TreeListNode node = null; try { node = AppendNode(null, parentNode); } catch { } if (node != null) { object[] values = new object[Data.Columns.Count]; for (int i = 0; i < Data.Columns.Count; i++) { if (Data.Columns[i].ColumnName == KeyFieldName) { if (ParentFieldName != string.Empty) { node.SetValue(ParentFieldName, parentNode.GetValue(Data.Columns[i].ColumnName)); } continue; } if (Data.Columns[i].ColumnName == AvatarCaptionFieldName || Data.Columns[i].ColumnName == AvatarImageFieldName) { node.SetValue(Data.Columns[i].ColumnName, parentNode.GetValue(Data.Columns[i].ColumnName)); continue; } } node.Selected = true; } }
public MyTreeListViewInfo(MyTreeList treeList) : base(treeList) { nodeWithFocusedPreview = null; }