News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Need painting help

Started by NoCforMe, October 06, 2011, 12:10:22 AM

Previous topic - Next topic

NoCforMe

No, I don't have a house that needs painted. I'm at the point in my Windows programming where I need to learn the basics of painting. You know, all that WM_PAINT, InvalidateRect()-type stuff. Does anyone know of some good primers (online) on the subject? There's a lot of good info at MSDN, of course, but what I'd like is a good overview. I'm especially not clear about when to paint objects, and in what sequence.

Note to owners of board: I'm wondering if you might want to create a separate Windows programming forum to deal just with questions on that platform (since this isn't a MASM32 question, strictly speaking). Or do you consider MASM32 to be tightly bound up with Windows? Just a thought.

dedndave

so much depends on what type of information you want to display
text is very different than graphics - and monospaced text is very different from true-type

scrolling and window sizing also come into play - the 3 operations are intertwined

NoCforMe

Yes, yes and yes.

So do you have any good sources of information? (Online, I mean. I wish I had a good book, too.)

dedndave

i started with something simple - monospaced text
learning the scroll stuff was the hardest, which i did by reading and refering to numerous examples
i don't remember which one finally sunk in - lol
it was probably a forum post by Tedd or something similar
also, Erol (Vortex) has a text editor somewhere on the forum (old stuff) that helped

for the move stuff, Alex got me going and Edgar (donkey) helped me learn about DeferWindowPos
http://www.masm32.com/board/index.php?topic=16049.msg132645#msg132645
if you scroll down that thread, i have an attachment that you can look at

paint was actually the easiest of the 3 - at least, it is for monospace text
basically, you need
BeginPaint
ExtTextOut
EndPaint

TextOut is another function, but for my application, i found ExtTextOut to be faster
the MSDN docs were quite helpful for paint
http://msdn.microsoft.com/en-us/library/dd162759%28v=vs.85%29.aspx

once you get that down, use the forum search tool to learn about CreateCompatibleDC and BitBlt functions (graphics)

have you looked at Iczelion's tutorials ?

NoCforMe

Quote from: dedndave on October 06, 2011, 12:34:31 AM
have you looked at Iczelion's tutorials ?

Yes, and with all due respect, while I appreciate what (he?) has done, it's far from a comprehensive tutorial. Basically, what his "tutorials" do is explain how his little programs work. That's fine--if you only want to know how the program works. (In fairness, he does touch on some of the relevant Windows functionality in doing so.)

No, what I'm after is a conceptual guide to painting. The underlying principles: how objects get painted; how they get obliterated by other objects and therefore need repainted (including the whole concept of invalidation/validation); how (and why) to send and intercept paint messages. Do you get what I'm after?

Yes, BeginPaint()--DrawText()--EndPaint()--I got that. That's trivial. What I'm after is WHY you do things in the sequence you do. Why does my little child window get its border all munged up, and how do I correct it? What about all those RECT thingies: when should I use them? Stuff like that.

Another word about Iczelion's site: what's with those horrible color schemes? Every time I read one of his tutorials I thank gawd I have PrefBar installed, so I can uncheck "Colors" and restore the page to some sane, readable color combination.

dedndave

i updated my previous post - you may want to review it again

Quotethe MSDN docs were quite helpful for paint
http://msdn.microsoft.com/en-us/library/dd162759%28v=vs.85%29.aspx

i have downloaded the entire Iczelion tutorial in html
you can easily edit the colors   :P

if you have a specific problem post your code...

dedndave

oops - in the above text, i said move was one of the 3 intertwined elements
i meant to say sizing - move is fairly simple
so, it's size, scroll, and paint that all work together