protected void OnRadioBtnClicked(int ctrlindex) { CCheckbox aControl; int iGroup = -1; aControl = (CCheckbox)controls[ctrlindex]; iGroup = aControl.GetGroupID(); for (int i = 0; i < controls.Count; i++) { CWindow aWindow = (CWindow)controls[i]; if (i != ctrlindex) { if (aWindow.ClassName == "CCheckbox") { CCheckbox aRadioBtn = (CCheckbox)controls[i]; if (aRadioBtn.GetGroupID() == iGroup) { aRadioBtn.SetCheck(false); } } } } }
public CPDAWindow(int x, int y, int width, int height, System.Drawing.Color wndcolor) : base("Captain's PDA", x, y, width, height, wndcolor) { CWindow thisWindow = (CWindow)this; SetSprites(); //add some static text controls.Add(new CStaticText("Static:", 10, 60, 30, 26, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true)); //add a textbox CTextBox aTxtbox = new CTextBox("", 60, 60, 185, 24, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, 30); aTxtbox.SetFocus(); controls.Add(aTxtbox); //add a checkbox controls.Add(new CCheckbox("Checkbox", 60, 100, 60, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow)); //add a radio button CCheckbox aRadioBtn = new CCheckbox("RB1", 60, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1); aRadioBtn.SetCheck(true); controls.Add(aRadioBtn); //add a radio button controls.Add(new CCheckbox("RB2", 130, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1)); //add a listbox control CDropdownListBox aListbox = new CDropdownListBox(60, 150, 185, 100, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true); aListbox.AddItem("item 1", 1); aListbox.AddItem("item 2", 2); aListbox.AddItem("item 3", 3); aListbox.AddItem("item 4", 4); aListbox.AddItem("item 5", 5); aListbox.AddItem("item 6", 6); aListbox.AddItem("item 7", 7); aListbox.AddItem("item 8", 8); controls.Add(aListbox); //add a button controls.Add(new CButton("OK", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 48, windowRectangle.Height - 75, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow)); }
public CPDAWindow(int x, int y, int width, int height, System.Drawing.Color wndcolor) : base("Captain's PDA", x, y, width, height, wndcolor) { CWindow thisWindow = (CWindow)this; SetSprites(); //add some static text controls.Add(new CStaticText("Static:", 10, 60, 30, 26, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true)); //add a textbox CTextBox aTxtbox = new CTextBox("", 60, 60, 185, 24, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, 30); aTxtbox.SetFocus(); controls.Add(aTxtbox); //add a checkbox controls.Add(new CCheckbox("Checkbox", 60, 100, 60, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow)); //add a radio button CCheckbox aRadioBtn = new CCheckbox("RB1", 60, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1); aRadioBtn.SetCheck(true); controls.Add(aRadioBtn); //add a radio button controls.Add(new CCheckbox("RB2", 130, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1)); //add a listbox control CDropdownListBox aListbox = new CDropdownListBox(60, 150, 185, 100, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true); aListbox.AddItem("item 1", 1); aListbox.AddItem("item 2", 2); aListbox.AddItem("item 3", 3); aListbox.AddItem("item 4", 4); aListbox.AddItem("item 5", 5); aListbox.AddItem("item 6", 6); aListbox.AddItem("item 7", 7); aListbox.AddItem("item 8", 8); controls.Add(aListbox); //add a button controls.Add(new CButton("OK", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 48, windowRectangle.Height - 75, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow)); }
public COptionsWindow(int x, int y, int width, int height, Color wndcolor) : base("Game Options", x, y, width, height, wndcolor) { CWindow thisWindow = (CWindow)this; SetSprites(); //add static text for screen res controls.Add(new CStaticText("Screen Resolution:", 10, 60, 150, 26, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, false)); //add two radio buttons for screen res controls.Add(new CCheckbox("800 x 600", 30, 90, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1)); CCheckbox resRadioBtn2 = new CCheckbox("1024 x 768", 130, 90, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1); resRadioBtn2.SetCheck(true); controls.Add(resRadioBtn2); //add New Game button //add Load Game button controls.Add(new CButton("OK", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 100, windowRectangle.Bottom - windowRectangle.Top - 40, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow)); controls.Add(new CButton("Cancel", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left + 4, windowRectangle.Bottom - windowRectangle.Top - 40, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow)); }
public COptionsWindow(int x, int y, int width, int height, Color wndcolor) : base("Game Options", x, y, width, height, wndcolor) { CWindow thisWindow = (CWindow)this; SetSprites(); //add static text for screen res controls.Add(new CStaticText("Screen Resolution:", 10, 60, 150, 26, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, false)); //add two radio buttons for screen res controls.Add(new CCheckbox("800 x 600", 30, 90, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1)); CCheckbox resRadioBtn2 = new CCheckbox("1024 x 768", 130, 90, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1); resRadioBtn2.SetCheck(true); controls.Add(resRadioBtn2); //add New Game button //add Load Game button controls.Add(new CButton("OK", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 100, windowRectangle.Bottom - windowRectangle.Top - 40, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow)); controls.Add(new CButton("Cancel", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left + 4, windowRectangle.Bottom - windowRectangle.Top - 40, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow)); }