Files
SDL/VERAG_PROG_ALLGEMEIN/Benutzerdefinierte Steuerelemente/MyCheckBoxValue.vb
2024-10-02 08:59:41 +00:00

42 lines
1.6 KiB
VB.net

Imports System.ComponentModel
Imports System.Windows.Forms
Public Class MyCheckBoxValue
Inherits CheckBox
Property _value As String = ""
'Dim bold = False
Property _showdate As Boolean = False
Property _date As Object = Nothing
Private Sub MyCheckBoxValue_CheckedChanged(sender As Object, e As EventArgs) Handles Me.CheckedChanged
If Me.Text.Contains(", am ") Then Me.Text = Me.Text.Substring(0, Me.Text.IndexOf(", am ")) 'ersetzen des Datum-Strings
If Me.CheckState = Windows.Forms.CheckState.Checked Then
If Me._date IsNot Nothing AndAlso IsDate(Me._date) AndAlso Me._date > CDate("01.01.1990") Then
Me.Text &= ", am " & Me._date.ToShortDateString
End If
' Me.Font = New System.Drawing.Font(Me.Font.FontFamily, Me.Font.Size, Drawing.FontStyle.Bold)
Else
Me._date = Nothing
' Me.Font = New System.Drawing.Font(Me.Font.FontFamily, Me.Font.Size, If(bold, Drawing.FontStyle.Bold, Drawing.FontStyle.Regular))
End If
End Sub
Private Sub MyCheckBoxValue_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Space Then
If Me.CheckState <> Windows.Forms.CheckState.Checked Then Me._date = Now
End If
End Sub
' Private Sub MyCheckBoxValue_Layout(sender As Object, e As LayoutEventArgs) Handles Me.Layout
' bold = Me.Font.Bold
'End Sub
Private Sub MyCheckBoxValue_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown
If Me.CheckState <> Windows.Forms.CheckState.Checked Then Me._date = Now
End Sub
End Class