2. In the design mode click on the form
3. On the properties window click on events
4. Double click the "Paint" event
and the final step:
5. Put the code below in the file that opens:
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private Bitmap DrawingArea; // Area to draw on.
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
DrawingArea = new Bitmap(
this.ClientRectangle.Width,
this.ClientRectangle.Height,
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
using (var canvas = Graphics.FromImage(DrawingArea))
{
canvas.Clear(Color.Transparent);
canvas.FillPolygon(Brushes.Black, new PointF[] { new PointF(10, 10), new PointF(0, 0), new PointF(0, 10) });
}
this.Invalidate();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(DrawingArea, 0, 0, DrawingArea.Width, DrawingArea.Height);
}
}
}
6 comments:
Hi,
I am doing something like your program. I want to draw manual signatures done by mouse, do you think the better option is painting point to point? and, in that case, is there any method to point a simple point? or otherwise is there another way to do it?
Thanks in advance.
Regards
@Quique
I can't help you. But maybe someone at http://stackoverflow.com/ can.
Thanks!
I got a solution in that web.
can you senm the link
Hi there! This article could not be written any better! Going through this article reminds me of my previous roommate! He continually kept talking about this. I most certainly will forward this article to him. Fairly certain he's going to have a great read. Thanks for sharing!
It's genuinely very complex in this busy life to listen news on Television, so I just use internet for that reason, and take the newest information.
Post a Comment