Hi,

I am trying to figure out graphics in C# and I wanted to start by drawing a line on the form. I was following msdn example. The problem is - where shall I put those code! I have tried this, but it didn't work. Can any one suggest any tutorial on this please and ca

st some light as well.

Thanks a lot in advance!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace drawing
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
            Pen mypen = new Pen(Color.Black);
            Graphics g = this.CreateGraphics();
            g.DrawLine(mypen, 0, 0, 200, 200);
            mypen.Dispose();
            g.Dispose();

            
         }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }
        


        
        
    }
}

Thanks a lot

kibr987, please remember to mark threads solved once your issue has been resolved :) that way people don't see an unsolved thread and think it still needs to be looked into.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.