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
EventArg conversion into PaintEventArg
Jul 14 2012 11:20 AM
Greetings,
I have a college project which concerns C# and GDI/GDI+. The idea of the project is a very simple, primitive Paint program using GDI. It's due for September and I started now out of sheer boredom.
The task is to make a program that can create certain geometrical shapes (rectangles, ellipses), that can fill them with a desired color, and can draw lines using a pen (the color and width of the pen should be changeable). I have not done any work in GDI before, and after starting I have encountered my first issue, but one which I believe will follow me throughout the project.
A menu is required on the form, so I added one but cannot connect the menu strip items to certain tasks within the Form1_Paint event (due to the fact that the menustrip items have the EventArg argument and the paint method has PaintEventArg.)
I have encountered this while trying to create a method that would clear the form of all drawings.
private void ocisti(object sender, PaintEventArgs e)
{
e.Graphics.Clear(Color.White);
}
...
private void ocistiToolStripMenuItem_Click(object sender, EventArgs e)
{
ocisti(sender, e);
}
As I said, I have just started, there is almost zero functionality of the program, but I predict that I will be encountering this issue throughout the project, because I wish to put the selection of pen width/color and geometrical shapes on the menu strip.
How best to resolve this issue? And any other constructive advice?
(the errors: error CS1502: The best overloaded method match for 'Seminar_2.Form1.ocisti(System.Windows.Forms.PaintEventArgs)' has some invalid arguments
error CS1503: Argument 1: cannot convert from 'System.EventArgs' to 'System.Windows.Forms.PaintEventArgs')
Reply
Answers (
5
)
problem saving bitmap
Failed to call COM interface method