File tree 1 file changed +9
-3
lines changed
src/System.Windows.Forms/src/System/Windows/Forms/Controls/TreeView
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -2847,12 +2847,18 @@ private unsafe void CustomDraw(ref Message m)
2847
2847
2848
2848
if ( RightToLeft == RightToLeft . Yes && RightToLeftLayout )
2849
2849
{
2850
+ int borderWidth = BorderStyle switch
2851
+ {
2852
+ BorderStyle . FixedSingle => 1 ,
2853
+ BorderStyle . Fixed3D => 2 ,
2854
+ _ => 0
2855
+ } ;
2856
+
2850
2857
// Reverse the X-axis drawing coordinates of the rectangle.
2851
- // Offset the text four pixels to the left to ensure that the text is centered on the fill rectangle.
2852
- int invertedX = Width - bounds . X - textSize . Width - 4 ;
2858
+ int invertedX = Width - bounds . X - textSize . Width - borderWidth * 2 ;
2853
2859
2854
2860
// Subtract the scroll bar width when the scroll bar appears.
2855
- if ( Height <= PreferredHeight )
2861
+ if ( Height - borderWidth * 2 < PreferredHeight )
2856
2862
{
2857
2863
float dpiScale = ( float ) DeviceDpi / ( float ) ScaleHelper . InitialSystemDpi ;
2858
2864
invertedX -= ( int ) ( SystemInformation . VerticalScrollBarWidth * Math . Round ( dpiScale , 2 ) ) ;
You can’t perform that action at this time.
0 commit comments