Clarify that wxDC::CopyAttributes() doesn't copy scaling factor

Also show an example of setting the scaling factor in wxMemoryDC
documentation.
This commit is contained in:
Vadim Zeitlin 2022-06-28 22:50:24 +02:00
parent b9a84dcae5
commit b95f2b699d
2 changed files with 22 additions and 0 deletions

View File

@ -1500,6 +1500,9 @@ public:
- Background brush
- Layout direction
Note that the scaling factor is not considered to be an attribute of
wxDC and is @e not copied by this function.
@param dc
A valid (i.e. its IsOk() must return @true) source device context.
*/

View File

@ -38,6 +38,25 @@
This happens automatically when wxMemoryDC object goes out of scope.
Note that the scaling factor of the bitmap determines the scaling factor
used by this device context, so when using a memory device context as a
back buffer for a window, you should typically create the bitmap using the
same scale factor as used by the window, e.g.
@code
void MyWindow::OnPaint(wxPaintEvent&)
{
wxBitmap bmp;
bmp.CreateWithDIPSize(GetClientSize(), GetDPIScaleFactor());
{
wxMemoryDC memdc(bmp);
... use memdc to draw on the bitmap ...
}
wxPaintDC dc(this);
dc.DrawBitmap(bmp, wxPoint(0, 0));
}
@endcode
@library{wxcore}
@category{dc}