СообЧа > База Знаний > Программирование > Visual Basic > Формы и элементы управления

Вопрос

Как сделать форму прозрачной?

Ответ

'Функции, переменные и типы, необходимые для установления прозрачности
'окна, только Win2000
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal
hwnd
As Long, ByVal crKey As Long, ByVal bAlpha As Long, ByVal dwFlags As
Long)
As Long
Public Declare Function UpdateLayeredWindow Lib "user32" (ByVal hwnd As
Long, ByVal hdc As Long, pptDst As POINTAPI, pSize As SIZE, ByVal
hdcSrc As
Long, pptSrc As POINTAPI, ByVal crKey As Long, pBlend As BLENDFUNCTION,
ByVal dwFlags As Long) As Long

Public Type BLENDFUNCTION
    BlendOp As Byte
    BlendFlags As Byte
    SourceConstantAlpha As Byte
    AlphaFormat As Byte
End Type

Private Type POINTAPI
    x As Long
    y As Long
End Type

Public Type SIZE
    cx As Long
    cy As Long
End Type

Public Const LWA_COLORKEY = &H1&
Public Const LWA_ALPHA = &H2&
Public Const LWA_OPAQUE = &HFF&

Public Const ULW_COLORKEY = &H1
Public Const ULW_ALPHA = &H2
Public Const ULW_OPAQUE = &H4

Public Declare Function GetWindowLong Lib "user32" Alias
"GetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias
"SetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As
Long

Public Const GWL_STYLE = (-16)
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_LAYERED = &H80000

Public Declare Function GetSysColor Lib "user32" (ByVal nIndex As
Long) As
Long

Public Declare Function GetVersionEx Lib "kernel32" Alias
"GetVersionExA"
(lpVersionInformation As OSVERSIONINFO) As Long

Public Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Public Const VER_PLATFORM_WIN32s = 0
Public Const VER_PLATFORM_WIN32_WINDOWS = 1
Public Const VER_PLATFORM_WIN32_NT = 2

Остальное смотри: trans.zip.

Аваков Дмитрий Александрович

Смотри файл FormCool.zip.

Krueger



Copyright © 2000-2004 Сообщество Чайников
Контактная информация