作者:绿色风
分类:
时间:2022-08-18
浏览:100
楼主 wise |
Q:如何得到月牙形的窗体? A:ALT+F11→插入模块→输入以下代码:
- Option Explicit
- 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 CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
- Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
- Private Declare Function GetActiveWindow Lib "user32" () As Long
- Const RGN_XOR = 3
- '得到的窗体是两个相连的月牙形
- Private Sub UserForm_Initialize()
- Dim x1, x2
- Dim hwnd As Long
- hwnd = GetActiveWindow()
- x1 = CreateEllipticRgn(100, 100, 400, 400)
- x2 = CreateEllipticRgn(200, 100, 500, 400)
- CombineRgn x1, x1, x2, RGN_XOR
- SetWindowRgn hwnd, x1, 1
- End Sub
- Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
- Unload Me
- End Sub
如何得到月牙形的窗体.rar |
2楼 0Mouse |
貌似运行结果不是那么完美!
|
3楼 acecrazy |
运行情况同零鼠兄,VBE界面只能看到一点。 |
免责声明
有感于原ExcelTip.Net留存知识的价值及部分知识具有的时间限定性因素,
经与ExcelTip.Net站长Apolloh商议并征得其同意,
现将原属ExcelTip.Net的知识帖采集资料于本站点进行展示,
供有需要的人士查询使用,也慰缅曾经的论坛时代。
所示各个帖子的原作者如对版权有异议,
可与本人沟通提出,或于本站点留言,我们会尽快处理。
在此,感谢ExcelTip.Net站长Apolloh的支持,感谢本站点所有人**绿色风(QQ:79664738)**的支持与奉献,特此鸣谢!
------本人网名**KevinChengCW(QQ:1210618015)**原ExcelTip.Net总版主之一