Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm programming Backgammon.But I don't draw Checker and Board.

I want to make one of the below links.

1.)http://postimage.org/image/igsft62qb/8d2eaf4d/[^]

2.)http://postimage.org/image/9ufzgrrbv/[^]


How can I draw that Checker and Board in C#?
Please help me.Thank you for answer.
Posted

1 solution

There are two basic ways to do this: you could use a bitmap or you could draw it manually.

The bitmap solution is probably going to produce a better looking result (as well as being easier to "skin") and annoyingly, it's probably easier to do as well.

Since this is backgammon, there are only 30 pieces, so it wouldn't be a major problem to draw your counters via a PictureBox (rather than drawing the image manually in the paint event. All you have to do then is move them by changing the Position property.

Google should be able to help you find a copyright free image of a board that you like - then just set it as the background image for your form or control.

This is the easy bit - making it a good player, now that's going to be difficult! :laugh:
 
Share this answer
 
Comments
Umut Comlekcioglu 7-Dec-12 11:47am    
I don't want use to Bitmap instead I want Draw board and all piece.
I don't want be easy to use bitmap.

If I don't make drawing , use bitmap.
OriginalGriff 7-Dec-12 12:02pm    
Then you need to handle the Paint event (for teh form of control - whichever is your playing surface).
In teh event handler, use the e.Graphics property, and then you are probably looking at using Graphics.FillPath, or FillRegion to draw the backgammon Points, and FillRectangle for the board edges and the Bar. FillElipse should handle the pieces.

You might want to look at combining the two approaches, and drawing the peices (at least) from a .PNG image (using Graphics.DrawImage) to get them looking better that just boring circles.
Umut Comlekcioglu 7-Dec-12 12:30pm    
I already use FillRegion or FillPath and so on.
But I can't reach (this link 2) board and piece.

For draw Piece I use this code;
---------------------------------------------------------------------------
Rectangle R = new Rectangle(0, 0, this.Width, this.Height);
g.SmoothingMode = SmoothingMode.HighQuality;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
GraphicsPath path = new GraphicsPath();
path.AddEllipse(R);
this.Region = new Region(path);
R.Inflate(1, 1);
g.FillEllipse(new SolidBrush(Color.FromArgb(Opacity * 255 / 100, FillColor.R, FillColor.G, FillColor.B)), R);
---------------------------------------------------------------------------
But This piece isn't resemble other(link 2) piece.
How can I draw this(link 2) piece?
Please send me code.

Thank you for interest.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900