/// <方法重写当鼠标移到控件时获取——ID> private void MouseEnter_reform(object send, EventArgs e) { SkinTextBox button = (SkinTextBox)send; //获取控件信息 this.SkinTextBox_ID = button.Parent.ToString(); //写入信息 this.menuStrip_Reform.SkinContextMenuStrip_Button_ID = button.Name + button.Parent.ToString(); //写入信息 this.menuStrip_Reform.all_purpose = send; //获取事件触发的控件 }
public static bool testIsEmpty(SkinTextBox txt, string msg) { if (txt.Text.Trim() == "") { show_err_msg(msg); txt.Focus(); return(true); } return(false); }
/// <summary> /// 绑定参数列表 /// </summary> private void BindPara() { // 清空所有控件 flp_Para.Controls.Clear(); string name = GetMethodNoteSel(selMethod); int y = 5; // 循环方法所需的所有参数 foreach (var item in selMethod.GetParameters()) { int x = 0; // 加载参数 SkinLabel paraName = new SkinLabel { Location = new Point(x, y + 2), TextAlign = ContentAlignment.MiddleRight, Size = new Size(80, 20), Text = item.Name + ":" }; paraName.MouseMove += Form_MouseDown; x += paraName.Size.Width + 5; // 加载文本框 SkinTextBox text = new SkinTextBox { Name = item.Name, Size = new Size(150, 20), Location = new Point(x, y), WaterText = GetNote(name, item.Name) }; x += text.Size.Width + 5; // 加载参数类型 SkinLabel paraType = new SkinLabel { Location = new Point(x, y + 2), TextAlign = ContentAlignment.MiddleLeft, Size = new Size(70, 20), Text = item.ParameterType.Name }; paraType.MouseMove += Form_MouseDown; y += 27; flp_Para.Controls.Add(paraName); flp_Para.Controls.Add(text); flp_Para.Controls.Add(paraType); } }
private void MultiCell_Click(object sender, RibbonControlEventArgs e) { Excel.Range rang; rang = Globals.ThisAddIn.Application.Selection; if (rang.Count == 0) { return; } int columns = rang.Columns.Count + 1; int rows = rang.Rows.Count + 1; StringBuilder builder = new StringBuilder(); for (int i = 1; i < columns; i++) { for (int k = 1; k < rows; k++) { Excel.Range cell = rang.Item[i][k]; cell.Value2 = "'" + cell; if (cell.Value2 == null) { continue; } string cellValue = ((string)cell.Value2).ToString(); builder.Append(cellValue).Append(","); } } string cellsData = builder.ToString().TrimEnd(','); if (!cellsData.Contains(",")) { cellsData = "'" + cellsData.Trim() + "'"; } else { cellsData = cellsData.Replace(",", "','"); cellsData = "'" + cellsData.Trim() + "'"; } Form f = new Form(); f.Width = f.Height = 300; f.Opacity = 0.9; f.StartPosition = FormStartPosition.CenterParent; SkinTextBox box = new SkinTextBox(); box.Text = cellsData; box.ReadOnly = true; f.Controls.Add(box); f.ShowDialog(); }
private void ShowConnectingMessage(string msg, Boolean isError = false, SkinTextBox skinText = null) { if (this.InvokeRequired) { this.BeginInvoke(new CbGeneric <string, Boolean, SkinTextBox>(this.ShowConnectingMessage), msg, isError, skinText); } else { skinLabelLinkState.Text = msg; skinLabelLinkState.ForeColor = isError ? Color.Red : Color.Black; if (skinText != null) { skinText.Focus(); } } }
/// <summary> /// 仅仅适用于服务器路径选取 /// </summary> /// <param name="stbText"></param> /// <returns></returns> private string realPath(SkinTextBox stbText) { string realstr = "\\"; string str = stbText.Text.ToString(); string[] mystr = str.Split('\\'); foreach (string i in mystr) { if (i != "") { if (i != mystr[mystr.Length - 1]) { realstr = realstr + i + "\\"; } else { realstr = realstr + i; } } } return(realstr); }