News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Window background

Started by clamicun, May 31, 2017, 03:15:13 AM

Previous topic - Next topic

clamicun

hutch,
easy to answer.
Because me stupido  didnt open your zipfile thinking it was  the one I uploaded.
But my was  chg_background.zip
Very sorry about that.

clamicun

ok.
Now I understand what you meant with "Static control".
Its uncomplicated.
But seems , its working only with .bmp and thats not what I wanted, because the user can pick his own background.

hutch--

The next trick is to use GDI+ to load the JPG/PNG/whatever image and convert it to BMP so you can use the standard Windows controls. I have it done in 64 bit but not 32 bit.

clamicun

hutch thank you,
that's exactely what my little example does (gdi+)
 

clamicun

Bom dia jj,
"It's just that the answer "use WM_PAINT" is the right one, but it took me years to accept that, so you are in good bad company
Spend an hour reading a good book on WM_PAINT"

I did too.
I MUST use WM_PAINT...

Here again is an example to not use WM_PAINT.
no_wmpaint.zip


jj2007

Nice! Move the window with the photo slightly out of the desktop, then move it back. As written earlier, it took me years to accept WM_PAINT, so you still have a lot of time to try without ;)

clamicun

jj,
obviously I don't understand the basics of WM_PAINT.

ok. I write this into my WndProc.

.elseif uMsg == WM_PAINT
INVOKE BeginPaint,main_hwnd,addr ps
mov hdc,eax
;do something ? IDM_1, IDM_2 ,IDM_3
INVOKE EndPaint,main_hwnd,addr ps

Now I have various commands in WM_COMMAND.  IDM_1, IDM_2
What I have to do, to make WM_PAINT  react to the command ?



jj2007

Between BeginPaint and EndPaint, you typically BitBlt a bitmap to the DC that BeginPaint gave to you. Really, Petzold or the Iczelion tutorials should give you everything you need.

clamicun

yes, I know

.elseif uMsg == WM_PAINT
INVOKE BeginPaint,main_hwnd,addr ps
mov hdc,eax
INVOKE Change_Bkgr,offset imagepath2,400,300,0,0
INVOKE EndPaint,main_hwnd,addr ps

The window starts with imagepath2 foto.

But I want that only after I clicked on a IDM_
And what about the other commands ?
What I do to use WM_PAINT on various tasks ?

The iczelion example I sure do know.
Does the same ... one job on startup.

ok.  this migt have to do with m "problem"

If you want to repaint your client area in response to other messages, you have two choices:

    Use GetDC-ReleaseDC pair and do your painting between these calls
    Call InvalidateRect or UpdateWindow  to invalidate the entire client area, forcing Windows to put WM_PAINT message in the message queue of your window and do your painting in WM_PAINT section