?
Solved

Help With Code Please

Posted on 2006-11-06
5
Medium Priority
?
272 Views
Last Modified: 2010-04-16
Hi,
I  am using the following code to produce a ring on the screen however I would like to change the color of the in four parts

based on 360'   0'-90' Green, 90'-180, yellow 180'-315' red, 315'-0' blue

     private void button1_Click(object sender, System.EventArgs e)
     {
          this.TransparencyKey = Color.WhiteSmoke;
          this.BackColor = Color.WhiteSmoke;
          this.Refresh();
          Graphics g = this.CreateGraphics();
          g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
          g.DrawEllipse(new Pen(Brushes.Yellow, 6f), 5, 5, 700, 700);
     }
0
Comment
Question by:schenkp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 16

Expert Comment

by:muzzy2003
ID: 17880347
Try the FillPie method with a new SolidBrush to fill it. Will post code in a minute.
0
 
LVL 16

Expert Comment

by:muzzy2003
ID: 17880362
g.FillPie(new SolidBrush(Color.Green), 5, 5, 700, 700, 0, 90);
g.FillPie(new SolidBrush(Color.Yellow), 5, 5, 700, 700, 90, 180);
g.FillPie(new SolidBrush(Color.Red), 5, 5, 700, 700, 180, 315); // did you mean 270?
g.FillPie(new SolidBrush(Color.Green), 5, 5, 700, 700, 315, 360);

Then draw the white circle to bound it all.
0
 

Author Comment

by:schenkp
ID: 17880610
I still want to keep the original desing of the code which is the circle, and just repaint the circle with the colors list above....

you the end result would be a colored ring wiht the colors listed above.
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 1600 total points
ID: 17880789
g.DrawArc(new Pen(Brushes.Yellow, 6f),5,5,700,700,0,90);
 g.DrawArc(new Pen(Brushes.Red, 6f),5,5,700,700,90,90);
g.DrawArc(new Pen(Brushes.Violet, 6f),5,5,700,700,180,90);
g.DrawArc(new Pen(Brushes.Gold, 6f),5,5,700,700,270,90);
0
 
LVL 16

Assisted Solution

by:muzzy2003
muzzy2003 earned 400 total points
ID: 17880827
Sorry, misinterpreted your question. gauthampj's code should do it.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question