Microsoft Office Excel ® Kod Kılavuzu

Microsoft Office Excel® Code Guide

20 Temmuz 2009 Pazartesi

Resizable UserForm [Manuel]



'UserForm1

Option Explicit
Dim A1, A2
Dim B1, B2
Dim EkranDüzenleme As New Class1
Private Sub UserForm_Initialize()

On Error Resume Next
Me.BackColor = RGB(251, 241, 241)
Me.Caption = "[PBİD ®] Resizable UserForm"
End Sub
Private Sub UserForm_Activate()

On Error Resume Next
Set EkranDüzenleme.ÇerçeveDüzenleme = Me
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

On Error Resume Next
Call Boyut
If X >= (A2 - 24) And (B2 - 24) > Y Then
Me.MousePointer = fmMousePointerSizeWE
If Button = 1 Then Me.Width = X + (A1 - A2)
Else
If (A2 - 24) > X And Y >= (B2 - 24) Then
Me.MousePointer = fmMousePointerSizeNS
If Button = 1 Then Me.Height = Y + (B1 - B2)
Else
If X >= (A2 - 24) Or Y >= (B2 - 24) Then
Me.MousePointer = fmMousePointerSizeNWSE
If Button = 1 Then Me.Width = X + (A1 - A2): Me.Height = Y + (B1 - B2)
Else
Me.MousePointer = fmMousePointerArrow
End If
End If
End If
VBA.DoEvents
Call Boyut
End Sub
Private Sub Boyut()

On Error Resume Next
A1 = Me.Width
A2 = Me.InsideWidth
B1 = Me.Height
B2 = Me.InsideHeight
End Sub

'Class1

Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
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 ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Çerçeve As Long
Private Tarz As Long
Public Property Set ÇerçeveDüzenleme(Ekran As Object)

On Error Resume Next
Çerçeve = FindWindow(vbNullString, Ekran.Caption)
Call Çerçeve1
End Property
Private Sub Çerçeve1()

On Error Resume Next
Tarz = GetWindowLong(Çerçeve, (-16))
Tarz = Tarz Or &H80000 Or &H20000 Or &H10000
SetWindowLong Çerçeve, (-16), Tarz
ShowWindow Çerçeve, 5
DrawMenuBar Çerçeve
End Sub 

Hiç yorum yok:

Blog Arşivi

Bu gadget'ta bir hata oluştu

Bu Blogda Ara

Contributor

Contributor
Mustafa ULUSARAÇ İstanbul, TÜRKİYE
free counters
T. C. Central Bank Indicative Exchange Rates
Currency Exchange Rate Widget,Currency Converter Widget
Borsa İstanbul