📄 checkchoice.cs
字号:
using System;
using System.Collections ;
using System.Windows.Forms ;
using System.Drawing ;
//returns a panel of 0 to 3 check boxes
public class CheckChoice:MultiChoice {
private ArrayList stocks;
private Panel panel;
private ArrayList boxes;
//------
public CheckChoice(Equities stks) {
stocks = stks.getNames ();
panel = new Panel ();
boxes = new ArrayList ();
//add the check boxes to the panel
for (int i=0; i< stocks.Count; i++) {
CheckBox ck = new CheckBox ();
//position them
ck.Location = new Point (8, 16 + i * 32);
string stk = (string)stocks[i];
ck.Text =stk;
ck.Size = new Size (112, 24);
ck.TabIndex =0;
ck.TextAlign = ContentAlignment.MiddleLeft ;
boxes.Add (ck);
panel.Controls.Add (ck);
}
}
//------
//uncheck all check boxes
public void clear() {
for(int i=0; i< boxes.Count; i++) {
CheckBox ck = (CheckBox)boxes[i];
ck.Checked =false;
}
}
//------
//return list of checked items
public ArrayList getSelected() {
ArrayList sels = new ArrayList ();
for(int i=0; i< boxes.Count ; i++) {
CheckBox ck = (CheckBox)boxes[i];
if (ck.Checked ) {
sels.Add (ck.Text );
}
}
return sels;
}
//------
//return panel of checkboxes
public Panel getWindow() {
return panel;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -