VB icon

line drawing

Submitted on: 2/23/2016 2:01:11 PM
By: T J Betz 
Level: Intermediate
User Rating: Unrated
Compatibility: C#
Views: 2894
     line drawing function in code using wpf

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
// Name: line drawing
// Description:line drawing function in code using wpf
// By: T J Betz

XAML code//
<Window x:Class="project.MainWindow"
Title ="MAIN WINDOW" Height="350" Width="350" Background="LightYellow" Loaded="Window_Loaded" >
<Canvas Name="can" Margin="15,15,15,15" />
XAMLcs code//
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
namespace project
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public MainWindow()
private void Window_Loaded(object sender, RoutedEventArgs e)
 for (int b = 0; b <30; b++)
Line line = new Line();
line.StrokeThickness = 2;
line.Stroke = Brushes.Blue;
line.X1 = 150 +120 * Math.Cos(6.28 * b / 30);
line.Y1 = 130 +120 * Math.Sin(6.28 * b / 30);
line.X2 = 150 +40 *Math.Cos(6.28 * b / 30);
line.Y2 = 130 +40 * Math.Sin(6.28 * b / 30);

Other 1 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.