From e9204baa6d39a4bdf64cdb9e8af22681e9d88655 Mon Sep 17 00:00:00 2001 From: "Leaf Shi (BEYONDSOFT CONSULTING INC)" Date: Fri, 13 Dec 2024 16:37:19 +0800 Subject: [PATCH] Update the drawing position of the Treeview control text --- .../src/System/Windows/Forms/Controls/TreeView/TreeView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs index a7e66b35eb7..b86e50815fd 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView/TreeView.cs @@ -2826,7 +2826,7 @@ private unsafe void CustomDraw(ref Message m) { Rectangle bounds = node.Bounds; Size textSize = TextRenderer.MeasureText(node.Text, node.TreeView!.Font); - Point textLoc = new(bounds.X - 1, bounds.Y); // required to center the text + Point textLoc = new(bounds.X, bounds.Y); // required to center the text bounds = new Rectangle(textLoc, new Size(textSize.Width, bounds.Height)); DrawTreeNodeEventArgs e = new(g, node, bounds, (TreeNodeStates)(nmtvcd->nmcd.uItemState));