AnimateWindow是一个窗口打开和关闭时产生动画效果的新函数,
声明:
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte,dwFlags As Long) As Long
注释:具体可以使用的常量及其用法
Const LWA_ALPHA=&H2 注释:表示把窗体设置成半透明样式
Const LWA_COLORKEY=&H1 注释:表示不显示窗体中的透明色
|
具体例子
程序代码
修改窗体的式样,在窗体中加入:
Protected Overloads Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or &H20
Return cp
End Get
End Property
设置透明度:
1. | . |
2. |
|
3. |
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Const GWL_EXSTYLE = (-20)
Public Const LWA_ALPHA = &H2
Public Const LWA_COLORKEY = &H1
SetLayeredWindowAttributes(Handle, 1, 0, Win32.ULW_ALPHA)
第二种使用方法
SetLayeredWindowAttributes (Me.Handle, &H0, 0, LWA_COLORKEY )
注释:表明不显示窗体中的透明色
注释:而第二个参数表示透明色为黑色,并且你可以用RGB函数来指定颜色
微软例子:http://support.microsoft.com/default.aspx?scid=kb;en-us;249341
<script type=text/javascript> var sectionFilter = "type != 'notice' && type != 'securedata' && type != 'querywords'"; var tocArrow = "/library/images/support/kbgraphics/public/en-us/downarrow.gif"; var depthLimit = 10; var depth3Limit = 10; var depth4Limit = 5; var depth5Limit = 3; var tocEntryMinimum = 1; </script> <script src="/common/script/gsfx/kbtoc.js?13" type=text/javascript></script>SUMMARY
<script type=text/javascript>loadTOCNode(1, 'summary');</script>MORE INFORMATION
<script type=text/javascript>loadTOCNode(1, 'moreinformation');</script>Step-by-Step Example
<script type=text/javascript>loadTOCNode(2, 'moreinformation');</script>1. | Create a new Standard EXE project in Visual Basic. Form1 is created by default. |
2. | Add the following code to the General Declarations section of Form1:
|
3. | Run the example program by pressing the F5 key. The form should look like a normal Visual Basic window. However, windows that are lower in the Z order should be partially visible through the window. It is also possible to make mouse events go through to the lower windows by changing the preceding code line to: However, the form does not remain topmost if another form is activated. See the "Reference" section for information on how to create a form that remains on top. |
Win32.UpdateLayeredWindow(Handle, screenDc, topPos, size, memDc, pointSource, 0, blend, Win32.ULW_ALPHA)