wxMSW: Fix drawing vertical lines with pen width > 1 in RTL layout (PR #26448)

31 views
Skip to first unread message

AliKet

unread,
May 11, 2026, 9:33:46 PM (3 days ago) May 11
to wx-...@googlegroups.com, Subscribed

In the following pictures, there are four (04) vertical lines (blue & red) in the middle drawn with pen width == 1 and 2. Blue lines are drawn by calling wxDrawLine() function internally. Whereas red lines are drawn by wxDrawHVLine() function.
I removed m_pen.GetWidth() <= 1 || check from this line https://github.com/wxWidgets/wxWidgets/blob/4ed05f7b47d3bd3ac01c4b0d867bece20fe083ff/src/msw/dc.cpp#L710 to expose the bug only. The code I use to draw these line ():

    // Put this in MyCanvas::DrawDefault() in drawing sample
    for ( int i = 0; i < 2; i++ )
    {
        int dx = 400 + 3*(i);
        int pw = i+1; // pen width

        wxPen pen(*wxBLUE, pw);
        dc.SetPen(pen);

        dc.DrawLine(dx, 0, dx, 80); // calls wxDrawLine() internally

        pen = wxPen(*wxRED, pw);
        pen.SetCap(wxCAP_BUTT);
        dc.SetPen(pen);

        dc.DrawLine(dx, 80, dx, 160); // calls wxDrawHVLine() internally

        dc.SetPen(wxNullPen);
    }

The results:

In LTR layout:

drawline.png (view on web)

In RTL layout (with this PR):

drawline_rtl_ok.png (view on web)

In RTL layout (before):

drawline_rtl_bad.png (view on web)

This PR also fixes a bug in wxGrid where the vertical frozen border was not drawn in RTL layout:

Before:

grid_frozen_rtl_bad.png (view on web)

After (I changed the grid lines colour to grey):

grid_frozen_rtl_ok.png (view on web)

You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26448

Commit Summary

  • 2eda584 wxMSW: Fix drawing vertical lines with pen width > 1 in RTL layout

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26448@github.com>

AliKet

unread,
May 11, 2026, 9:41:16 PM (3 days ago) May 11
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#26448)

This is unrelated to #26398


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26448/c4426616547@github.com>

VZ

unread,
May 12, 2026, 10:50:07 AM (2 days ago) May 12
to wx-...@googlegroups.com, Subscribed

@vadz approved this pull request.

Thanks, it's really strange that the shift is 1 independently of the pen width (I would find it understandable if it were width - 1), but if this is what we need to do to make this work, let's do it.

I'll merge this soon, thanks again.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26448/review/4273256659@github.com>

VZ

unread,
May 12, 2026, 11:20:34 AM (2 days ago) May 12
to wx-...@googlegroups.com, Subscribed

Closed #26448 via 5e66fb7.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26448/issue_event/25435875958@github.com>

Reply all
Reply to author
Forward
0 new messages