Posted 07 August 2010 - 12:58 AM
տ 觿 ö next ջѭ Ѻ ѹ Ѻ Ǩ ͺ ҵ ء ҧ Դ Ҷ ʧ Ҩ ǡѺ Controls ʹŧ splitContainer ٻ ҧ Ӣ Ṻ Ҵ Ф Ѻ ͺ س Ѻ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; container store locations namespace TestSubWindow { public partial class Form1 : Form { private Button[] buttons; private int i=8; private int j=0; int test = 0; Button[] button=new Button[8]; public Form1() { InitializeComponent(); i = 8; j = 0; buttons = new Button[40]; for (int count = 0; count != 40; ++count) { buttons[count] = new Button(); buttons[count].Name = count.ToString(); container store locations ; buttons[count].FlatStyle = FlatStyle.Popup; buttons[count].Font = new Font("Microsoft Sans Serif", 9); buttons[count].Click += new System.EventHandler(clickButton); buttons[count].Tag = 1; // 1 is beverage buttons[count].Text = count.ToString(); splitContainer1.Panel1.Controls.Add(buttons[count]); } adjustButtons(); } private void adjustButtons(){ splitContainer1.Panel1.SuspendLayout(); int cx = splitContainer1.Panel1.Width / 2; int cy = splitContainer1.Panel1.Height / 4; int temp = 0; for (int row = 0; row != 2; ++row) { for (int col = 0; col != 4; ++col) { //MessageBox.Show(i.ToString()); button[temp + row] = buttons[test + row]; button[temp + row].SetBounds(cx * row, cy * col, cx, cy); test = test + 2; temp = temp + 2; if (test == i) { test = j; temp = 0; } } } if (test ==32) { forward.Enabled = false; } else { backward.Enabled = true; } if (i == 8) { backward.Enabled = false; } else { forward.Enabled = true; ; } splitContainer1.Panel1.ResumeLayout(); } private void clickButton(object sender, EventArgs e) { } private void forward_Click(object sender, EventArgs e) { for (int b = 0; b < 8; b++) { splitContainer1.Panel1.Controls.Remove(button[b]); } i = i + 8; j = j + 8; test = test + 8; adjustButtons(); container store locations } private void backward_Click(object sender, EventArgs e) { for (int b = 0; b < 8; b++) { splitContainer1.Panel1.Controls.Remove(button[b]); } i = i - 8; j = j - 8; test = test - 8; adjustButtons(); } } } Back to top
I've forgotten my password