Please help doing c# homework
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Please help doing c# homework

  1. #1
    Join Date
    Mar 2014
    Posts
    2

    Question Please help doing c# homework

    Please can u show me the way how to make three line in different directions using c# windows form with three buttons.I made it the code but lines are in same directions.Thnx

    Code:
     using System.Collections.Generic;
     using System.ComponentModel;
     using System.Data;
     using System.Drawing;
     using System.Linq;
     using System.Text;
     using System.Windows.Forms;
    
     namespace ThreeLines
     {
     public partial class Form1 : Form
     {
     public Form1()
     {
     InitializeComponent();
     }
    
     private void button1_Click(object sender, EventArgs e)
     {
     Pen lapsi;
     lapsi = new Pen(Color.Red);
     Graphics grafika = this.CreateGraphics();
     grafika.DrawLine(lapsi, 0, 0, 100, 100);
    
     }
    
     private void button2_Click(object sender, EventArgs e)
     {
     Pen pen;
     pen = new Pen(Color.Black);
     Graphics grafika2 = this.CreateGraphics();
     grafika2.DrawLine(pen, 200, 200, 300, 300);
    
     }
    
     private void button3_Click(object sender, EventArgs e)
     {
     Pen pencil;
     pencil = new Pen(Color.Blue);
     Graphics grafika3 = this.CreateGraphics();
     grafika3.DrawLine(pencil, 400, 400, 500, 500);
    
     }
     }
     }
    Last edited by HanneSThEGreaT; March 8th, 2014 at 01:45 AM. Reason: added code tags

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,247

    Re: Please help doing c# homework

    Change the values you are using. Instead of using 0,0,100,100, try 0,0, 35, 500 and see what happens. Don't be afraid to experiment.

  3. #3
    Join Date
    Mar 2014
    Posts
    2

    Re: Please help doing c# homework

    Arjay. thank you it worked.I made it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center