创建Win32区域窗口

发表于:2007-06-21来源:作者:点击数: 标签:
The Win32 API includes a really amazing feature called region windows . A window under Win32 no longer has to be rectangular! In fact, it can be any shape that may be constructed using Win32 region functions. Using the SetWindowRgn Win32 f

   


  The Win32 API includes a really amazing feature called region windows. A window under Win32 no longer has to be rectangular! In fact, it can be any shape that may be constructed using Win32 region functions. Using the SetWindowRgn Win32 function from within VB is so simple, but the results are unbelievable. The following example shows a VB form that is NOT rectangular. Enjoy!

注释: This goes into the General Declarations section:

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

Private Sub Form_Load()
  Show 注释:The form!
  SetWindowRgn hWnd, _
  CreateEllipticRgn(0, 0, 300, 200), _
  True
End Sub

原文转自:http://www.ltesting.net