009
01.10.2005, 19:02 Uhr
Uwe
C/C++ Master (Administrator)
|
Hallo, die ganze Sache hat mir jetzt keine Ruhe gelassen. Hab mal schnell die verstaubte VS 6.0 rausgesucht und gemerkt das die Sache doch nicht so funzt.
Neue Variante aber diesmal getestet:
Visual Basic: |
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 hDRgn As Long, ByVal hRgn1 As Long, ByVal hRgn2 As Long, ByVal nMode 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 MyTransForm(frm As Form) Const RGN_DIFF = 4 Const RGN_OR = 2
Dim o_rgn As Long Dim i_rgn As Long Dim wid As Single Dim hgt As Single Dim b_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 c_rgn As Long Dim cb_rgn As Long Dim ctl As Control
If WindowState = vbMinimized Then Exit Sub
' Region der Hauptform wid = ScaleX(Width, vbTwips, vbPixels) hgt = ScaleY(Height, vbTwips, vbPixels) o_rgn = CreateRectRgn(0, 0, wid, hgt)
b_width = (wid - ScaleWidth) / 2 title_height = hgt - b_width - ScaleHeight i_rgn = CreateRectRgn( _ b_width, _ title_height, _ wid - b_width, _ hgt - b_width)
' Innere Region von der auesseren abziehen cb_rgn = CreateRectRgn(0, 0, 0, 0) CombineRgn cb_rgn, o_rgn, _ i_rgn, RGN_DIFF
' Region für die Controls For Each ctl In Controls If ctl.Container Is frm Then ctl_left = ScaleX(ctl.Left, frm.ScaleMode, vbPixels) _ + b_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 c_rgn = CreateRectRgn( _ ctl_left, ctl_top, _ ctl_right, ctl_bottom) CombineRgn cb_rgn, cb_rgn, _ c_rgn, RGN_OR End If Next ctl SetWindowRgn hWnd, cb_rgn, True End Sub
Private Sub Form_Resize() MyTransForm Me End Sub
|
So jetz aber haben fertig... -- "Es ist schwierig, ein Programm wirklich idiotensicher zu machen, weil Idioten so genial sind."
Bis dann... Uwe Dieser Post wurde am 01.10.2005 um 19:09 Uhr von Uwe editiert. |