To get rounded corners try the following code in a module (.bas): [VB6
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Lon
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Lon
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Lon
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Lon
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Lon
Private Type POINTAP
X As Lon
Y As Lon
End Typ
Private Type REC
Left As Lon
Top As Lon
Right As Lon
Bottom As Lon
End Typ
Public Function RndRect(ByVal hWnd As Long, ByVal Arc As Long, Optional ByVal Redraw As Boolean = True) As Lon
' Written By: COD3B453 [
[email protected]
' Legal: This comment MUST remain in this code snippe
' Description: Set window region so that it has rounded corner
Dim PointRgn(0 To 7) As POINTAP
Dim PolyRgn As Lon
Dim CircA As Lon
Dim CircB As Lon
Dim CircC As Lon
Dim CircD As Lon
Dim lArc As Lon
Dim W As Lon
Dim H As Lon
Dim wRect As REC
lArc = 2 * Ar
GetWindowRect hWnd, wRec
W = wRect.Right - wRect.Lef
H = wRect.Bottom - wRect.To
PointRgn(0).X = Ar
PointRgn(0).Y =
PointRgn(1).X = W - Ar
PointRgn(1).Y =
PointRgn(2).X =
PointRgn(2).Y = Ar
PointRgn(3).X =
PointRgn(3).Y = H - Ar
PointRgn(4).X = W - Ar
PointRgn(4).Y =
PointRgn(5).X = Ar
PointRgn(5).Y =
PointRgn(6).X =
PointRgn(6).Y = H - Ar
PointRgn(7).X =
PointRgn(7).Y = Ar
PolyRgn = CreatePolygonRgn(PointRgn(0), 8, 1
CircA = CreateEllipticRgn(0, 0, lArc, lArc
CircB = CreateEllipticRgn(W, 0, W - lArc, lArc
CircC = CreateEllipticRgn(W, H, W - lArc, H - lArc
CircD = CreateEllipticRgn(0, H, lArc, H - lArc
CombineRgn PolyRgn, PolyRgn, CircA,
CombineRgn PolyRgn, PolyRgn, CircB,
CombineRgn PolyRgn, PolyRgn, CircC,
CombineRgn PolyRgn, PolyRgn, CircD,
RndRect = SetWindowRgn(hWnd, PolyRgn, Redraw
End Functio
NOTE
'hWnd' should be the form's hwnd propert
'Arc' should be the radius of the curved corners in pixel
'Redraw' is optional and doesn't really matter too muc
Changing the colour of the caption bar is much harder, using the SetDIBitsToDevice API can do this but you have to override the window process for the form so that it doesn't draw the default one back on it
good luc
cod3b453