|
-
Dec 12th, 2006, 08:43 PM
#1
Thread Starter
Hyperactive Member
Rounded Edge Form
Hey everyone,
I am making this program that can have different themes. One of the themes is windows xp, and i want to make the upper two corners rounded... but it is not working. I am using the configs stored in a file and depending on that I load the theme image. I am using the following code:
VB Code:
Option Explicit
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 SetWindowRgn Lib "user32" _
(ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Sub MakeRound(frm As Form)
Dim lngNewWnd As Long
Dim lngNewRgn As Long
Dim lngWidth As Long
Dim lngHeight As Long
' Calculate the current width
lngWidth = frm.Width / Screen.TwipsPerPixelX
' Calculate the current height
lngHeight = frm.Height / Screen.TwipsPerPixelY
' Create the new region
lngNewWnd = CreateRoundRectRgn(0, 0, Me.Width, Me.Height, 2, 2)
lngNewRgn = SetWindowRgn(frm.hWnd, lngNewWnd, True)
'/ Screen.TwipsPerPixelX + 1
' / Screen.TwipsPerPixelY + 1
End Sub
Private Sub Form_Load()
lblComponent(0).BackColor = lngMenuColor
MakeRound Me
frmMain.Width = frmMain.imgBackGround.Width
frmMain.Height = frmMain.imgBackGround.Height
End Sub
The image in imgBackground is being loaded in frmFlash. I was wondering if anyone could suggest anything... I tried loading the image on the form itslef and also loading the image on imgBackground, which imgBackground.Visible = False and setting the form width, but then only a part of the form is visible. If I have the form visible, the white at the upper two corners is visible. Is there possibly any way to fix this.
Any suggestions would be appreciated,
Thank you in advance,
Khanjan
Hey... If you found this post helpful please rate it.

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|