• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.DrawTreeNodeEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.DrawTreeNodeEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DrawTreeNodeEventArgs类的具体用法?C# DrawTreeNodeEventArgs怎么用?C# DrawTreeNodeEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DrawTreeNodeEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了DrawTreeNodeEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnDrawNode

        protected override void OnDrawNode(DrawTreeNodeEventArgs e)
        {
            if (e.Node.IsVisible && null != e.Node.Tag)
            {
                if (e.Node.Tag is AttributeData)
                {
                    e.DrawDefault = false;
                    var data = (AttributeData) e.Node.Tag;

                    e.Graphics.DrawString(data.Name, Font, _grayBrush, e.Bounds.X, e.Bounds.Y);
                    var nameSize = e.Graphics.MeasureString(data.Name, Font);

                    e.Graphics.DrawString(data.Value, Font, _blackPen.Brush, e.Bounds.X + nameSize.Width + 5, e.Bounds.Y);
                }

                else if (e.Node.Tag is PluginElementData)
                {
                    e.DrawDefault = false;
                    var data = (PluginElementData) e.Node.Tag;

                    Bitmap icon;

                    if ((icon = GetIcon(data.IconPath)) != null)
                        e.Graphics.DrawImage(icon, e.Bounds.X, e.Bounds.Y, 16, 16);

                    e.Graphics.DrawString(data.Name, Font, _blackPen.Brush, e.Bounds.X + 20, e.Bounds.Y);
                }
            }
            else e.DrawDefault = true;

            base.OnDrawNode(e);
        }
开发者ID:beyastard,项目名称:XTools,代码行数:32,代码来源:PluginStoreViewer.cs


示例2: OnDrawNode

        protected override void OnDrawNode(DrawTreeNodeEventArgs e)
        {
            TreeNodeStates state = e.State;
            Font font = e.Node.NodeFont ?? e.Node.TreeView.Font;
            Color fore = e.Node.ForeColor;
            Rectangle rect = new Rectangle();
            if (fore == Color.Empty)
                fore = e.Node.TreeView.ForeColor;

            if (e.Node == e.Node.TreeView.SelectedNode)
            {
                fore = SystemColors.HighlightText;
                rect = new Rectangle(0, e.Bounds.Y, e.Node.TreeView.Width, e.Node.Bounds.Height);
                e.Graphics.FillRectangle(new SolidBrush(e.Node.BackColor), rect);
                //ControlPaint.DrawFocusRectangle(e.Graphics, rect, fore, Color.Red);
                TextRenderer.DrawText(e.Graphics, e.Node.Text, font, e.Bounds, fore, e.Node.BackColor, TextFormatFlags.GlyphOverhangPadding | TextFormatFlags.VerticalCenter);
            }
            else
            {
                rect = new Rectangle(0, e.Bounds.Y, e.Node.TreeView.Width, e.Node.Bounds.Height);
                e.Graphics.FillRectangle(new SolidBrush(Parent.BackColor), rect);
                TextRenderer.DrawText(e.Graphics, e.Node.Text, font, e.Bounds, fore, TextFormatFlags.GlyphOverhangPadding | TextFormatFlags.VerticalCenter);
            }
            base.OnDrawNode(e);
        }
开发者ID:devfinity-fx,项目名称:cpms_z,代码行数:25,代码来源:SwxTreeView.cs


示例3: State_DrawNode

        void State_DrawNode (object sender, DrawTreeNodeEventArgs e) {
            if (!(e.Node.Tag is TreeNode_StateTag)) {
                return;
            }
            e.DrawDefault = false;
            TreeNode_StateTag state_tag = (TreeNode_StateTag)e.Node.Tag;
            State state = state_tag.state;
            string[] texts = e.Node.Text.Split();
            using (Brush black = new SolidBrush(Color.Black)) {
                using (Brush blue = new SolidBrush(Color.Blue)) {
                    using (Brush red = new SolidBrush(Color.Red)) {
                        using (Brush yellow = new SolidBrush(Color.DarkOrange)) {
                            Brush[] brushes = new Brush[] { 
                                    blue, red, yellow, red, blue,
                                    blue, red, yellow, red, blue
                                };
                            SizeF offset = new SizeF();

                            string panels = texts[0];
                            for (int i = 0; i < panels.Length; ++i) {
                                String p = "" + panels[i];
                                e.Graphics.DrawString(p, tree.Font, brushes[i], e.Bounds.Left + (int)offset.Width, e.Bounds.Top);
                                offset += e.Graphics.MeasureString(p, tree.Font);
                            }
                            for (int i = 1; i < texts.Length; ++i) {
                                string txt = texts[i];
                                e.Graphics.DrawString(txt, tree.Font, black, e.Bounds.Left + (int)offset.Width, e.Bounds.Top);
                                offset += e.Graphics.MeasureString(txt, tree.Font);
                            }
                        }
                    }
                }
            }
        }
