Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize window using WinAPI

I'm want to resize a window using WinAPI. I use a WinAPI function:

SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);

The window is resized, but its content is not redrawn. If I resize this window using the mouse, the content redraws. How to resize window using WinAPI with content redrawing?

like image 925
Dmitriy Kudinov Avatar asked Feb 18 '26 22:02

Dmitriy Kudinov


1 Answers

Make sure you don't specify SWP_NOREDRAW in the uFlags parameter. If it's not set and the window still doesn't redraw, call UpdateWindow after calling SetWindowPos.

like image 100
Francis Gagné Avatar answered Feb 21 '26 11:02

Francis Gagné



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!