I'm making application using BCB including VCL library. I put TImage component/object on an empty form, assigned proper bitmap image to Picture property of that image: [code]TImage* img1;[/code]
Then i wrote form's method that paints a frame around 'img'.
[code]void __fastcall TfrmMainForm::drawFrame()
rgb = 0x00ffeeff; // light gray RGB color code
// creating region on image area, 26 is width of caption in pixels
// frame will be 4 pixels width around image
rgn = CreateRoundRectRgn(form->Left + img1->Left + 2,
form->Top + 26 + img1->Top + 2,
form->Left + img1->Left + img1->Width + 11,
form->Top + 26 + img1->Top + img1->Height + 11,
4 , 4);
hdc = GetDC(hWnd);
brush = CreateSolidBrush(rgb);
FrameRgn(hdc, rgn, brush, 4, 4);
Wanting always to have frame around my image, i am calling this method in OnPaint event. When OnPaint event occurs everything is repainted fine, except in one situation.
When my forms window is not top most (i drag some other opened window above it - like windows explorer), those region frame around image is being redrawed on top of the foreground window. I understand that it is normal because of the code in an OnPaint event, but don't know the way to solve this situation.
I mean, how to disable that repainting region frame on top of foreground windows other than my application window?
Appreciate any help or advice.