开发者ID:baguio,项目名称:SSC-AI,代码行数:34,代码来源:MainForm_OnSolved_TreeUpdater.cs


示例4: OnDrawNode

        protected override void OnDrawNode(DrawTreeNodeEventArgs e)
        {
            base.OnDrawNode(e);

            //节点背景绘制
            if (e.Node.IsSelected)
            {
                e.Graphics.DrawImage(Resources.tree_Selected, e.Bounds);
            }
            else if ((e.State & TreeNodeStates.Hot) != 0)//|| currentMouseMoveNode == e.Node)
            {
                e.Graphics.DrawImage(Resources.tree_Hover, e.Bounds);
            }
            else
            {
                e.Graphics.FillRectangle(Brushes.White, e.Bounds);
            }

            //节点头图标绘制
            if (e.Node.IsExpanded)
            {
                e.Graphics.DrawImage(Resources.tree_NodeExpend, e.Node.Bounds.X - 12, e.Node.Bounds.Y + 9);
            }
            else if (e.Node.IsExpanded == false && e.Node.Nodes.Count > 0)
            {
                e.Graphics.DrawImage(Resources.tree_NodeCollaps, e.Node.Bounds.X - 12, e.Node.Bounds.Y + 9);
            }

            //文本绘制
            using (Font foreFont = new Font(this.Font, FontStyle.Regular))
            using (Brush drawTextBrush = new SolidBrush(drawTextColor))
            {
                e.Graphics.DrawString(e.Node.Text, foreFont, drawTextBrush, e.Node.Bounds.Left + 5, e.Node.Bounds.Top + 1);
            }
        }
开发者ID:Bobwjy,项目名称:SignPressClient,代码行数:35,代码来源:BaseTreeView.cs


示例5: OnDrawNode

		protected override void OnDrawNode(DrawTreeNodeEventArgs e)
		{
			try
			{
				Rectangle Bounds = new Rectangle(e.Bounds.Location.X, e.Bounds.Location.Y, e.Bounds.Width, e.Bounds.Height);
				//e.Node.Nodes.Item.
				switch (State)
				{
					case TreeNodeStates.Default:
						e.Graphics.FillRectangle(Brushes.Red, Bounds);
						e.Graphics.DrawString(e.Node.Text, new Font("Segoe UI", 8), Brushes.LimeGreen, new Rectangle(Bounds.X + 2, Bounds.Y + 2, Bounds.Width, Bounds.Height), Helpers.NearSF);
						Invalidate();
						break;
					case TreeNodeStates.Checked:
						e.Graphics.FillRectangle(Brushes.Green, Bounds);
						e.Graphics.DrawString(e.Node.Text, new Font("Segoe UI", 8), Brushes.Black, new Rectangle(Bounds.X + 2, Bounds.Y + 2, Bounds.Width, Bounds.Height), Helpers.NearSF);
						Invalidate();
						break;
					case TreeNodeStates.Selected:
						e.Graphics.FillRectangle(Brushes.Green, Bounds);
						e.Graphics.DrawString(e.Node.Text, new Font("Segoe UI", 8), Brushes.Black, new Rectangle(Bounds.X + 2, Bounds.Y + 2, Bounds.Width, Bounds.Height), Helpers.NearSF);
						Invalidate();
						break;
				}

			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}

			base.OnDrawNode(e);
		}
