SharpAffair
SharpAffair

Reputation: 5478

Basic drawing tools for .NET application

I need a control that allows loading a picture, performing some basic drawing tasks with it (including adding text, pencil, oval, horizontal and diagonal lines), and exporting it as bitmap. Anything like that available?

Thanks

Upvotes: 1

Views: 479

Answers (3)

SharpAffair
SharpAffair

Reputation: 5478

I've made my own control based on Mouse_Down, Mouse_Up, and Mouse_Move events of PictureBox.

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1038780

Image is a good container for this task:

// Load the image from an existing file
using (var img = Image.FromFile("test.png"))
using (var g = Graphics.FromImage(img))
{
    // Scratch on it
    g.DrawLine(new Pen(Color.Red, 10), new Point(0, 0), new Point(100, 100));
    g.DrawEllipse(new Pen(Brushes.Black), 10, 10, 100, 100);
    g.DrawRectangle(new Pen(Brushes.Red), 30, 30, 40, 40);

    // Save to a new file
    img.Save("test2.png");
}

Upvotes: 1

Related Questions