ListControlConvertEventArgs Klasa

Definicja

Udostępnia dane dla zdarzenia Format.

public ref class ListControlConvertEventArgs : System::Windows::Forms::ConvertEventArgs
public class ListControlConvertEventArgs : System.Windows.Forms.ConvertEventArgs
type ListControlConvertEventArgs = class
    inherit ConvertEventArgs
Public Class ListControlConvertEventArgs
Inherits ConvertEventArgs
Dziedziczenie
ListControlConvertEventArgs

Przykłady

Poniższy przykład kodu pokazuje użycie tego typu. W tym przykładzie program obsługi zdarzeń zgłasza wystąpienie zdarzenia Format . Ten raport pomaga dowiedzieć się, kiedy wystąpi zdarzenie i może pomóc w debugowaniu. Aby zgłosić wiele zdarzeń lub zdarzeń, które występują często, rozważ zastąpienie Show komunikatu ciągiem Console.WriteLine lub dołączeniem go do wielowierszowego TextBoxelementu .

Aby uruchomić przykładowy kod, wklej go w projekcie zawierającym wystąpienie typu dziedziczonego z ListControlelementu , takiego jak ComboBox lub ListBox. Następnie nadaj wystąpieniu ListControl1 nazwę i upewnij się, że program obsługi zdarzeń jest skojarzony ze zdarzeniem Format .

private void ListControl1_Format(Object sender, ListControlConvertEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ListItem", e.ListItem );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Value", e.Value );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "DesiredType", e.DesiredType );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Format Event" );
}
Private Sub ListControl1_Format(sender as Object, e as ListControlConvertEventArgs) _ 
     Handles ListControl1.Format

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "ListItem", e.ListItem)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Value", e.Value)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "DesiredType", e.DesiredType)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Format Event")

End Sub

Konstruktory

ListControlConvertEventArgs(Object, Type, Object)

Inicjuje ListControlConvertEventArgs nowe wystąpienie klasy z określonym obiektem, typem i elementem listy.

Właściwości

DesiredType

Pobiera typ danych żądanej wartości.

(Odziedziczone po ConvertEventArgs)
ListItem

Pobiera element źródła danych.

Value

Pobiera lub ustawia wartość .ConvertEventArgs

(Odziedziczone po ConvertEventArgs)

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy