 |
VB How-To Ask your "How do I do this with VB?" questions in this forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

November 19th, 2003, 01:40 AM
|
Registered User
|
|
Join Date: Nov 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Rounded VB forms???
Hello ALl,
IS it possible in VB to make forms rounded or Rounded rectangles
If any idea ???
|

November 22nd, 2003, 11:06 AM
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i have used before these apis with other ones
Public Declare Function SetWindowRgn Lib "user32" Alias "SetWindowRgn" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Declare Function CreateRectRgn Lib "gdi32" Alias "CreateRectRgn" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CreateRoundRectRgn Lib "gdi32" Alias "CreateRoundRectRgn" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Ahmed Ali
Software Developer
|

November 25th, 2003, 05:54 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
If you don't want to do API calls, simply insert an image into your form. The image is that of a rounded rectangle. If you create the rounded rectangle image in another program (e.g. Microsoft Paint), you can control its background color, fill color, line color, and line width.
In the form's Design View, select the image and then choose FORMAT > SEND TO BACK off the menu so that other controls are in front of it. You can also set its SIZE MODE property to ZOOM so that if you resize the image on the form, the whole image will resize itself to fit the space you make for it instead of being clipped or cropped.
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|

June 25th, 2004, 02:47 PM
|
Registered User
|
|
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
'PLEASE DON'T TELL ME STUPIDLY SOLUTIONS, THERE'S NO WAY DIFFERENT 'FROM API CALLS
'HERE IT'S MY FRIENDS
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
' Region API functins
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, _
ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, _
ByVal Y3 As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, _
lpRect As RECT) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, _
ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As _
Long
' modify the shape of a window
'
' This routine supports three values for SHAPE
' 0 = circle/ellipse, 1=rounded rect, 2=rhomb
'
' NOTES: You get best effects using borderless forms
' Remember to provide alternative commands for
' closing and moving the form
Sub SetWindowShape(ByVal hWnd As Long, ByVal Shape As Long)
Dim lpRect As RECT
Dim wi As Long, he As Long
Dim hRgn As Long
' get the bounding rectangle's size
GetWindowRect hWnd, lpRect
wi = lpRect.Right - lpRect.Left
he = lpRect.Bottom - lpRect.Top
' create a region
Select Case Shape
Case 0 ' circle/ellipse
hRgn = CreateEllipticRgn(0, 0, wi, he)
Case 1 ' rounded rectangle
hRgn = CreateRoundRectRgn(0, 0, wi, he, 20, 20)
Case 2 ' rhomb
Dim lpPoints(3) As POINTAPI
lpPoints(0).X = wi \ 2
lpPoints(0).Y = 0
lpPoints(1).X = 0
lpPoints(1).Y = he \ 2
lpPoints(2).X = wi \ 2
lpPoints(2).Y = he
lpPoints(3).X = wi
lpPoints(3).Y = he \ 2
hRgn = CreatePolygonRgn(lpPoints(0), 4, 1)
End Select
' trim the window to the region
SetWindowRgn hWnd, hRgn, True
DeleteObject hRgn
End Sub
Private Sub Form_Load()
SetWindowShape hWnd, 1
End Sub
sad
|

June 26th, 2004, 01:05 AM
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes , there is no solution except API.. i had tried to any other way but could not found still..
and regarding to image i perfer to use GIF image becuase it support transparency .... so you may design a very nice image and can use that as skin ... as i had done for an application with 5 skins...
Stay Beautiful,
Abdul Salam
There is no moving creature on Earth whose sustenance is not provided by Allah. He knows its living and its resting place,
and all that is recorded in a glorious Book. (Al-Quran)
|
|
 |