Da ich für mein aktuelles Projekt einen Separator gebrauche dachte ich mir ich werfe ihn mal in die Runde.
Vielleicht kann ihn ja wer gebrauchen.
Vorschau, Bild1 Bild2
LG.L
Vielleicht kann ihn ja wer gebrauchen.
VB.NET-Quellcode
- Imports System.ComponentModel
- Public Class Separator
- Inherits Windows.Forms.Control
- Private _sepcolor As Color = Color.LightGray
- Private _sepheight As Int32 = 1
- <Description("Bestimmt die Farbe des Separators"), _
- Category("Appearance")>
- Public Property SeparatorColor As Color
- Get
- Return _sepcolor
- End Get
- Set(value As Color)
- _sepcolor = value
- End Set
- End Property
- <Description("Bestimmt die Höhe des Separators"), _
- Category("Appearance")>
- Public Property SeparatorHeight As Int32
- Get
- Return _sepheight
- End Get
- Set(value As Int32)
- _sepheight = value
- If value < 1 Then
- _sepheight = 1 'Eine ordentliche Exception kommt noch.
- End If
- End Set
- End Property
- Private Sub Separator_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
- If _sepheight > 1 Then
- Dim linerec As New Rectangle(10, Me.Height \ 2 - _sepheight \ 2, Me.Width - 20, _sepheight - 1)
- e.Graphics.FillRectangle(New SolidBrush(_sepcolor), linerec)
- e.Graphics.DrawRectangle(New Pen(_sepcolor), linerec)
- Else
- e.Graphics.DrawLine(New Pen(_sepcolor), 10, Me.Height \ 2, Me.Width - 10, Me.Height \ 2)
- End If
- End Sub
- End Class
Vorschau, Bild1 Bild2
LG.L
Dieser Beitrag wurde bereits 8 mal editiert, zuletzt von „Lawliet“ () aus folgendem Grund: Bezeichnung falsch ausgeschrieben