Draw a Line in WPF by Code HD

23.06.2015
small example how to draw a line in WPF http://www.microsoft-programmierer.de/Details?d=994&a=9&f=104&l=0&t=WPF,c#:-eine-Linie-zeichnen-in-WPF WPF,c#: eine Linie zeichnen in WPF Views 0 Date 23.06.2015 WPF,c#: eine Linie zeichnen Aufgabe: Ich möchte eine Linie in einem WPF Formular zeichnen. Die Linie dient zum Prüfen der Pixelwerte. Hierzu ein kleines Code-Beispiel wie man eine Linie in WPF zeichnet. Man erstellt ein Line Objekt, stellt die x und y Werte ein und fügt dann die Linie in das Hauptgrid des WPF Formulars zu Hier der Beispiel-Code private void btnStart_Click object sender, RoutedEventArgs e Line objLine = new LineXX; objLine.Stroke = System.Windows.Media.Brushes.Black; //Umriss objLine.Fill = System.Windows.Media.Brushes.Black; //Fuellung objLine.X1 = btnStart.ActualWidth + btnStart.Margin.Left ; objLine.Y1 = btnStart.ActualHeight +btnStart.Margin.Top; objLine.X2 = Application.Current.MainWindow.ActualWidth ; objLine.Y2 = Application.Current.MainWindow.ActualHeight; MainGrid.Children.Add objLine; Das XAML Document besteht nur aus dem Grid und dem Start-Button

Похожие видео

Показать еще