wxPrintPreview to large icons on High DPI Display (Issue #23127)

42 views
Skip to first unread message

Stefan Ziegler

unread,
Jan 9, 2023, 12:32:17 PM1/9/23
to wx-...@googlegroups.com, Subscribed

Tested wxPrintPreview recently and noticed that the Icons in the toolbar are to large. Seems to b another High DPI issue. Screenshot is attached. Code is below, copied from an example.

image

wxPrintPreview* preview = new wxPrintPreview(printout1, printout2);
wxPreviewFrame* frame = new wxPreviewFrame(preview, GetCtrl(),
	"Demo Print Preview",
	wxPoint(100, 100),
	wxSize(600, 650));
frame->Centre(wxBOTH);
frame->Initialize();
frame->Show(true);


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23127@github.com>

Maarten

unread,
Jan 9, 2023, 5:30:18 PM1/9/23
to wx-...@googlegroups.com, Subscribed

I can reproduce this in the printing sample. Using wxBitmapBundle seems to fix it, but I didn't test thoroughly:

diff --git "a/src/common/prntbase.cpp" "b/src/common/prntbase.cpp"
index c616438ffe..9e93ed5bcd 100644
--- "a/src/common/prntbase.cpp"
+++ "b/src/common/prntbase.cpp"
@@ -1517,7 +1517,7 @@ public:
         // We don't use (smaller) images inside a button with a text label but
         // rather toolbar-like bitmap buttons hence use wxART_TOOLBAR and not
         // wxART_BUTTON here.
-        wxBitmap bmp = wxArtProvider::GetBitmap(artId, wxART_TOOLBAR);
+        wxBitmapBundle bmp = wxArtProvider::GetBitmapBundle(artId, wxART_TOOLBAR);
         wxBitmapButton * const btn = new wxBitmapButton(m_parent, btnId, bmp);
         btn->SetToolTip(tooltip);


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23127/1376422437@github.com>

VZ

unread,
Jan 9, 2023, 8:10:31 PM1/9/23
to wx-...@googlegroups.com, Subscribed

Thanks Maarten, I agree that this is the right thing to do, but I wonder why do we get the icons of wrong size by default. I wouldn't be surprised if the bitmaps ended up being scaled, but using the wrong size for them doesn't seem right... I'll try to understand why does this happen, even if I'm almost certain that the above is the correct fix in any case.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23127/1376580628@github.com>

VZ

unread,
Jan 11, 2023, 7:50:09 PM1/11/23
to wx-...@googlegroups.com, Subscribed

As I suspected, there was indeed another problem, which should be fixed by the first commit in the PR I've just opened (with the 2nd one being just Maarten's fix from above).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23127/1379667939@github.com>

Stefan Ziegler

unread,
Jan 12, 2023, 8:30:04 AM1/12/23
to wx-...@googlegroups.com, Subscribed

Found another problem related to this:

Printing window is not updating correctly if we do not call wxYield in our printout, see image,
image

printer.Print(GetCtrl(), printout.get(), false);

Currently we add wxYield in out printout to fix this, but this fix breaks usage of wxPrintPreview/wxPreviewFrame. If we yield in our printout and if we use the control icons in wxPreviewFrame (zoom, prev/next page, ...) then the app crashes sporadically because of an invalid internal object in wxPrintPreview.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23127/1380358838@github.com>

VZ

unread,
Jan 12, 2023, 11:52:26 AM1/12/23
to wx-...@googlegroups.com, Subscribed

@sz5000 Something weird has happened here, I've seen a notification from GitHub about your comment mentioning another problem, but I don't see it here. Have you deleted it intentionally? If not, i.e. if there is still some other problem, please open another issue for it. TIA!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23127/1380713872@github.com>

VZ

unread,
Jan 15, 2023, 3:18:31 PM1/15/23
to wx-...@googlegroups.com, Subscribed

Closed #23127 as completed via 4f6aa5a.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/23127/issue_event/8230320416@github.com>

Reply all
Reply to author
Forward
0 new messages