Need Round corner text box in Visual Basic 6

Hi Experts,
I need to use text box that has rounded corners, in a Visual Basic 6 application . A customer has specifically asked for rounded-corner text boxes. If anyone has used it or know where to find it, please pass on the information.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

sabrehagenConnect With a Mentor Commented:
I have attached an example solution illustrating the method described in my post above. The jpg in the folder is used as the form background, and the only code on the form sets the background colour of the grey text box.
uzairpAuthor Commented:
Codebot, The source code is in that I do not have much experience with. How can I use it in VB6?
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

You can create round edges using the following functions. You will want to change the borderstyle of your textboxe to - None to get a decent result. See code block for example.



Option Explicit

Private Declare Function CreateRoundRectRgn Lib "Gdi32.dll" (ByVal nLeftRect As Long, ByVal nTopRect As Long, ByVal nRightRect As Long, ByVal nBottomRect As Long, ByVal nWidthEllipse As Long, ByVal nHeightEllipse As Long) As Long
Private Declare Function SetWindowRgn Lib "User32.dll" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Declare Function DeleteObject Lib "Gdi32.dll" (ByVal hObject As Long) As Long

Public Sub MakeRound(ByRef t As TextBox)
    Dim hRgn As Long
    hRgn = CreateRoundRectRgn(0, 0, _
        t.Width / Screen.TwipsPerPixelX, _
        t.Height / Screen.TwipsPerPixelX, 5, 5)
    If hRgn Then
        SetWindowRgn t.hWnd, hRgn, 1
        DeleteObject hRgn
    End If

End Sub

Private Sub Form_Load()
    MakeRound Text1
End Sub

Open in new window

An alternate way of creating a textbox with round corners is by using an image and creating a pseudo-round cornered textbox. You could make the image in photoshop then use it as a background for your form or place an image control on the form to contain the picture. Your form would look like this: From there, place a text box with no border on top of that picture box and make sure the bounds of the text box fit within the text box image. This is the way I always used to do my custom style controls. It's not perfect, but it works, and it's quick. For any clarifications, just ask :)
uzairpAuthor Commented:
The textbox looks nice. Would you be able to point me to the code that is ready to be used for the textbox you sent?

Codebot: I have not been able to create the textbox with the example you sent. where do I put the Xml code that is followed by the line, shown in the link you sent?
The manifest XML document required to use XP Visual Styles is as follows:
Has this solved your problem uzairp? If so, could you please select a comment as the solution please?
uzairpAuthor Commented:
Yes, I can use the code example that sabrehagen sent. Thank you.
All Courses

From novice to tech pro — start learning today.