Hallo,
ich habe mir ein selbstgezeichnetes Control zurecht gezimmert. Wenn ich Backstyle auf Transparent setze, wird nichts mehr angezeigt. Dies hier sind meine zeichenroutinen. Vielen Dank schon mal im Vorraus
Private Sub ReDrawAll()
UserControl.Cls
RoundRect UserControl.hdc, 0, 0, UserControl.ScaleWidth, _
UserControl.ScaleHeight, 5, 5
For i = 1 To m_Buttons
DrawButton CInt(i), x_Buttons(i).State
Next
End Sub
Private Sub DrawButton(Button As Integer, State As ButtonState)
Dim rc As RECT
With x_Buttons(Button)
SetRect rc, .X1, .Y1, .X1 + m_ButtonWidth, .Y1 + m_ButtonHeight
UserControl.ForeColor = &H733900
RoundRect UserControl.hdc, .X1, .Y1, .X2, .Y2, 3, 3
If State = ButtonState.pressed Then
hBrush = CreateSolidBrush(&HD7E0E0)
hOldBrush = SelectObject(UserControl.hdc, hBrush)
Else
hBrush = CreateSolidBrush(&HEFF7F7)
hOldBrush = SelectObject(UserControl.hdc, hBrush)
End If
RetVal = ExtFloodFill(UserControl.hdc, .X1 + 2, .Y1 + 2, &H733900, _
FLOODFILLBORDER)
If State = ButtonState.Normal Then
UserControl.ForeColor = &HEBC6A5
RoundRect UserControl.hdc, .X1 + 1, .Y1 + 1, .X2 - 1, .Y2 - 1, 3, 3
RoundRect UserControl.hdc, .X1 + 2, .Y1 + 2, .X2 - 2, .Y2 - 2, 3, 3
UserControl.ForeColor = &HEF846B
Line (.X1 + 1, .Y2 - 2)-(.X2 - 1, .Y2 - 2)
UserControl.ForeColor = m_CaptionForeColor
UserControl.FontBold = False
Set UserControl.Font = m_CaptionFont
DrawText UserControl.hdc, .Caption, Len(.Caption), rc, DT_CENTER Or _
DT_VCENTER Or DT_SINGLELINE
End If
If State = ButtonState.MouseOver Then
UserControl.ForeColor = &H46B4E9
RoundRect UserControl.hdc, .X1 + 1, .Y1 + 1, .X2 - 1, .Y2 - 1, 3, 3
RoundRect UserControl.hdc, .X1 + 2, .Y1 + 2, .X2 - 2, .Y2 - 2, 3, 3
UserControl.ForeColor = m_CaptionForeColor
UserControl.FontBold = True
Set UserControl.Font = m_CaptionFont
DrawText UserControl.hdc, .Caption, Len(.Caption), rc, DT_CENTER Or _
DT_VCENTER Or DT_SINGLELINE
End If
If State = ButtonState.pressed Then
UserControl.ForeColor = m_CaptionForeColor
UserControl.FontBold = False
Set UserControl.Font = m_CaptionFont
DrawText UserControl.hdc, x_Buttons(Button).Caption, Len(.Caption), rc, _
DT_CENTER Or DT_VCENTER Or DT_SINGLELINE
End If
End With
UserControl.ForeColor = vbBlack
RetVal = SelectObject(UserControl.hdc, hOldBrush)
DeleteObject hBrush
End Sub |