Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 19th, 2003, 01:40 AM
Registered User
 
Join Date: Nov 2003
Location: India, MS, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rounded VB forms???

Hello ALl,

IS it possible in VB to make forms rounded or Rounded rectangles

If any idea ???




Reply With Quote
  #2 (permalink)  
Old November 22nd, 2003, 11:06 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cairo, , Egypt.
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

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
Reply With Quote
  #3 (permalink)  
Old November 25th, 2003, 05:54 PM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

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
Reply With Quote
  #4 (permalink)  
Old June 25th, 2004, 02:47 PM
Registered User
 
Join Date: Jun 2004
Location: asd, asd, Saint Barthelemy.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ayhandorman Send a message via MSN to ayhandorman
Default

'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
Reply With Quote
  #5 (permalink)  
Old June 26th, 2004, 01:05 AM
Authorized User
 
Join Date: Jun 2004
Location: Islamabad, Sindh, Pakistan.
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make image bix edges rounded seco Dreamweaver (all versions) 0 April 9th, 2007 05:30 PM
<b> tag for getting a rounded corner table? Cyber Shiva HTML Code Clinic 1 March 13th, 2007 05:23 AM
rounded corners chrisgm187 CSS Cascading Style Sheets 1 January 30th, 2007 01:16 AM
Printing Forms in VB.NET? gisenberg VB.NET 2002/2003 Basics 0 July 23rd, 2004 08:22 PM
decimal values is rounded hosefo81 PHP Databases 2 December 9th, 2003 01:50 AM



All times are GMT -4. The time now is 04:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.