Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# C#4.0
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 7-Dec-12 4:46am

1 solution

Rate this: bad
good
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 | :laugh:
  Permalink  
Comments
tazugur at 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 at 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 at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 480
1 mhegazy94 460
2 Ravi Bhavnani 190
3 Kornfeld Eliyahu Peter 185
4 Shemeemsha RA 160
0 Sergey Alexandrovich Kryukov 7,135
1 OriginalGriff 6,801
2 CPallini 5,350
3 George Jonsson 3,619
4 Gihan Liyanage 2,797


Advertise | Privacy | Mobile
Web04 | 2.8.140922.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2014
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