TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kikx
NA
9
12.3k
Smoother drawing pen
Sep 7 2012 10:27 PM
Hello
I have a paint application made in C#/GDI+ (winform), capable of drawing shapes with changeable pen size and color. I have a method for a 'free pen' as you would normally find in MS Paint, but it is quite ugly.
The app works that firstly, a graphics object is created from a pre-defined bitmap. Then, the user draws images on to the bitmap which are then showed on the panel using the panel paint event. I am guessing that the 'ugliness' is due to the time it takes to go through all those steps. Is there another way to make this smoother? See pic and code for detail
if (crtanje)
{
debljina = float.Parse(debljina_box.Text);
Graphics gr = Graphics.FromImage(bit);
gr.SmoothingMode = SmoothingMode.HighQuality;
olovka = new Pen(boja, debljina);
gr.DrawLine(olovka, new Point(prethodnoX ?? e.X, prethodnoY ?? e.Y), new Point(e.X, e.Y));
panel1.CreateGraphics().DrawImageUnscaled(bit, new Point(0, 0));
prethodnoX = e.X;
prethodnoY = e.Y;
}
Reply
Answers (
2
)
Polygon fill not working properly
How to Use OpenGL