473,503 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drawing a wheel

I need to draw a wheel. It should look about like the Wheel of Fortune wheel. I also need to be able to change the colors in each section. I know how to draw circles and lines but I have no idea how to fill each section with different colors. Can someone post a little sample code. Perhaps a circle in 2 pieces that you can change the color?
Nov 15 '05 #1
6 4029
DrawArc() and FillRegion() methods inside System.Drawing
namespace are the methods you might prabably be looking
for.... but I'm sorry I don't have any sample code with
me...

HTH
Sunil
-----Original Message-----
I need to draw a wheel. It should look about like the Wheel of Fortune wheel. I also need to be able to change
the colors in each section. I know how to draw circles
and lines but I have no idea how to fill each section with
different colors. Can someone post a little sample code.
Perhaps a circle in 2 pieces that you can change the color?.

Nov 15 '05 #2
Eric,

You will want to use the FillRegion method on the Graphics class to fill
the region of the "wheel" that you are painting. Basically, the region will
consist of the rounded part of the slice, as well as the sides. You will
want to use an instance of the GraphicsPath class to create a path that
defines the region.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eric" <an*******@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
I need to draw a wheel. It should look about like the Wheel of Fortune

wheel. I also need to be able to change the colors in each section. I know
how to draw circles and lines but I have no idea how to fill each section
with different colors. Can someone post a little sample code. Perhaps a
circle in 2 pieces that you can change the color?
Nov 15 '05 #3
I see how fillRegion() works but I don't see how to adapt it to the parts of the circle. They are pie shaped.
Nov 15 '05 #4
Eric,

You will have to define the region, using lines and arcs to declare your
"slices" of the pie. You can use the GraphicsPath class to do this, and
then get a region from that.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eric" <an*******@discussions.microsoft.com> wrote in message
news:CF**********************************@microsof t.com...
I see how fillRegion() works but I don't see how to adapt it to the parts

of the circle. They are pie shaped.
Nov 15 '05 #5
"Eric" <an*******@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
I need to draw a wheel. It should look about like the Wheel of Fortune

wheel. I also need to be able to change the colors in each section. I know
how to draw circles and lines but I have no idea how to fill each section
with different colors. Can someone post a little sample code. Perhaps a
circle in 2 pieces that you can change the color?
System.Graphics.Games.WheelOfFortune.Wheel();

(Just kidding!)
Nov 15 '05 #6
Something like this perhaps?

Random r=new Random(DateTime.Now.Millisecond);

private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs
e)

{

e.Graphics.FillEllipse(Brushes.BlanchedAlmond,0,0, this.ClientSize.Width,this
..ClientSize.Height);

for(double a=0; a<360; a+=30)

{

SolidBrush b=new SolidBrush(Color.FromArgb(r.Next(255),
r.Next(255),r.Next(255)));

e.Graphics.FillPie(b,10,10,this.ClientSize.Width-20,this.ClientSize.Height-2
0,(float)a,25);

}

}
--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Blog http://bobpowelldotnet.blogspot.com

"Eric" <an*******@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
I need to draw a wheel. It should look about like the Wheel of Fortune

wheel. I also need to be able to change the colors in each section. I know
how to draw circles and lines but I have no idea how to fill each section
with different colors. Can someone post a little sample code. Perhaps a
circle in 2 pieces that you can change the color?
Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6180
by: AccessWhiz | last post by:
I have been trying desperately for the past few days to figure out why the MouseWheel solution that I retrieved from the Lebans website won't work. The access database included with the solution...
5
3838
by: Ima Lostsoul | last post by:
Anyone have a simple way to disbale the wheel on a wheel mouse in Access Apps? I have tried the Lebans code and it does not work for my application.
3
3971
by: Devonish | last post by:
I have a form designed as a Continuous form which displays one record per line. Taking account of the header and footer and the size of the screen, I can display 30 records at a time. I can see...
1
3401
by: jv | last post by:
I have quite a few of continuous form and subform where I do allow scroll bars. I run into problems with the mouse wheel whenever the data on the form does not take up the whole page. In this...
4
2710
by: ML | last post by:
I am trying to use the mouse wheel event on a numeric input box to allow the use to scroll to inc/dec the value by 1. The issue I am having is that the delta value returned seems to be off. From...
7
2971
by: Martijn Mulder | last post by:
When the mouse is over a picture, the user can grow or shrink it by rolling the central mouse wheel. What behavior is typical when the user rolls the wheel away. Will the picture grow or shrink...
2
1276
by: avlee | last post by:
Hello Do you know any easy to use php library which could be used for drawing many types of nice looking charts ? (i know i could use gd directly, but maybe there's no need to invent wheel...
3
3018
by: killbill123 | last post by:
Hi, I want to count the mouse wheel rotations in javascript. I searched on google and only found that how to track delta -1 and +1 base on the up mouse wheel and down mouse wheel. I want how...
5
4719
by: steve | last post by:
I would like to create a panel, or other widget, on which I can draw, say, a triangle, and use the wheel on the mouse to zoom in and out on the drawing. A vector drawing. I know this can be done...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.