Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
GeneralRe: C sharp file creation at specified time. Pin
BillWoodruff17-Oct-14 6:25
professionalBillWoodruff17-Oct-14 6:25 
GeneralRe: C sharp file creation at specified time. Pin
kanswal7717-Oct-14 6:34
kanswal7717-Oct-14 6:34 
GeneralRe: C sharp file creation at specified time. Pin
BillWoodruff17-Oct-14 7:47
professionalBillWoodruff17-Oct-14 7:47 
GeneralRe: C sharp file creation at specified time. Pin
kanswal7718-Oct-14 17:24
kanswal7718-Oct-14 17:24 
GeneralRe: C sharp file creation at specified time. Pin
Nicholas Marty17-Oct-14 4:32
professionalNicholas Marty17-Oct-14 4:32 
GeneralRe: C sharp file creation at specified time. Pin
kanswal7718-Oct-14 17:38
kanswal7718-Oct-14 17:38 
GeneralRe: C sharp file creation at specified time. Pin
Dave Kreskowiak17-Oct-14 4:35
mveDave Kreskowiak17-Oct-14 4:35 
Question[c#]Place objects in tablelayoutpanel cells in specific order Pin
Member 1116046716-Oct-14 22:32
Member 1116046716-Oct-14 22:32 
Im currently stuck on a part of my assignment that i can't seem to figure out. It involves me setting up a game board, using a tablelayoutpanel as the gameboard.

So far, I have displayed the tile "Squares" on the board, but the tiles (cells) are not in order as so:

http://i.stack.imgur.com/vHYz7.png [1]

I need the start tile to be displayed in the bottom left, and the finish to be in the top right, with the cells in the middle in order as so:

http://i.stack.imgur.com/dcdy8.png [2]

The methods which pertain to this part are these:

C#
/////This method sets up the game board using and array of "Squares", (still a work in progress, but mostly done)

private void SetupGameBoard() {

                    for (int i = 0; i <= 41; i++) {

            SquareControl squareCreate = new SquareControl(Board.Squares[i], null);

            int coloumn = 0;
            int row = 0;

            MapSquareNumToScreenRowAndColumn(i, out coloumn, out row);

            boardTableLayoutPanel.Controls.Add(squareCreate, coloumn, row);

        }


    }// SetupGameBaord


And this,

C#
private static void MapSquareNumToScreenRowAndColumn(int squareNumber, out int rowNumber, out int columnNumber) {



           // ######################## Add more code to this method and replace the next two lines by something more sensible.  ###############################
           rowNumber = 0;      // Use 0 to make the compiler happy for now.
           columnNumber = 0;   // Use 0 to make the compiler happy for now.



       }//end MapSquareNumToScreenRowAndColumn


What I've grasped so far is that in MapSquareToScreenRowandcColumn is where my calculation of figuring out where the squares fall into place needs to happen.

Would really love some tips/advice/help/anything on this.

If you guys need more info, let me know.

Thanks!

EDIT:

So I've figured out sort of how to do, just wondering about a better way to do it. In MapSqauretoScreenRowandColumn I put this little if statement just to test:

<pre lang="c#">
if (squareNumber >= 0 && squareNumber <= 5) {

rowNumber = 6;


}

So if the sqaurenumber is more than 0 and less than 5, its placed in the right row. My question is, is there a better way to do this for the rest? instead of writing a bunch of lines for this, is there are way to do it in a few?

EDIT2: Also, just a note, the top left of the board is (0,0) and the bottom right is (6,5)
AnswerRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Richard MacCutchan17-Oct-14 0:01
mveRichard MacCutchan17-Oct-14 0:01 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Member 1116046717-Oct-14 0:15
Member 1116046717-Oct-14 0:15 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Richard MacCutchan17-Oct-14 2:12
mveRichard MacCutchan17-Oct-14 2:12 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Member 1116046717-Oct-14 17:32
Member 1116046717-Oct-14 17:32 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Richard MacCutchan17-Oct-14 21:10
mveRichard MacCutchan17-Oct-14 21:10 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Member 1116046717-Oct-14 22:27
Member 1116046717-Oct-14 22:27 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Richard MacCutchan18-Oct-14 4:02
mveRichard MacCutchan18-Oct-14 4:02 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
BillWoodruff17-Oct-14 21:39
professionalBillWoodruff17-Oct-14 21:39 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
BillWoodruff17-Oct-14 0:38
professionalBillWoodruff17-Oct-14 0:38 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Richard MacCutchan17-Oct-14 2:15
mveRichard MacCutchan17-Oct-14 2:15 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
BillWoodruff17-Oct-14 2:45
professionalBillWoodruff17-Oct-14 2:45 
GeneralRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
Richard MacCutchan17-Oct-14 2:56
mveRichard MacCutchan17-Oct-14 2:56 
AnswerRe: [c#]Place objects in tablelayoutpanel cells in specific order Pin
BillWoodruff17-Oct-14 0:25
professionalBillWoodruff17-Oct-14 0:25 
QuestionPlay/Pause/Stop media through ASIO driver using C# Pin
Praveen Raghuvanshi16-Oct-14 18:16
professionalPraveen Raghuvanshi16-Oct-14 18:16 
AnswerRe: Play/Pause/Stop media through ASIO driver using C# Pin
Brisingr Aerowing17-Oct-14 10:08
professionalBrisingr Aerowing17-Oct-14 10:08 
GeneralRe: Play/Pause/Stop media through ASIO driver using C# Pin
Praveen Raghuvanshi26-Oct-14 7:37
professionalPraveen Raghuvanshi26-Oct-14 7:37 
Questionanother Func-enstein weirdness : and yet another bad example of MS documentation PinPopular
BillWoodruff16-Oct-14 11:38
professionalBillWoodruff16-Oct-14 11:38 

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.