vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
vb@rchiv Offline-Reader - exklusiv auf der vb@rchiv CD Vol.4  
 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.NET - Ein- und Umsteiger
Re: Forms und Custom Controls, seltsames verhalten 
Autor: cgiesen
Datum: 21.08.09 11:09

Fortsetzung

    Private myBackColor As System.Drawing.Color = Color.Transparent
    Public Overrides Property BackColor() As System.Drawing.Color
        Get
            Return MyBase.BackColor
        End Get
        Set(ByVal value As System.Drawing.Color)
            MyBase.BackColor = value
            myBackColor = value
            myLabel.BackColor = myBackColor
        End Set
    End Property
 
    Public Overridable Property DataSource() As Object
        Get
            Return myComboBox.DataSource
        End Get
        Set(ByVal value As Object)
            myComboBox.DataSource = value
            myLabel.Text = ""
        End Set
    End Property
 
    Public Overridable Property ValueMember() As String
        Get
            Return myComboBox.ValueMember
        End Get
        Set(ByVal value As String)
            myComboBox.ValueMember = value
        End Set
    End Property
 
    Public Overridable Property DisplayMember() As String
        Get
            Return myComboBox.DisplayMember
        End Get
        Set(ByVal value As String)
            myComboBox.DisplayMember = value
        End Set
    End Property
 
    Public Overridable Property SelectedValue() As Object
        Get
            Return myComboBox.SelectedValue
        End Get
        Set(ByVal value As Object)
            If IsNothing(value) = False Then
                myComboBox.SelectedValue = value
                If value < 1 Then
                    myLabel.Text = myNoSelection
                Else
                    If IsNothing(myComboBox.SelectedValue) = False Then
                        myLabel.Text = myComboBox.SelectedItem( _
                          myComboBox.DisplayMember)
                    Else
                    End If
                End If
            Else
                myLabel.Text = myNoSelection
            End If
        End Set
    End Property
 
   Public ReadOnly Property Items() As ComboBox.ObjectCollection
        Get
            Return myComboBox.Items
        End Get
    End Property
 
    Private myFont As System.Drawing.Font '= New Font("Verdana", 7, _
      FontStyle.Regular)
    Public Overrides Property font() As System.Drawing.Font
        Get
            Return myFont
        End Get
        Set(ByVal value As System.Drawing.Font)
            myFont = value
            myLabel.Font = myFont
            myComboBox.Font = myFont
            MyBase.Height = myComboBox.Height - 6
            myLabel.Height = MyBase.Height
        End Set
    End Property
 
    Private Sub myLabel_TextChanged(ByVal sender As Object, ByVal e As _
      System.EventArgs) Handles myLabel.TextChanged
        setLableBackColor()
    End Sub
 
    Private Sub setLableBackColor()
        If isMandatory = True And myLabel.Text = myNoSelection Then
            myHasError = 1
        Else
            myHasError = 0
        End If
        If myHasError > 0 Then
            myLabel.BackColor = myErrorColor
        Else
            If isEditMode = True Then
                myLabel.BackColor = myEditBackColor
            Else
                myLabel.BackColor = myBackColor
            End If
        End If
    End Sub
 
    Private myNoSelection As String = "- no selection -"
    Public Property NoSelection() As String
        Get
            Return myNoSelection
        End Get
        Set(ByVal value As String)
            myNoSelection = value
            If myComboBox.SelectedValue = Nothing Then
                myLabel.Text = myNoSelection
            End If
        End Set
    End Property
End Class
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Forms und Custom Controls, seltsames verhalten1.655cgiesen19.08.09 12:51
Re: Forms und Custom Controls, seltsames verhalten1.017ModeratorFZelle20.08.09 14:31
Re: Forms und Custom Controls, seltsames verhalten975cgiesen20.08.09 17:52
Re: Forms und Custom Controls, seltsames verhalten964cgiesen20.08.09 19:30
Re: Forms und Custom Controls, seltsames verhalten1.016ModeratorDaveS20.08.09 19:42
Re: Forms und Custom Controls, seltsames verhalten1.017cgiesen20.08.09 19:49
Re: Forms und Custom Controls, seltsames verhalten982ModeratorDaveS20.08.09 19:55
Re: Forms und Custom Controls, seltsames verhalten929cgiesen20.08.09 20:04
Re: Forms und Custom Controls, seltsames verhalten997cgiesen20.08.09 20:08
Re: Forms und Custom Controls, seltsames verhalten1.018cgiesen20.08.09 23:05
Re: Forms und Custom Controls, seltsames verhalten979cgiesen21.08.09 00:32
Re: Forms und Custom Controls, seltsames verhalten964ModeratorDaveS21.08.09 09:01
Re: Forms und Custom Controls, seltsames verhalten949cgiesen21.08.09 09:53
Re: Forms und Custom Controls, seltsames verhalten1.026xtts0221.08.09 10:05
Re: Forms und Custom Controls, seltsames verhalten942cgiesen21.08.09 11:08
Re: Forms und Custom Controls, seltsames verhalten959cgiesen21.08.09 11:09
Re: Forms und Custom Controls, seltsames verhalten1.067cgiesen21.08.09 11:10
Re: Forms und Custom Controls, seltsames verhalten935cgiesen21.08.09 12:51
Re: Forms und Custom Controls, seltsames verhalten959ModeratorDaveS21.08.09 13:40
Re: Forms und Custom Controls, seltsames verhalten1.058cgiesen21.08.09 14:17
Re: Forms und Custom Controls, seltsames verhalten929ModeratorDaveS21.08.09 15:51

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