
Drawing a border for a round form...
There is an API function that draws a border around a region.
The FrameRgn function draws a border around the specified region by using
the specified brush.
BOOL FrameRgn(
HDC hdc, // handle to device context
HRGN hrgn, // handle to region to be framed
HBRUSH hbr, // handle to brush used to draw border
int nWidth, // width of region frame
int nHeight // height of region frame
);
http://premium.microsoft.com/msdn/library/sdkdoc/regions_1y5q.htm
You can retrieve the region for the window with te GetWindowRgn function.
http://premium.microsoft.com/msdn/library/sdkdoc/pantdraw_23la.htm
The following code works, with one remark:
The frame is drawn in the Form_Paint event, which is fired when the region
inside the border must be redrawn. VB does not notify you when the border
should be redrawn, so there are some cases when the frame is not drawn.
You should subclass the form and watch for the WM_NCPAINT message and draw
the border when you get this message
Alejandro.
Pigeon escribi en mensaje
Quote:
>Dear all,
> I've written a Sub for making a form into a round form :
>Public Sub MakeRoundForm(InForm As Form)
> Dim lret As Long
> Dim dl As Long
> lret = CreateRoundRectRgn(0, 0, InForm.Width / Screen.TwipsPerPixelX,
>InForm.Height / Screen.TwipsPerPixelY, 25, 25)
> dl = SetWindowRgn(InForm.hWnd, lret, True)
>End Sub
> And now, I want to draw a black border around the round form... how can
>I do so ?
> Thanks a lot...
>Pigeon.