Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1464to1468
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Dynamische Userform nur nicht überall?

Dynamische Userform nur nicht überall?
07.01.2016 10:09:02
Louis
Hallo,
ich habe eine fertige UserForm die sich dynamisch an meine Monitorgröße 17' und 27 ' automatisch anpasst was auch sehr gut funktioniert. Wenn ich jedoch die Userform auf meinem Laptop Starte ist die Userform zu breit so das man einen Teil nicht mehr sieht.Was auch nicht funktioniert ist das wenn man gleichzeitig auf zwei bildschirmen ist das er es quasi als einen erkennt und die userform praktisch in der mitte landet...
Ich schicke mal meinen Code vllt sieht ja jmd woran das liegt :
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 SetFocus Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const GWL_STYLE As Long = -16
Private Const GWL_EXSTYLE As Long = -20
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const WS_POPUP As Long = &H80000000
Private Const WS_VISIBLE As Long = &H10000000
Private Const WS_EX_DLGMODALFRAME As Long = &H1
Private Const WS_EX_APPWINDOW As Long = &H40000
Private Const SW_SHOW As Long = 5
Dim g_hForm As Long
Dim maxi As Boolean
Dim maxiT As Boolean
Dim OldWidth As Single, OldHeight As Single, OldTop As Single, OldLeft As Single
Private Declare Function MapVirtualKey Lib "user32.dll" Alias "MapVirtualKeyA" ( _
ByVal wCode As Long, _
ByVal wMapType As Long) As Long
Private Declare Sub keybd_event Lib "user32.dll" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_MENU = &H12
Private Const lngMargin = 1 'Breite der Seitenränder in cm
Private Sub UserForm_Activate()
Dim lngCurrentStyle As Long, lngNewStyle As Long
If Val(Application.Version) 

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Dynamische Userform nur nicht überall?
07.01.2016 10:26:33
Louis
Private Sub UserForm_Initialize()
'ComboBox mit Werten füllen
cboInfoBereich.AddItem "Finance"
cboInfoBereich.AddItem "Production"
cboInfoBereich.AddItem "Sales"
Dim Style As Long
g_hForm = FindWindow(vbNullString, Me.Caption)
SetWindowLong g_hForm, -16, &H20000 Or &H10000 Or &H84C80080
Style = GetWindowLong(g_hForm, -16) And Not &HC00000
SetWindowLong g_hForm, -16, Style
DrawMenuBar g_hForm
If maxiT Then
Me.Move OldLeft, OldTop, OldWidth, OldHeight
maxiT = False
' Schließe.Left = Me.Width - 50
'Label111.Left = Me.Width - 70
Else
OldWidth = frmKlassifizierung.Width
OldHeight = frmKlassifizierung.Height
OldTop = frmKlassifizierung.Top
OldLeft = frmKlassifizierung.Left
Me.Move 0, 0, GetSystemMetrics(0) * 0.75, (GetSystemMetrics(1) - 30) * 0.75
maxiT = True
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige