PDA

View Full Version : سوال: شفافیت فرم



Ninja-Assassin
چهارشنبه 13 شهریور 1392, 17:52 عصر
ســــــلام
تو این تکه برنامه میشه با اسکرول بار فرم رو شفاف کرد
چجوری میشه وقتی اسکرول بار رو تو یه فرم تغییر دادم همه ی فرم ها شفاف شن ممنون

mmssoft
چهارشنبه 13 شهریور 1392, 21:50 عصر
برای انجام این کار توی تمام فرم ها باید از ماژول کمک بگیرید. این کد رو بذارید توی ماژول :

Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Function Shafaf(Form As Form, Value As Integer)

SetWindowLong Form.hwnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Form.hwnd, 0, Value, LWA_ALPHA

End Function


و اینطوری شفافیت ها رو تغییر بدید :

Private Sub HScroll1_Change()

Shafaf Form2, HScroll1.Value
Shafaf Form1, HScroll1.Value

End Sub

Mr'Jamshidy
پنج شنبه 14 شهریور 1392, 00:26 صبح
برای انجام این کار توی تمام فرم ها باید از ماژول کمک بگیرید. این کد رو بذارید توی ماژول :

Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Function Shafaf(Form As Form, Value As Integer)

SetWindowLong Form.hwnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Form.hwnd, 0, Value, LWA_ALPHA

End Function


و اینطوری شفافیت ها رو تغییر بدید :

Private Sub HScroll1_Change()

Shafaf Form2, HScroll1.Value
Shafaf Form1, HScroll1.Value

End Sub

با اجازه دوستمون قسمت دوم کد رو اصلاح کردم

Private Sub Form_Load()
HScroll1.Max = 255
End Sub

Private Sub HScroll1_Scroll()
Dim frmObj As Form

For Each frmObj In Forms
Shafaf frmObj, HScroll1.Value
Next
End Sub

Ninja-Assassin
شنبه 16 شهریور 1392, 14:24 عصر
واییییییییی ممنون دوستان خیلی عالی بود مرسی :X