开发者ID:CookieYT,项目名称:FlatUI,代码行数:33,代码来源:FlatTreeView.cs


示例6: DrawDocTreeNodeText

		// This method is here because by default TreeView try to display icon in every case
		// i.e. even when we have no icon to show it's going to put a blank space. So here we 
		// detect when that happen and "shift" the text back in the right position 16px to the left
		internal static void DrawDocTreeNodeText (object sender, DrawTreeNodeEventArgs e)
		{
			if (!string.IsNullOrEmpty (e.Node.ImageKey)) {
				e.DrawDefault = true;
				return;
			}
			// Retrieve the node font. If the node font has not been set,
            // use the TreeView font.
            Font nodeFont = e.Node.NodeFont;
            if (nodeFont == null)
				nodeFont = ((TreeView)sender).Font;

            // Draw the node text.
			var clip = new Rectangle (e.Bounds.X - 16, e.Bounds.Y, e.Bounds.Width + 16, e.Bounds.Height);
			e.Graphics.SetClip (clip);
			if ((e.State & TreeNodeStates.Selected) != 0) {
				e.Graphics.Clear (SystemColors.Highlight);
				using (var pen = new Pen (Color.Black)) {
					pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
					e.Graphics.DrawRectangle (pen, new Rectangle (clip.Location, new Size (clip.Width - 1, clip.Height - 1)));
				}
				e.Graphics.DrawString (e.Node.Text, nodeFont, SystemBrushes.HighlightText, clip);
			} else {
				e.Graphics.Clear (Color.White);
				e.Graphics.DrawString (e.Node.Text, nodeFont, Brushes.Black, clip);
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:mono-tools,代码行数:30,代码来源:CustomDrawing.cs


示例7: DrawSearchResultNodeText

		internal static void DrawSearchResultNodeText (object sender, DrawTreeNodeEventArgs e)
		{
            Font nodeFont = e.Node.NodeFont;
            if (nodeFont == null)
				nodeFont = ((TreeView)sender).Font;
			var clip = new Rectangle (0, e.Bounds.Y, e.Node.TreeView.Width, e.Bounds.Height);
			e.Graphics.SetClip (clip);
			var selectedStates = TreeNodeStates.Marked | TreeNodeStates.Selected | TreeNodeStates.Focused;

			if (e.Node.Tag == null) {
				nodeFont = new Font (nodeFont.FontFamily, nodeFont.Size - 2);
				// We use a TabRenderer to get the nice system gradient
				e.Graphics.Clear (Color.White);
				clip = new Rectangle (1, e.Bounds.Y + 1, e.Node.TreeView.ClientRectangle.Width - 3, e.Bounds.Height - 3);
				// If we're using the classic theme, then we can't use TabRender. Fall back to a simpler view.
				if (TabRenderer.IsSupported) {
					TabRenderer.DrawTabItem(e.Graphics, clip, e.Node.Text, nodeFont, System.Windows.Forms.VisualStyles.TabItemState.Normal);
				} else {
					e.Graphics.FillRectangle(SystemBrushes.ActiveCaption, clip);
					// The fallback rendering has more empty space than the tab rendering. Take advantage of it.
					var fallbackNodeFont = new Font(nodeFont.FontFamily, nodeFont.Size + 2);
					e.Graphics.DrawString(e.Node.Text, fallbackNodeFont, SystemBrushes.ActiveCaptionText, clip.X, clip.Y);
				}
				using (var pen = new Pen (Color.Black, 1.0f))
					e.Graphics.DrawLine (pen, new Point (clip.Left, clip.Bottom), new Point (clip.Right - 1, clip.Bottom));
			} else {
				e.Graphics.Clear ((e.State & selectedStates) != 0 ? SystemColors.Highlight : SystemColors.ControlLightLight);
				e.Graphics.DrawString (e.Node.Text, nodeFont, (e.State & selectedStates) != 0 ? SystemBrushes.HighlightText : SystemBrushes.ControlText, new PointF (e.Bounds.X, e.Bounds.Y + 2));
			}
		}
开发者ID:mono,项目名称:mono-tools,代码行数:30,代码来源:CustomDrawing.cs


示例8: OnDrawNode

		private void OnDrawNode(object sender, DrawTreeNodeEventArgs e)
		{
			if ((e.State & TreeNodeStates.Selected) != 0)
			{

				var backColor = ((e.State & TreeNodeStates.Focused) != 0) ? Configuration.DefaultFocusedColor : BackColor ;

				e.Graphics.FillRectangle(new SolidBrush(backColor), NodeBounds(e.Node));

				// Retrieve the node font. If the node font has not been set,
				// use the TreeView font.
				var nodeFont = e.Node.NodeFont ?? ((TreeView) sender).Font;

				// Draw the node text.
				e.Graphics.DrawString(e.Node.Text, nodeFont, new SolidBrush(ForeColor),
					Rectangle.Inflate(e.Bounds, 2, 0));
			}
			else
			{
				e.DrawDefault = true;
			}

//			if ((e.State & TreeNodeStates.Focused) == 0) return;
//
//			using(var focusBrush = new SolidBrush(Configuration.DefaultFocusedColor))
//			{
//				focusBrush.Color = Color.FromArgb(100, focusBrush.Color.R, focusBrush.Color.G, focusBrush.Color.B);
//				var focusBounds = NodeBounds(e.Node);
//				focusBounds.Size = new Size(focusBounds.Width - 1,
//					focusBounds.Height - 1);
////				e.Graphics.DrawRectangle(focusPen, focusBounds);
//				e.Graphics.FillRectangle(focusBrush,focusBounds);
//			}
		}
开发者ID:rokn,项目名称:REAL-Editor,代码行数:34,代码来源:ProjectExplorer.cs


示例9: OnDrawNode

 /// <summary>
 /// DrawNodeイベントを発生させます。
 /// </summary>
 /// <param name="e">イベントデータを格納している<see cref="System.Windows.Forms.DrawTreeNodeEventArgs"/>。</param>
 protected override void OnDrawNode(DrawTreeNodeEventArgs e)
 {
     if (!MultiLineLabel)
         base.OnDrawNode(e);
     else
         TextRenderer.DrawText(e.Graphics, e.Node.Text, this.Font, e.Bounds, this.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Left);
 }
开发者ID:Ricordanza,项目名称:Ricordanza.kernel,代码行数:11,代码来源:CoreTreeView.cs


示例10: OnDrawNode

 protected override void OnDrawNode(DrawTreeNodeEventArgs e)
 {
     e.Graphics.DrawString (e.Node.Text.Split (';') [0], new Font ("Microsoft Sans Serif", 13),
         new SolidBrush (Color.Black), e.Bounds.X, e.Bounds.Y);
     e.Graphics.DrawString (e.Node.Text.Split (';') [1], new Font ("Microsoft Sans Serif", 9),
         new SolidBrush (Color.Black), e.Bounds.X + 10, e.Bounds.Y+15);
     base.OnDrawNode (e);
 }
开发者ID:kozze89,项目名称:SparkleShare-GUI-Experiments,代码行数:8,代码来源:TreeView.cs


示例11: OnDrawNode

 protected override void OnDrawNode(DrawTreeNodeEventArgs e)
 {
     if ((OnDrawNodeField != null) && (OnDrawNodeField.GetValue(this) == null))
     {
         e.DrawDefault = true;
     }
     base.OnDrawNode(e);
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:8,代码来源:TreeViewEx.cs


示例12: OnDrawNode

        protected override void OnDrawNode(DrawTreeNodeEventArgs e)
        {
            TreeNodeStates treeState = e.State;
            Font treeFont = e.Node.NodeFont ?? e.Node.TreeView.Font;
            Font hotFont = e.Node.NodeFont ?? e.Node.TreeView.Font;

            // Colors.
            Color foreColor = e.Node.ForeColor;
            string strDeselectedColor = @"#6B6E77", strSelectedColor = @"#94C7FC";
            Color selectedColor = System.Drawing.ColorTranslator.FromHtml(strSelectedColor);
            Color deselectedColor = System.Drawing.ColorTranslator.FromHtml(strDeselectedColor);

            // New brush.
            SolidBrush selectedTreeBrush = new SolidBrush(selectedColor);
            SolidBrush deselectedTreeBrush = new SolidBrush(deselectedColor);

            // Set default font color.
            if (foreColor == Color.Empty)
                foreColor = e.Node.TreeView.ForeColor;

            // Draw bounding box and fill.
            if (e.Node == e.Node.TreeView.SelectedNode)
            {
                // Use appropriate brush depending on if the tree has focus.
                if (this.Focused)
                {
                    foreColor = SystemColors.HighlightText;
                    e.Graphics.FillRectangle(selectedTreeBrush, e.Bounds);
                    ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds, foreColor, SystemColors.Highlight);
                    TextRenderer.DrawText(e.Graphics, e.Node.Text, treeFont, e.Bounds,
                                                 foreColor, TextFormatFlags.GlyphOverhangPadding);
                }
                else
                {
                    foreColor = SystemColors.HighlightText;
                    e.Graphics.FillRectangle(deselectedTreeBrush, e.Bounds);
                    ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds, foreColor, SystemColors.Highlight);
                    TextRenderer.DrawText(e.Graphics, e.Node.Text, treeFont, e.Bounds,
                                                 foreColor, TextFormatFlags.GlyphOverhangPadding);
                }
            }
            else
            {
                if ((e.State & TreeNodeStates.Hot) == TreeNodeStates.Hot)
                {
                    e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
                    TextRenderer.DrawText(e.Graphics, e.Node.Text, hotFont, e.Bounds,
                                                 System.Drawing.Color.Black, TextFormatFlags.GlyphOverhangPadding);
                }
                else
                {
                    e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
                    TextRenderer.DrawText(e.Graphics, e.Node.Text, treeFont, e.Bounds,
                                                 foreColor, TextFormatFlags.GlyphOverhangPadding);
                }
            }
        }
开发者ID:nathanlea,项目名称:SecureCameraCaptureClient,代码行数:57,代码来源:CustomTreeView.cs


示例13: treeView1_DrawNode

        private void treeView1_DrawNode(object sender, DrawTreeNodeEventArgs e)
        {
            e.DrawDefault = true;

            Rectangle rect = e.Bounds;

            if ((e.State & TreeNodeStates.Selected) != 0)
            {
                if ((e.State & TreeNodeStates.Focused) != 0)
                    e.Graphics.FillRectangle(SystemBrushes.Highlight, rect);
                else
                    e.Graphics.FillRectangle(SystemBrushes.Control, rect);
            }
            else
                e.Graphics.FillRectangle(Brushes.White, rect);

            e.Graphics.DrawRectangle(SystemPens.Control, rect);

            for (int intColumn = 1; intColumn < this.listView1.Columns.Count; intColumn++)
            {
                rect.Offset(this.listView1.Columns[intColumn - 1].Width, 0);
                rect.Width = this.listView1.Columns[intColumn].Width;

                e.Graphics.DrawRectangle(SystemPens.Control, rect);

                string strColumnText;
                string[] list = e.Node.Tag as string[];
                if (list != null && intColumn<=list.Length)
                    strColumnText = list[intColumn - 1];
                else
                    strColumnText = e.Node.Text; // dummy

                TextFormatFlags flags = TextFormatFlags.EndEllipsis;
                switch(this.listView1.Columns[intColumn].TextAlign)
                {
                    case HorizontalAlignment.Center:
                        flags |= TextFormatFlags.HorizontalCenter;
                        break;
                    case HorizontalAlignment.Left:
                        flags |= TextFormatFlags.Left;
                        break;
                    case HorizontalAlignment.Right:
                        flags |= TextFormatFlags.Right;
                        break;
                    default:
                        break;
                }

                rect.Y++;
                if ((e.State & TreeNodeStates.Selected) != 0 &&
                    (e.State & TreeNodeStates.Focused) != 0)
                    TextRenderer.DrawText(e.Graphics, strColumnText, e.Node.NodeFont, rect, SystemColors.HighlightText, flags);
                else
                    TextRenderer.DrawText(e.Graphics, strColumnText, e.Node.NodeFont, rect, e.Node.ForeColor, e.Node.BackColor, flags);
                rect.Y--;
            }
        }
开发者ID:rrajaguk,项目名称:ApduParser,代码行数:57,代码来源:TreeViewColumns.cs


示例14: MeasureItemWidth

		protected override int MeasureItemWidth(DrawTreeNodeEventArgs e)
		{
			Graphics g = e.Graphics;
			int x = MeasureTextWidth(g, positionText, BoldMonospacedFont);
//			if (line != null && !line.IsDeleted) {
//				x += MeasureTextWidth(g, bookmark.Document.GetText(line).Replace("\t", "    "), BoldMonospacedFont);
//			}
			return x;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:9,代码来源:BookmarkNode.cs


示例15: OnDrawNode

 /// <summary>
 /// Override draw event to draw appended Control text to RegisterTreeNode.
 /// </summary>
 protected override void OnDrawNode(DrawTreeNodeEventArgs e)
 {
     if (e.Node is RegisterTreeNode)
     {
         e.Graphics.DrawString((e.Node as RegisterTreeNode).Control.Text, Font, new SolidBrush((e.Node as RegisterTreeNode).CreateTextColor()), e.Bounds.Right, e.Bounds.Top);
     }
     e.DrawDefault = true;
     base.OnDrawNode(e);
 }
开发者ID:kaviarasankk,项目名称:x-IMU-GUI,代码行数:12,代码来源:RegisterTreeView.cs


示例16: OnDrawNode

      private void OnDrawNode(object sender, DrawTreeNodeEventArgs e) {
         TestTreeNode node = e.Node as TestTreeNode;
         if( node != null ) {
            node.OnDrawNode(sender, e);
         }
         else {
            e.DrawDefault = true;
         }
         return;
         //e.DrawDefault = true;
         //return;

         // Draw the background and node text for a selected node.
         if ((e.State & TreeNodeStates.Selected) != 0) {
            // Draw the background of the selected node. The NodeBounds
            // method makes the highlight rectangle large enough to
            // include the text of a node tag, if one is present.
            Rectangle bounds = NodeBounds(e.Node);
            e.Graphics.FillRectangle(Brushes.Green, bounds);

            // Retrieve the node font. If the node font has not been set,
            // use the TreeView font.
            Font nodeFont = e.Node.NodeFont;
            if (nodeFont == null) nodeFont = ((TreeView)sender).Font;

            // Draw the node text.
            //e.Graphics.DrawString(e.Node.Text, nodeFont, Brushes.White, 2, 2);
            e.Graphics.DrawString(e.Node.Text, nodeFont, Brushes.White, bounds.Left, bounds.Top);
                //Rectangle.Inflate(e.Bounds, 2, 0));
         }

        // Use the default background and node text.
         else {
            e.DrawDefault = true;
         }

         // If a node tag is present, draw its string representation 
         // to the right of the label text.
         if (e.Node.Tag != null) {
            e.Graphics.DrawString(e.Node.Tag.ToString(), _tagFont,
                Brushes.Red, e.Bounds.Right + 2, e.Bounds.Top);
         }

         // If the node has focus, draw the focus rectangle large, making
         // it large enough to include the text of the node tag, if present.
         if ((e.State & TreeNodeStates.Focused) != 0) {
            using (Pen focusPen = new Pen(Color.Black)) {
               focusPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
               Rectangle focusBounds = NodeBounds(e.Node);
               focusBounds.Size = new Size(focusBounds.Width - 1,
               focusBounds.Height - 1);
               e.Graphics.DrawRectangle(focusPen, focusBounds);
            }
         }

      }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:56,代码来源:TestTreeView.cs


示例17: DrawNode

 internal override void DrawNode(DrawTreeNodeEventArgs e)
 {
     CheckBoxRenderer.DrawCheckBox(
         e.Graphics,
         new Point(this.Bounds.X - 14, this.Bounds.Y + 1),
         _state ?
             CheckBoxState.CheckedNormal :
             CheckBoxState.UncheckedNormal
     );
 }
开发者ID:borota,项目名称:JTVS,代码行数:10,代码来源:OptionsTreeView.cs


示例18: OnDrawNode

 protected override void OnDrawNode(DrawTreeNodeEventArgs e)
 {
     e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
     SizeF textSize = e.Graphics.MeasureString(e.Node.Text, oRAFonts.Font_SubDescription);
     
     //Because the bounds of the replay list include vertical scrollbar bounds
     int actualWidth = Width - new VScrollBar().Width - 2;
     e.Graphics.FillRectangle(new SolidBrush(e.Node.IsSelected ? oRAColours.Colour_Item_BG_0 : oRAColours.Colour_BG_P0), new Rectangle(e.Bounds.Left, e.Bounds.Y, Width, e.Bounds.Height));
     e.Graphics.DrawString(e.Node.Text, oRAFonts.Font_SubDescription, new SolidBrush(e.Node.IsSelected ? oRAColours.Colour_Text_H : oRAColours.Colour_Text_N), new RectangleF(new PointF(e.Bounds.Left + 5, e.Bounds.Y + e.Bounds.Height / 2f - textSize.Height / 2), new SizeF(actualWidth - 5, textSize.Height)), format);
 }
开发者ID:smoogipooo,项目名称:osu-Replay-Analyzer,代码行数:10,代码来源:oRAReplayList.cs


示例19: MeasureItemWidth

		protected override int MeasureItemWidth(DrawTreeNodeEventArgs e)
		{
			Graphics g = e.Graphics;
			int x = MeasureTextWidth(g, fileNameText, RegularBigFont);
			x += MeasureTextWidth(g, occurences, ItalicBigFont);
			if (icon != null) {
				x += icon.Width;
			}
			return x + 3;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:10,代码来源:BookmarkFolderNode.cs


示例20: OnDrawNode

        protected override void OnDrawNode(DrawTreeNodeEventArgs e)
        {
            const int SPACE_IL = 3;  // space between Image and Label

            // we only do additional drawing
            //e.DrawDefault = true;

            base.OnDrawNode(e);

            if (base.ShowLines && base.ImageList != null && e.Node.ImageIndex == NOIMAGE
                // exclude root nodes, if root lines are disabled
                //&& (base.ShowRootLines || e.Node.Level > 0))
                )
            {
                // Using lines & images, but this node has none: fill up missing treelines

                // Image size
                int imgW = base.ImageList.ImageSize.Width;
                int imgH = base.ImageList.ImageSize.Height;

                // Image center
                int xPos = e.Node.Bounds.Left - SPACE_IL - imgW / 2;
                int yPos = (e.Node.Bounds.Top + e.Node.Bounds.Bottom) / 2;

                // Image rect
                Rectangle imgRect = new Rectangle(xPos, yPos, 0, 0);
                imgRect.Inflate(imgW / 2, imgH / 2);

                using (Pen p = new Pen(base.LineColor, 1))
                {
                    p.DashStyle = DashStyle.Custom;

                    // account uneven Indent for both lines
                    p.DashOffset = base.Indent % 2;

                    // Horizontal treeline across width of image
                    // account uneven half of delta ItemHeight & ImageHeight
                    int yHor = yPos + ((base.ItemHeight - imgRect.Height) / 2) % 2;

                    e.Graphics.DrawLine(p, 
                        (base.ShowRootLines || e.Node.Level > 0) ? imgRect.Left : xPos - (int)p.DashOffset,
                        yHor, imgRect.Right, yHor);

                    
                    if (!base.CheckBoxes && e.Node.IsExpanded)
                    {
                        // Vertical treeline , offspring from NodeImage center to e.Node.Bounds.Bottom
                        // yStartPos: account uneven Indent and uneven half of delta ItemHeight & ImageHeight
 
                        int yVer = yHor + (int)p.DashOffset;
                        e.Graphics.DrawLine(p, xPos, yVer, xPos, e.Node.Bounds.Bottom);
                    }
                }
            }
        }
开发者ID:GarnettLuo,项目名称:XiaoCai.WinformUI,代码行数:55,代码来源:TreeViewX.cs



注:本文中的System.Windows.Forms.DrawTreeNodeEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.ErrorProvider类代码示例发布时间:2022-05-26
下一篇:
C# Forms.DrawListViewSubItemEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap