Click here to Skip to main content
16,011,482 members
Home / Discussions / C#
   

C#

 
QuestionHow to use resources? Pin
I'm a beginner8-Dec-07 19:09
I'm a beginner8-Dec-07 19:09 
AnswerRe: How to use resources? Pin
Christian Graus8-Dec-07 21:52
protectorChristian Graus8-Dec-07 21:52 
GeneralRe: How to use resources? Pin
I'm a beginner9-Dec-07 2:35
I'm a beginner9-Dec-07 2:35 
GeneralBar Code Pin
hadad8-Dec-07 13:27
hadad8-Dec-07 13:27 
GeneralRe: Bar Code Pin
Christian Graus8-Dec-07 14:17
protectorChristian Graus8-Dec-07 14:17 
GeneralRe: Bar Code Pin
Luis Alonso Ramos8-Dec-07 16:54
Luis Alonso Ramos8-Dec-07 16:54 
GeneralRe: Bar Code Pin
Luke Lovegrove8-Dec-07 19:39
Luke Lovegrove8-Dec-07 19:39 
GeneralCracker Barrel Peg Game Pin
randomo8-Dec-07 12:18
randomo8-Dec-07 12:18 
Basically I need to make a 5 x 5 triangular array which I did and it needs to simulate the cracker barrel peg game which I can't figure out, and I need to have it done by tomorrow Cry | :((

here's what I have so far:

using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace Pegs<br />
{<br />
    public partial class Form1 : Form<br />
    {<br />
        const int size = 5;<br />
        Color[,] Brd;<br />
<br />
        public Form1()<br />
        {<br />
            InitializeComponent();<br />
            Brd = new Color[size, size];<br />
        }<br />
        private void PrintBrd(Color[,] B)<br />
        {<br />
            int i, j;<br />
            Graphics Draw = CreateGraphics();<br />
            SolidBrush PB = new SolidBrush(Color.White);<br />
            Draw.Clear(Color.DarkGray);<br />
            for (i = 0; i < B.GetLength(0); i++)<br />
<br />
                for (j = 0; j < B.GetLength(1); j++)<br />
                {<br />
<br />
                    if (j <= i)<br />
                        Draw.FillEllipse(PB, 225 + 60 * j + (30 * (size - 1 - i)), 100 + 60 * i, 50, 50);<br />
                }<br />
            Draw.Dispose();<br />
        }<br />
<br />
        private void startButton_Click(object sender, EventArgs e)<br />
        {<br />
            PrintBrd(Brd);<br />
        }<br />
<br />
        private void Form1_Click(object sender, EventArgs e)<br />
        {<br />
            <br />
        }<br />
        private bool IsIn(int x, int y, ref int i, ref int j)<br />
        {<br />
            bool found = false;<br />
            for(i=0;i<Brd.GetLength(0);i++)<br />
            {<br />
                for (j = 0; j <= i; j++)<br />
                {<br />
                    if (x >= 225 + 60 * j + (30 * (size - 1 - i)) && x <= 225 + 60 * j + (30 * (size - 1 - i))+ 50 &&<br />
                        y >= 100 + 60 * i && y <= (100 + 60 * i)+50)<br />
                    {<br />
                        found = true;<br />
                        <br />
                        break;<br />
                    }<br />
<br />
                }<br />
                if (found)<br />
                    break;//if x and y are in the ball return true<br />
                }<br />
<br />
            return found;<br />
        }<br />
<br />
        private void Form1_MouseClick(object sender, MouseEventArgs e)<br />
        {<br />
            int i = 0, j = 0;<br />
            if(IsIn(e.X,e.Y, ref i,ref j))<br />
            {<br />
                <br />
            }<br />
            PrintBrd(Brd);<br />
<br />
        }<br />
    <br />
    }<br />
}


Thanks for any help
GeneralRe: Cracker Barrel Peg Game Pin
Anthony Mushrow8-Dec-07 12:35
professionalAnthony Mushrow8-Dec-07 12:35 
GeneralRe: Cracker Barrel Peg Game Pin
Christian Graus8-Dec-07 12:41
protectorChristian Graus8-Dec-07 12:41 
GeneralRe: Cracker Barrel Peg Game Pin
randomo9-Dec-07 10:44
randomo9-Dec-07 10:44 
QuestionReferences for solution?? Pin
daavena8-Dec-07 9:56
daavena8-Dec-07 9:56 
AnswerRe: References for solution?? Pin
pmarfleet8-Dec-07 10:07
pmarfleet8-Dec-07 10:07 
GeneralRe: References for solution?? Pin
daavena8-Dec-07 10:12
daavena8-Dec-07 10:12 
GeneralRe: References for solution?? Pin
pmarfleet8-Dec-07 10:28
pmarfleet8-Dec-07 10:28 
GeneralRe: References for solution?? Pin
daavena8-Dec-07 10:35
daavena8-Dec-07 10:35 
Generalserver for multi-person video chat and live broadcasting Pin
eroy4u8-Dec-07 9:35
eroy4u8-Dec-07 9:35 
Generalupdating DataBase Problem (delete row) Pin
Ami8-Dec-07 8:48
Ami8-Dec-07 8:48 
GeneralRe: updating DataBase Problem (delete row) Pin
Giorgi Dalakishvili8-Dec-07 8:58
mentorGiorgi Dalakishvili8-Dec-07 8:58 
GeneralRe: updating DataBase Problem (delete row) Pin
Ami8-Dec-07 9:01
Ami8-Dec-07 9:01 
GeneralRe: updating DataBase Problem (delete row) Pin
Giorgi Dalakishvili8-Dec-07 9:16
mentorGiorgi Dalakishvili8-Dec-07 9:16 
GeneralUsing SQL Server Database Pin
AndyHug8-Dec-07 8:17
AndyHug8-Dec-07 8:17 
GeneralCheckBoxList Pin
anupamwb8-Dec-07 7:50
anupamwb8-Dec-07 7:50 
AnswerRe: CheckBoxList Pin
Ravi Bhavnani8-Dec-07 8:00
professionalRavi Bhavnani8-Dec-07 8:00 
GeneralRe: CheckBoxList Pin
Xmen Real 8-Dec-07 16:41
professional Xmen Real 8-Dec-07 16:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.