void rButton_Click(object sender, EventArgs e) { RadioButtonEx rButton = sender as RadioButtonEx; DataGridViewEx gridview = tabControl1.SelectedTab.Controls[0] as DataGridViewEx; rButton.Text = gridview.CurrentCell.Value.ToString(); }
private void InitSymbolBar() { Char[] CharList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray(); String[] ValueList = null; if (iniFile != null) { String temp = iniFile.IniReadValue("symbolbar", "Value"); ValueList = temp.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries); } Font font = new Font("新宋体", 9f); Point StartPos = new Point(1, 3); Size Size = new Size(24, 22); int HSpacing = 8; int VSpacing = 1; int RowCount = 3; int ColumnCount = 12; int Left = StartPos.X; int Top = StartPos.Y; BarPanel.Controls.Clear(); for (int i = 0; i < RowCount; i++) { for (int j = 0; j < ColumnCount; j++) { RadioButtonEx rButton = new RadioButtonEx(); rButton.Name = (i * ColumnCount + j).ToString(); rButton.Left = Left + (Size.Width + HSpacing) * j; rButton.Top = Top + (2 * Size.Height + VSpacing) * i; rButton.Size = Size; rButton.Font = font; try { rButton.Text = ValueList[i * ColumnCount + j].ToString(); } catch { rButton.Text = " "; } rButton.Click += new EventHandler(rButton_Click); BarPanel.Controls.Add(rButton); Label label = new Label(); label.Left = rButton.Left; label.Top = rButton.Top + rButton.Height; label.AutoSize = false; label.Size = Size; label.TextAlign = ContentAlignment.MiddleCenter; label.Text = CharList[i * ColumnCount + j].ToString(); BarPanel.Controls.Add(label); } } }
private void Button_ResetSymbolBar_Click(object sender, EventArgs e) { if (iniFile != null) { Char[] ValueList = iniFile.IniReadValue("symbolbar", "Default").ToCharArray(); for (int i = 0; i < 36; i++) { RadioButtonEx rButton = BarPanel.Controls.Find(i.ToString(), false)[0] as RadioButtonEx; rButton.Text = ValueList[i].ToString(); } String symbols = new string(ValueList); iniFile.IniWriteValue("symbolbar", "Value", symbols); } }
private void Button_Ok_Click(object sender, EventArgs e) { List <string> CharList = new List <string>(); for (int i = 0; i < 36; i++) { RadioButtonEx rButton = BarPanel.Controls.Find(i.ToString(), false)[0] as RadioButtonEx; CharList.Add(rButton.Text); } String Value = string.Join("", CharList.ToArray()); iniFile.IniWriteValue("symbolbar", "Value", Value); _SymbolManager.RefreshSymbolBar(_SymbolManager.SymbolBar); Close(); }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (msg.Msg == WM_KEYDOWN || msg.Msg == WM_SYSKEYDOWN) { if (keyData >= Keys.A && keyData <= Keys.Z || keyData >= Keys.D0 && keyData <= Keys.D9) { Char[] CharList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray(); Char symbol = System.Convert.ToChar(keyData.ToString()); int Index = Array.IndexOf(CharList, symbol); Control[] controls = BarPanel.Controls.Find(Index.ToString(), false); if (controls != null && controls.Length >= 1) { RadioButtonEx rButton = controls[0] as RadioButtonEx; DataGridViewEx gridview = tabControl1.SelectedTab.Controls[0] as DataGridViewEx; rButton.Text = gridview.CurrentCell.Value.ToString(); } return(true); } } return(base.ProcessCmdKey(ref msg, keyData)); }