Esempio n. 1
0
        private void tlObjectTree_CustomDrawNodePreview(object sender, CustomDrawNodePreviewEventArgs e)
        {
            Rectangle bounds = e.Bounds;

            bounds.Offset(15, 0);
            bounds.Width -= 15;
            TreeListNode node = e.Node;

            Color foreColor;

            if (HasNodeErrors(node))
            {
                foreColor = Color.Red;
            }
            else
            {
                foreColor = Color.Magenta;
            }

            e.Appearance.ForeColor = foreColor;
            e.Graphics.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds);
            var sf = new StringFormat(e.Appearance.GetStringFormat());

            sf.FormatFlags ^= StringFormatFlags.NoWrap;
            e.Appearance.DrawString(e.Cache, e.PreviewText, bounds, sf);
            e.Handled = true;
        }
        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));
            }
        }