Click here to Skip to main content
15,908,931 members

Comments by vvozar (Top 4 by date)

vvozar 7-Mar-11 13:02pm View    
Just read about DC's. I am trying to find out how to get my forms window handle, so I could get device context for that window(client DC). As 'mbue' said, i should get client DC to paint on it, because up in the code i am using device context of entire screen. Maybe that's the cause of repainting issue. Does anyone know how to get device context for painting on client area of the window? Or how to get my windows handle (HWND)?
vvozar 5-Mar-11 16:27pm View    
What do you mean by 'client DC'?
vvozar 5-Mar-11 14:00pm View    
Code in FormPaint method looks like this for now:
<pre> void __fastcall TfrmMainForm::FormPaint(TObject *Sender)
{
odButton1->clearFrame();
odButton2->clearFrame();
}
</pre>
This my first time working with Device Context, Brushes, Regions, Rectangles... I'm not quite sure am i using Device context correctly.

"OnPaint you should get a DC you can paint in (thats the client dc)" - what do you mean exactly? Do you mean that i should get DC in FormPaint method, modify clearFrame(...) method and pass that DC as a parameter?
(thanks for info about brushes, i'll add DeleteObject(brush); at the end of the method)
vvozar 4-Mar-11 16:28pm View    
Deleted
Some more precise information.I am coding in C++ using Borland C++ Builder, including VCL library (creating forms with 'drag and drop' technique). Actually, I created form (for now it's just that first form initially created when you start new project) and put two image components on it (VCL library, Additional Tab, dragged and dropped Image component on form).

This way i added two IDE Managed Components of 'TImage *' type (named img1 and img2):

TImage* img1;
TImage* img2;

Each 'TImage*' object/component has its own Picture property, which is of TBitmap type. So, in Object Inspector i have assigned proper bitmap images to Picture properties.