Jump to content
  • Advertisement
Sign in to follow this  
Geodude487

no static Main problem

This topic is 3157 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to write a program in C# where I have two group boxes of Radio Buttons, and a Panel where I can "draw". What I need to do is basically write a paint type program. One set of Radio buttons changes the color and the other set changes size. I've got it wrote the way I think it needs to be but I'm getting a no static Main method. using System; using System.Drawing; using System.Windows.Forms; namespace DrawingPanel { public partial class frmDrawingPanel : Form { bool shouldPaint = false; private Color m_Color; private Size m_Size; Brush brush; int x; int y; int width; int height; public frmDrawingPanel() { InitializeComponent(); } private void frmDrawingPanel_MouseDown(object sender, MouseEventArgs e) { shouldPaint = true; } private void frmDrawingPanel_MouseUp(object sender, MouseEventArgs e) { shouldPaint = false; } private void rdbRed_CheckedChanged(object sender, EventArgs e) { m_Color = Color.Red; } private void rdbBlue_CheckedChanged(object sender, EventArgs e) { m_Color = Color.Blue; } private void rdbGreen_CheckedChanged(object sender, EventArgs e) { m_Color = Color.Green; } private void rdbBlack_CheckedChanged(object sender, EventArgs e) { m_Color = Color.Black; } private void rdbSmall_CheckedChanged(object sender, EventArgs e) { m_Size = new Size(4, 4); } private void rdbMedium_CheckedChanged(object sender, EventArgs e) { m_Size = new Size(6, 6); } private void rdbLarge_CheckedChanged(object sender, EventArgs e) { m_Size = new Size(12, 12); } private void frmDrawingPanel_MouseMove(object sender, MouseEventArgs e) { if (shouldPaint) { Graphics graphics = CreateGraphics(); graphics.FillEllipse( new SolidBrush(m_Color), e.X, e.Y, height, width); graphics.Dispose(); } } } } This is my code as of right now. If somebody can help me I'd really appreciate it. Thank you.

Share this post


Link to post
Share on other sites
Advertisement
1) Use [source] tags.
2) frmDrawingPanel? Just about every .NET naming convention ever recommends class names start with a capital.
3) All standard .NET programs must have a 'Main' method, which is where exectuion starts. Try this one on for size:

[STAThread] static void Main() {
Application.Run( new frmDrawingPanel() );
}

Share this post


Link to post
Share on other sites
It means exactly what it says. 'Main' is where the program starts running. You've told the compiler what a frmDrawingPanel is, how to create it, and what it can do (and how), but you have not told it to create one, nor what it should do (out of the things that it can).

Moving to For Beginners.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!