Click here to Skip to main content
15,891,762 members
Home / Discussions / C#
   

C#

 
GeneralRe: Start a function in application A triggered by application B Pin
Not Active18-Apr-08 7:31
mentorNot Active18-Apr-08 7:31 
GeneralRe: Start a function in application A triggered by application B Pin
led mike18-Apr-08 11:34
led mike18-Apr-08 11:34 
AnswerRe: Start a function in application A triggered by application B Pin
Judah Gabriel Himango18-Apr-08 8:06
sponsorJudah Gabriel Himango18-Apr-08 8:06 
GeneralRe: Start a function in application A triggered by application B Pin
Spacix One18-Apr-08 8:52
Spacix One18-Apr-08 8:52 
QuestionHow to center the Button through code in the form? Pin
pdoy070818-Apr-08 5:42
pdoy070818-Apr-08 5:42 
AnswerRe: How to center the Button through code in the form? Pin
Charith Jayasundara18-Apr-08 6:16
Charith Jayasundara18-Apr-08 6:16 
GeneralRe: How to center the Button through code in the form? Pin
Charith Jayasundara18-Apr-08 6:19
Charith Jayasundara18-Apr-08 6:19 
AnswerRe: How to center the Button through code in the form? Pin
Rob Smiley18-Apr-08 6:16
Rob Smiley18-Apr-08 6:16 
Try adding a panel to your form and adding the landmine controls into that panel. Then all you have to do is centre the panel controls. e.g.

<br />
        private void generateButton_Click(object sender, EventArgs e)<br />
        {<br />
            int row = int.Parse(rowsBox.Text);<br />
            int col = int.Parse(colBox.Text);<br />
<br />
            Button[,] landmine = new Button[row, col];<br />
            for (int _row = 0; _row < row; _row++)<br />
            {<br />
                for (int _col = 0; _col < col; _col++)<br />
                {<br />
                    landmine[_row, _col] = new Button();<br />
                    landmine[_row, _col].Width = 35;<br />
                    landmine[_row, _col].Height = 35;<br />
                    landmine[_row, _col].Left =  _col * 35;<br />
                    landmine[_row, _col].Top =  _row * 35;<br />
                    landmine[_row, _col].BackColor = Color.LightGray;<br />
                    panel1.Controls.Add(landmine[_row, _col]);<br />
                }//end of for loop for columns...<br />
            }//end of for loop for row...<br />
<br />
            panel1.Size = new Size(row * 35, col * 35);<br />
            Size parentSize = panel1.Parent.ClientSize;<br />
            panel1.Location = new Point((int)(parentSize.Width / 2 - panel1.Size.Width / 2), (int)(parentSize.Height / 2 - panel1.Size.Height / 2));<br />
        } <br />


You could also set the Anchor property on the panel to None to keep the controls centred while the form resizes.

"An eye for an eye only ends up making the whole world blind"

GeneralRe: How to center the Button through code in the form? Pin
pdoy070818-Apr-08 6:28
pdoy070818-Apr-08 6:28 
GeneralCrystal Reports Pin
Wikus.Olivier18-Apr-08 5:11
Wikus.Olivier18-Apr-08 5:11 
QuestionLooping Though A DataGridView? Pin
Harvey Saayman18-Apr-08 4:48
Harvey Saayman18-Apr-08 4:48 
AnswerRe: Looping Though A DataGridView? Pin
Justin Perez18-Apr-08 5:05
Justin Perez18-Apr-08 5:05 
GeneralRe: Looping Though A DataGridView? Pin
Harvey Saayman21-Apr-08 0:03
Harvey Saayman21-Apr-08 0:03 
AnswerRe: Looping Though A DataGridView? Pin
Charith Jayasundara18-Apr-08 7:00
Charith Jayasundara18-Apr-08 7:00 
GeneralCombox in datagridview causes exception Pin
AndrusM18-Apr-08 4:31
AndrusM18-Apr-08 4:31 
GeneralRe: Combox in datagridview causes exception Pin
Justin Perez18-Apr-08 5:07
Justin Perez18-Apr-08 5:07 
GeneralRe: Combox in datagridview causes exception Pin
AndrusM18-Apr-08 5:18
AndrusM18-Apr-08 5:18 
Questionsql server issue Pin
varun.g18-Apr-08 4:26
varun.g18-Apr-08 4:26 
GeneralRe: sql server issue Pin
Charith Jayasundara18-Apr-08 7:05
Charith Jayasundara18-Apr-08 7:05 
Generalappending xml document in C# Pin
mayuri12318-Apr-08 3:37
mayuri12318-Apr-08 3:37 
GeneralRe: appending xml document in C# Pin
led mike18-Apr-08 4:40
led mike18-Apr-08 4:40 
JokeRe: appending xml document in C# Pin
Not Active18-Apr-08 7:33
mentorNot Active18-Apr-08 7:33 
GeneralString.replace("\","\\") never work Pin
cocoonwls18-Apr-08 3:06
cocoonwls18-Apr-08 3:06 
GeneralRe: String.replace("\","\\") never work Pin
Paddy Boyd18-Apr-08 3:08
Paddy Boyd18-Apr-08 3:08 
GeneralRe: String.replace("\","\\") never work Pin
phannon8618-Apr-08 3:19
professionalphannon8618-Apr-08 3:19 

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.