Click here to Skip to main content
13,004,421 members (72,729 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I'm programming Backgammon.But I don't draw Checker and Board.

I want to make one of the below links.



How can I draw that Checker and Board in C#?
Please help me.Thank you for answer.
Posted 7-Dec-12 4:46am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:
tazugur 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.
tazugur 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();
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170627.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100