WWW.ИСХОДНИКИ.РУ cpp.sources.ru
java.sources.ru web.sources.ru soft.sources.ru
jdbc.sources.ru asp.sources.ru api.sources.ru

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

профайл | регистрация | faq

Автор Тема:   Как сделать форму прозрачной?
AlexR опубликован 10-10-2001 13:21 MSK   Click Here to See the Profile for AlexR   Click Here to Email AlexR  
Как сделать форму прозрачной?
aker13 опубликован 12-10-2001 13:23 MSK     Click Here to See the Profile for aker13  Click Here to Email aker13     
Private Sub Form_Load()
Me.ScaleMode = vbPixels
withFrameFlag = True
toggleFrame withFrameFlag
End Sub
Private Sub toggleFrame(inFlag As Boolean)
Dim w As Single, h As Single
Dim edge As Single, topEdge As Single
Dim mLeft, mTop
Dim i As Integer
Dim r As Long
Dim outer As Long, inner As Long
mFormRegion = CreateRectRgn(0, 0, 0, 0)
w = ScaleX(Width, vbTwips, vbPixels)
h = ScaleY(Height, vbTwips, vbPixels)
edge = (w - ScaleWidth) / 2
topEdge = h - edge - ScaleHeight
If inFlag Then
outer = CreateRectRgn(0, 0, w, h)
inner = CreateRectRgn(edge, topEdge, w - edge, h - edge)
CombineRgn mFormRegion, outer, inner, RGN_DIFF
End If
For i = 0 To Me.Controls.Count - 1
mLeft = ScaleX(Me.Controls(i).Left, Me.ScaleMode, vbPixels) + edge
mTop = ScaleX(Me.Controls(i).Top, Me.ScaleMode, vbPixels) + topEdge
r = CreateRectRgn(mLeft, mTop, _
ScaleX((Me.Controls(i).Width), Me.ScaleMode, vbPixels) + mLeft, _
ScaleY((Me.Controls(i).Height), Me.ScaleMode, vbPixels) + mTop)
CombineRgn mFormRegion, r, mFormRegion, RGN_OR
SetWindowRgn hwnd, mFormRegion, True
End Sub

и модуль

Public Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Const RGN_OR = 2
Public Const RGN_DIFF = 4



Powered by: Ultimate Bulletin Board, Freeware Version 5.10a
Purchase our Licensed Version- which adds many more features!
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.