vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Erstellen von dynamischen Kontextmen?s - wann immer Sie sie brauchen!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB & Windows API
Re: Transparente Form, Controls aber sichtbar? 
Autor: GuidoE
Datum: 27.01.04 05:40

Hallo CyberDreams

Probier mal dies:

Option Explicit
 
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 Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal _
hRgn As Long, ByVal bRedraw As Long) As Long
 
Public Sub GlassifyForm(frm As Form)
Const RGN_DIFF = 4
Const RGN_OR = 2
 
Dim outer_rgn As Long
Dim inner_rgn As Long
Dim wid As Single
Dim hgt As Single
Dim border_width As Single
Dim title_height As Single
Dim ctl_left As Single
Dim ctl_top As Single
Dim ctl_right As Single
Dim ctl_bottom As Single
Dim control_rgn As Long
Dim combined_rgn As Long
Dim ctl As Control
 
    If WindowState = vbMinimized Then Exit Sub
 
    ' Create the main form region.
    wid = ScaleX(Width, vbTwips, vbPixels)
    hgt = ScaleY(Height, vbTwips, vbPixels)
    outer_rgn = CreateRectRgn(0, 0, wid, hgt)
 
    border_width = (wid - ScaleWidth) / 2
    title_height = hgt - border_width - ScaleHeight
    inner_rgn = CreateRectRgn( _
        border_width, _
        title_height, _
        wid - border_width, _
        hgt - border_width)
 
    ' Subtract the inner region from the outer.
    combined_rgn = CreateRectRgn(0, 0, 0, 0)
    CombineRgn combined_rgn, outer_rgn, _
        inner_rgn, RGN_DIFF
 
    ' Create the control regions.
    For Each ctl In Controls
        If ctl.Container Is frm Then
            ctl_left = ScaleX(ctl.Left, frm.ScaleMode, vbPixels) _
                + border_width
            ctl_top = ScaleX(ctl.Top, frm.ScaleMode, vbPixels) _
                + title_height
            ctl_right = ScaleX(ctl.Width, frm.ScaleMode, vbPixels) _
                + ctl_left
            ctl_bottom = ScaleX(ctl.Height, frm.ScaleMode, vbPixels) _
                + ctl_top
            control_rgn = CreateRectRgn( _
                ctl_left, ctl_top, _
                ctl_right, ctl_bottom)
            CombineRgn combined_rgn, combined_rgn, _
                control_rgn, RGN_OR
        End If
    Next ctl
 
    ' Restrict the window to the region.
    SetWindowRgn hWnd, combined_rgn, True
End Sub
 
Private Sub Form_Resize()
    GlassifyForm Me
End Sub
Vergiss nicht, Steuerelemente auf die Form zu setzen *grins

Gruss, Guido.
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Transparente Form, Controls aber sichtbar?1.840CyberDreams04.01.04 18:45
Re: Transparente Form, Controls aber sichtbar?1.203ModeratorMartoeng04.01.04 18:49
Re: Transparente Form, Controls aber sichtbar?1.119CyberDreams04.01.04 19:00
Re: Transparente Form, Controls aber sichtbar?1.183ModeratorMartoeng04.01.04 19:12
Re: Transparente Form, Controls aber sichtbar?1.059GuidoE27.01.04 05:40
Re: Transparente Form, Controls aber sichtbar?1.104CyberDreams28.01.04 10:15
Re: Transparente Form, Controls aber sichtbar?1.065GuidoE28.01.04 20:24
Re: Transparente Form, Controls aber sichtbar?991GuidoE03.02.04 03:29
Re: Transparente Form, Controls aber sichtbar?1.076CyberDreams03.02.04 08:22
Re: Transparente Form, Controls aber sichtbar?1.098Davey1234(5)03.02.04 12:36
Re: Transparente Form, Controls aber sichtbar?1.086GuidoE03.02.04 19:57
Re: Transparente Form, Controls aber sichtbar?944E706.02.04 18:37

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel