首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

怎么制作边角为圆形的窗体,重分感谢.

2012-02-27 
如何制作边角为圆形的窗体,重分感谢.........首先将窗体的BorderStyle属性设为None.把窗体背景设成自己的

如何制作边角为圆形的窗体,重分感谢.........
首先将窗体的   BorderStyle   属性设为None.     把窗体背景设成自己的图片,   图片是做成圆形边角的,   但是在运行的时候,窗体的四个边角还是有小块白色的底色,很难看.

不知如何去掉边角....

希望高手赐教..........多谢

[解决办法]
Option Explicit

Declare Function ChooseColor Lib "comdlg32.dll " Alias "ChooseColorA " (pChoosecolor As ChooseColor) As Long

Type ChooseColor
lStructSize As Long
hwndOwner As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SPI_GETWORKAREA = 48
Public Declare Function SetWindowPos Lib "user32 " (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function SystemParametersInfo Lib "user32 " Alias "SystemParametersInfoA " (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long


Declare Function SetWindowRgn Lib "user32 " (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
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

'*******************************************************
'-------------------Call MakForm(Me, Me.hwnd)
Public Sub MakForm(ByVal frm As Form, ByVal hWnd As Long)
Dim hRgn As Long
Dim lW As Long
Dim lH As Long
lW = frm.Width \ Screen.TwipsPerPixelX
lH = frm.Height \ Screen.TwipsPerPixelY

hRgn = CreateRoundRectRgn(0, 0, lW, lH, 12, 10)
SetWindowRgn hWnd, hRgn, 1
End Sub

[解决办法]
这里有一个根据图片开关创建窗口的源码,你可以看看


http://www.egooglet.com/static_html/200511072110376424admin.html

热点排行