Подскажите как сделать форму прозрачной, но что бы при этом рисунок в пикчербоексе не изменялся(не становился прозрачным).
примеры нашол-вся форма и со всеми элементами становится прозрачной...
Option Explicit
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal Hrgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateRectRgn 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 Const RGN_DIFF = 4
Private Const RGN_OR = 2
Private Sub Form_Load()
RebuildWindowRgn
End Sub
Sub RebuildWindowRgn()
Dim FullRgn As Long
Dim Rgn As Long
Form1.ScaleMode = 3
FullRgn = CreateRectRgn(0, 0, Me.Width, Me.Height)
Rgn = CreateRectRgn(0, 0, Me.Width, Me.Height)
CombineRgn FullRgn, FullRgn, Rgn, RGN_DIFF
Rgn = CreateRectRgn(Picture1.Left + 2, (Picture1.Top + 22), (Picture1.Left + Picture1.Width + 2), (Picture1.Top + Picture1.Height + 22))
CombineRgn FullRgn, FullRgn, Rgn, RGN_OR
SetWindowRgn Form1.hWnd, FullRgn, True
End Sub
Me.Top = 0
Me.Left = 0
Me.Width = Screen.Width
Me.Height = Screen.Height
Option Explicit
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal Hrgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateRectRgn 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 Const RGN_DIFF = 4
Private Const RGN_OR = 2
'Именилось это:
'------------------------------------------------
Dim Drop As Boolean
'------------------------------------------------
Public Sub RebuildWindowRgn()
Dim FullRgn As Long
Dim Rgn As Long
Me.ScaleMode = 3
FullRgn = CreateRectRgn(0, 0, Me.Width, Me.Height)
Rgn = CreateRectRgn(0, 0, Me.Width, Me.Height)
CombineRgn FullRgn, FullRgn, Rgn, RGN_DIFF
Rgn = CreateRectRgn(Picture1.Left + 2, (Picture1.Top + 22), (Picture1.Left + Picture1.Width + 2), (Picture1.Top + Picture1.Height + 22))
CombineRgn FullRgn, FullRgn, Rgn, RGN_OR
SetWindowRgn Me.hWnd, FullRgn, True
End Sub
Private Sub Form_Load()
RebuildWindowRgn
End Sub
'И это:
'---------------------------------------------------
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Drop = True
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Drop Then
Me.ScaleMode = 1
Me.Left = Me.Left + x
Me.Top = Me.Top + y
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Drop = False
End Sub
'------------------------------------------------
Shasha писал(а):keks-n, использовал последний код. недостатком является что за угол, покапаюсь в коде мож чего и нашкребу...
у пикчербока поставил в бордерстайл-0 и апперансе -0 вроде чисто картинка, но как сделать что бы область пикчер бокса была прозрачной???
Сейчас этот форум просматривают: Google-бот и гости: 147