Rubrik: Oberfläche · Effekte | VB-Versionen: VB4, VB5, VB6 | 29.01.01 |
Dicker Rahmen um Fenster Anzeigen eines dicken Rahmens um eine Form, so wie bei einer MDI-Form... | ||
Autor: Wolfgang Kluge | Bewertung: | Views: 17.476 |
www.vbwelt.de | System: Win9x, WinNT, Win2k, WinXP, Win7, Win8, Win10, Win11 | Beispielprojekt auf CD |
Viel Spielmöglichkeiten beim Design von Formen hat man ja nicht. Es gibt Leute, die wollen z.B. einen dicken Rahmen um eine Form gezeichnet haben, so wie in einer MDI-Form - aber eine MDI-Form wollen sie nicht. Was würde da einfacher sein, als ein API-Aufruf?
Genau, nichts. Deswegen wirds auch so gemacht.
' zunächst die benötigten Deklarationen 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 GetWindowLong Lib "user32" _ Alias "GetWindowLongA" ( _ ByVal hwnd As Long, _ ByVal nIndex As Long) As Long Private Const GWL_EXSTYLE = (-20) Private Declare Function SetWindowPos Lib "user32" ( _ ByVal hwnd As Long, _ ByVal hWndInsertAfter As Long, _ ByVal x As Long, _ ByVal y As Long, _ ByVal cx As Long, _ ByVal cy As Long, _ ByVal wFlags As Long) As Long ' Rahmen um Form Public Sub SetFormBorder(hWnd As Long) Dim fx As Long fx = GetWindowLong(hWnd, GWL_EXSTYLE) SetWindowLong hWnd, GWL_EXSTYLE, fx& Or &H200 SetWindowPos hWnd, 0&, 0&, 0&, 0&, 0&, &H23 End Sub
Aufruf:
Private Sub Form_Load() SetFormBorder Me.hWnd End Sub