- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello,
i get stuck! i reaaly need to know if i can draw a graphic on a windows client area, or calling graphic from menu bar. i am trying to understand gdi, but it is hard. is this posssible to do that? if yes, is there anyone who tried it before? could you help me?
i get stuck! i reaaly need to know if i can draw a graphic on a windows client area, or calling graphic from menu bar. i am trying to understand gdi, but it is hard. is this posssible to do that? if yes, is there anyone who tried it before? could you help me?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The most important concept you must have in mind is that Windows doesn't do the screen buffering for you; instead, every application is being informed via WM_PAINT message that it should update its screen. WM_PAINT is sent whenever a portion of the window is revealed; application is supposed to do a BeginPaint, draw onto supplied device context (DC), and call EndPaint to tell Windows that it has updated the screen OK and that the update rectangle is now valid.
However, if you draw directly (using e.g. Rectangle) on supplied DC, the window contents will flicker during moving/sizing, as updating takes considerable time. Thus, any non-trivial application usually does double-buffering itself -- it creates an off-screen (memory) DC and it just "copies&pastes" its contents onto DC returned by BeginPaint.
I wouldn't say GDI is hard; rather, it's a bit boring, because you have to take care to create and delete GDI objects yourself. Attached workspace uses double-buffering technique and my XFTGDI module, which is a thin wrapper around most frequently used GDI calls; you can find the documentation (.chm) here. Make sure you read the Platform SDK/Graphic and Multimedia services/GDI/Painting and Drawing chapter first.
(Attachment in the followup. My additions to wizard-generated code are clearly marked).
Jugoslav
However, if you draw directly (using e.g. Rectangle) on supplied DC, the window contents will flicker during moving/sizing, as updating takes considerable time. Thus, any non-trivial application usually does double-buffering itself -- it creates an off-screen (memory) DC and it just "copies&pastes" its contents onto DC returned by BeginPaint.
I wouldn't say GDI is hard; rather, it's a bit boring, because you have to take care to create and delete GDI objects yourself. Attached workspace uses double-buffering technique and my XFTGDI module, which is a thin wrapper around most frequently used GDI calls; you can find the documentation (.chm) here. Make sure you read the Platform SDK/Graphic and Multimedia services/GDI/Painting and Drawing chapter first.
(Attachment in the followup. My additions to wizard-generated code are clearly marked).
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here it is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
thank you for your kindly respond. i will try to understand what you wrote...
thank you for your kindly respond. i will try to understand what you wrote...

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page