/// <summary> /// Manage the overlay /// </summary> public static void SetTextBoxOverlayOnKeyMinistryCombo(GiftBatchTDSAGiftDetailRow ACurrentDetailRow, bool AActiveOnly, TCmbAutoPopulated ACmbKeyMinistries, TCmbAutoPopulated ACmbMotivationDetailCode, TextBox ATxtDetailRecipientKeyMinistry, ref string AMotivationDetail, bool AInEditModeFlag, bool ABatchUnpostedFlag, bool AReadComboValue = false) { ResetMotivationDetailCodeFilter(ACmbMotivationDetailCode, ref AMotivationDetail, AActiveOnly); // Always enabled initially. Combobox may be diabled later once populated. ACmbKeyMinistries.Enabled = true; ATxtDetailRecipientKeyMinistry.Visible = true; ATxtDetailRecipientKeyMinistry.BringToFront(); ATxtDetailRecipientKeyMinistry.Parent.Refresh(); if (AReadComboValue) { ReconcileKeyMinistryFromCombo(ACurrentDetailRow, ACmbKeyMinistries, ATxtDetailRecipientKeyMinistry, AInEditModeFlag, ABatchUnpostedFlag); } else { ReconcileKeyMinistryFromTextbox(ACurrentDetailRow, ACmbKeyMinistries, ATxtDetailRecipientKeyMinistry, AInEditModeFlag, ABatchUnpostedFlag); } }
public WebNavigationBox() { InitializeComponent(); Height = 36; _goBackButton = CreateButton("Back", "appbar.arrow.left.png", OnGoBack); _goForwardButton = CreateButton("Forward", "appbar.arrow.right.png", OnGoForward); _stopButton = CreateButton("Stop", "appbar.close.png", OnStop); _refreshButton = CreateButton("Refresh", "appbar.refresh.png", OnRefresh); _homeButton = CreateButton("Home", "appbar.home.png", OnHome); _goButton = CreateButton("Go", "go.png", OnGo, DockStyle.Right); _addressTextBox = new TextBox(); _addressTextBox.Parent = this; _addressTextBox.Dock = DockStyle.Fill; _addressTextBox.BringToFront(); _addressTextBox.KeyPress += (s, e) => { if (e.KeyChar == '\xD') { e.Handled = true; OnGo(s, EventArgs.Empty); } }; CanGoBack = false; CanGoForward = false; Loading = false; }
private void CreateTextBox(LinkLabel label) { text = new TextBox(); text.Text = label.Text; text.Location = label.Location; text.Size = label.Size; text.BorderStyle = BorderStyle.FixedSingle; text.BackColor = Color.CornflowerBlue; mainPanel.Controls.Add(text); text.BringToFront(); text.KeyPress += new KeyPressEventHandler(text_KeyPress); text.Focus(); text.SelectAll(); }
private void cboxCity_SelectedIndexChanged(object sender, EventArgs e) { // if ( the user requested free form test entry if (cboxCity.SelectedIndex == 0) { // Clear the TextBox // Show it // Give it the focus. textCity.Text = string.Empty; textCity.BringToFront(); textCity.Focus(); } }
private void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { //TODO: on tracker, if control is a textbox, and Multililne is false, //only allow to resize width textBox1.BringToFront(); textBox1.Capture = false; if (this.Controls.Contains(CSharpTracker)) { this.Controls.Remove(CSharpTracker); } CSharpTracker = new RectTracker(textBox1); this.Controls.Add(CSharpTracker); CSharpTracker.BringToFront(); CSharpTracker.Draw(); }
public MissionPackagePanel() { this.Location = new Point(865, 6); this.Size = new Size(295, 652); //To change this, also change Maximum size property this.MaximumSize = new Size(295, 652); this.BackgroundImage = GV.backPanelImage; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.BackColor = Color.Transparent; this.AutoScroll = true; this.AllowDrop = false; Label packageLabel = new Label(); packageLabel.Location = new Point(this.Width / 2, 6); Label packageNameLabel = new Label(); packageNameLabel.Name = "packageNameLabel"; packageNameLabel.Text = "Package Title"; packageNameLabel.AutoSize = true; packageNameLabel.Font = GV.generalFont; packageNameLabel.Location = new Point(170, 8); this.Controls.Add(packageNameLabel); TextBox packageNameTextBox = new TextBox(); packageNameTextBox.Name = "packageNameTextBox"; packageNameTextBox.Text = ""; packageNameTextBox.Size = new Size(150, 20); packageNameTextBox.Location = new Point(13, 5); packageNameTextBox.TextChanged +=new EventHandler(packageNameTextBox_TextChanged); this.Controls.Add(packageNameTextBox); Label descriptionLabel = new Label(); descriptionLabel.Name = "descriptionNameLabel"; descriptionLabel.Text = "Pack description"; descriptionLabel.AutoSize = true; descriptionLabel.Font = GV.generalFont; descriptionLabel.Location = new Point(150, 30); this.Controls.Add(descriptionLabel); descriptionTB = new TextBox(); descriptionTB.Name = "descriptionTextBox"; descriptionTB.Text = ""; descriptionTB.Size = new Size(145, 17); descriptionTB.Location = new Point(3, 30); descriptionTB.MouseEnter +=new EventHandler(TB_MouseEnter); descriptionTB.MouseLeave +=new EventHandler(TB_MouseLeave); descriptionTB.TextChanged +=new EventHandler(TB_TextChanged); descriptionTB.BringToFront(); descriptionTB.Multiline = true; descriptionTB.WordWrap = true; descriptionTB.ScrollBars = ScrollBars.Vertical; this.Controls.Add(descriptionTB); descriptionTB.BringToFront(); Button newMissionButton = new Button(); newMissionButton.Size = new Size(135, 28); newMissionButton.Location = new Point(15, 55); newMissionButton.Text = "Add new mission"; newMissionButton.Font = GV.generalFont; newMissionButton.ForeColor = Color.White; newMissionButton.FlatStyle = FlatStyle.Popup; newMissionButton.BackColor = Color.Transparent; newMissionButton.BackgroundImage = global::MissionCreator.Properties.Resources.MissionControllerButton; newMissionButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; newMissionButton.Click +=new EventHandler(newMissionButton_Click); this.Controls.Add(newMissionButton); CheckBox ownOrderCheckBox = new CheckBox(); ownOrderCheckBox.Location = new Point(160, 60); ownOrderCheckBox.Text = "Sort in order?"; ownOrderCheckBox.CheckedChanged += new EventHandler(ownOrderCheckBox_CheckedChanged); ownOrderCheckBox.AutoSize = true; ownOrderCheckBox.Font = GV.generalFont; this.Controls.Add(ownOrderCheckBox); }
/// <summary> /// 布局自定义子控件Panel /// </summary> /// <param name="listReceMainItems"></param> /// <param name="panel"></param> private void LayoutPanelItem(string strReceMainItem, ref Panel panel, ref int tabIndex) { //创建一个Panel panel.Size = new System.Drawing.Size(10, 20); panel.AutoSize = true; //创建一个Label Label label = new Label(); panel.Controls.Add(label); label.AutoSize = true; label.Location = new Point(0, 3); string labText = Util.FormatStringRight(strReceMainItem.Trim(), 16); label.Text = labText; if (strReceMainItem == "订货类型" || strReceMainItem == "提货方式" || strReceMainItem == "销售信息") { //创建一个ComboBox ComboBox comboBox = new ComboBox(); panel.Controls.Add(comboBox); comboBox.Width = 150; comboBox.Location = new Point(label.Width + 5, 0); comboBox.Name = ReceiptModCfg.GetReceiptMainItems()[strReceMainItem].Trim(); comboBox.DropDownStyle = ComboBoxStyle.DropDownList; comboBox.TabIndex = tabIndex; List<string> itemVals = SelItemsDAO.GetItemVals("[单据]" + strReceMainItem); if (itemVals != null) comboBox.Items.AddRange(itemVals.ToArray()); comboBox.SelectedIndex = 0; //计算机Panel的宽度 panel.Width = label.Width + 5 + comboBox.Width; } else if (strReceMainItem == "仓库" || strReceMainItem == "目标仓库" || strReceMainItem == "发票类型") { //创建一个ComboBox ComboBox comboBox = new ComboBox(); panel.Controls.Add(comboBox); comboBox.Width = 150; comboBox.Location = new Point(label.Width + 5, 0); comboBox.Name = ReceiptModCfg.GetReceiptMainItems()[strReceMainItem].Trim(); comboBox.DropDownStyle = ComboBoxStyle.DropDownList; comboBox.TabIndex = tabIndex; comboBox.Name = "comboBox" + comboBox.Name; comboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged); //创建一个额外的TextBox,按规则命名,便于存储 TextBox textBoxTemp = new TextBox(); panel.Controls.Add(textBoxTemp); textBoxTemp.Visible = false;//// textBoxTemp.BringToFront(); textBoxTemp.Location = new Point(0, 0); textBoxTemp.Name = ReceiptModCfg.GetReceiptMainItems()[strReceMainItem].Trim(); if (strReceMainItem == "仓库" || strReceMainItem == "目标仓库") { (new InitFuncs()).InitComboBox(comboBox, "T_StoreHouse", "SHName"); comboBox.SelectedIndex = 1; } else if (strReceMainItem == "发票类型") { (new InitFuncs()).InitComboBox(comboBox, "T_Invoice", "ITName"); if (this.strReceTypeId == "03" && comboBox.Items.Contains("增值税票")) comboBox.SelectedItem = "增值税票"; else if (comboBox.Items.Contains("普通发票")) comboBox.SelectedItem = "普通发票"; } //计算机Panel的宽度 panel.Width = label.Width + 5 + comboBox.Width; } else if (strReceMainItem == "预计入库日" || strReceMainItem == "生效起日" || strReceMainItem == "有效止日" || strReceMainItem == "送货日期" || strReceMainItem == "收货日期" || strReceMainItem == "送货要求到达时间" || strReceMainItem == "要求安装时间" || strReceMainItem == "汇款日期" || strReceMainItem == "单据日期") { //创建一个DateTimePicker DateTimePicker dateTimePicker = new DateTimePicker(); panel.Controls.Add(dateTimePicker); dateTimePicker.Width = 150; dateTimePicker.Format = DateTimePickerFormat.Custom; dateTimePicker.CustomFormat = "yyyy-MM-dd"; dateTimePicker.Location = new Point(label.Width + 5, 0); dateTimePicker.Name = ReceiptModCfg.GetReceiptMainItems()[strReceMainItem].Trim(); dateTimePicker.TabIndex = tabIndex; //计算机Panel的宽度 panel.Width = label.Width + 5 + dateTimePicker.Width; } else { //创建一个TextBox TextBox textBox = new TextBox(); panel.Controls.Add(textBox); textBox.Width = 150; textBox.BorderStyle = BorderStyle.Fixed3D; textBox.Location = new Point(label.Width + 5, 0); textBox.Name = ReceiptModCfg.GetReceiptMainItems()[strReceMainItem].Trim(); if (strReceMainItem == "送货人" || strReceMainItem == "收货人" || strReceMainItem == "业务员" || strReceMainItem == "技术员" || strReceMainItem == "验收员" || strReceMainItem == "保管员" || strReceMainItem == "制单人" || strReceMainItem == "收款人" || strReceMainItem == "复核员") { Label label1 = new Label(); label1.Width = 20; label1.Height = 25; label1.Dock = DockStyle.Right; label1.Image = Warehouse.Properties.Resources.serch1; label1.ImageAlign = ContentAlignment.MiddleCenter;// TopLeft; label1.Name = strReceMainItem; label1.Click += new EventHandler(label_Click); textBox.Controls.Add(label1); textBox.KeyDown += new KeyEventHandler(textBox_KeyDown); textBox.Leave += new EventHandler(textBox_Leave); if (strReceMainItem == "制单人") textBox.Text = (new DBUtil()).Get_Single_val("T_Users","UserName","UserId",this.curUserId); } else if (strReceMainItem == "单据号") { textBox.ReadOnly = true; } else if (strReceMainItem == "自定义单号") { textBox.TabIndex = 1; textBox.Focus(); } else if (strReceMainItem == "当前工作年月") { textBox.Text = this.curWorkMonth; textBox.ReadOnly = true; } else if (strReceMainItem == "用户账期") { //textBox.ReadOnly = true; } else if (strReceMainItem == "发票号") { textBox.MaxLength = 50; textBox.Leave += new EventHandler(textBox_Leave); } if (textBox.ReadOnly != true) textBox.TabIndex = tabIndex; else textBox.TabStop = true; //计算Panel的宽度 panel.Width = label.Width + 5 + textBox.Width; } }
public void build(string str) { int count = 0; int startX = 50; int startY = 36; string[] strCollection = Regex.Split(str, @"\{(.*?)\}"); for (int i = 0; i < strCollection.Length; i++) { int temp = strCollection[i].IndexOf("/"); count++; Point point = createPosition(i, startX, startY); if (strCollection[i].ToString() != "") { if (temp == 0) { Label txtBox = new Label(); txtBox.Name = "txtBoxDynamic" + i.ToString(); txtBox.Text = strCollection[i].ToString(); txtBox.AutoSize = true; txtBox.Location = point; txtBox.Size = new System.Drawing.Size(50, 25); txtBox.BringToFront(); gbREST.Controls.Add(txtBox); } else { //Parameter box TextBox txtBox = new TextBox(); txtBox.Name = "txtBoxDynamic" + i.ToString(); txtBox.Text = "{" + strCollection[i].ToString() + "}"; txtBox.Font = new Font("Times New Roman", 9, FontStyle.Italic); txtBox.Location = point; txtBox.Size = new System.Drawing.Size(200, 25); txtBox.BringToFront(); gbREST.Controls.Add(txtBox); } } } }
private void grvExportList_Click(object sender, EventArgs e) { xbeFileName.Text = ""; this.xpbProcecess.Position = 0; try { int height = 0; strSPName = grvExportList.GetDataRow(grvExportList.GetSelectedRows()[0])["ProcedureName"].ToString(); //Generalte Filter Condition grbFilter.Controls.Clear(); DataTable dtParameter = GetParameter(strSPName); if ((dtParameter != null) && (dtParameter.Rows.Count <= 0)) grbFilter.Visible = false; else { cellLocation = new string[3, dtParameter.Rows.Count];// frist used for Name, second used for Location and third used for Value int index = 0; grbFilter.Visible = true; grbFilter.Height = 30; //generate filter condition foreach (DataRow dr in dtParameter.Rows) { //cut lose @LoginID if (dr[P_NAME].ToString().ToLower().Equals(CommonConst.A_LoginID.ToLower())) continue; height += 25; grbFilter.Height += 25; // set lable Label lbl = new Label(); lbl.Name = LBL_PREFIX + dr[P_NAME].ToString(); lbl.Text = dr[Message_P].ToString(); cellLocation[0, index] = lbl.Text; cellLocation[1, index] = dr[CellLocation].ToString(); cellLocation[2, index++] = dr[P_NAME].ToString(); grbFilter.Controls.Add(lbl); lbl.Location = new System.Drawing.Point(10, height); // set input control switch (dr[DataType].ToString().ToLower()) { case "dropdownlist": { if (dr[P_NAME].ToString().ToLower() == CommonConst.A_EmployeeID.ToLower()) { ShowEmployeeList(new System.Drawing.Point(130, height), dr[P_NAME].ToString()); break; } // create combobox for this once DevExpress.XtraEditors.LookUpEdit cbx = new DevExpress.XtraEditors.LookUpEdit(); cbx.Name = CBX_PREFIX + dr[P_NAME].ToString(); // set data source AddDataSource(ref cbx, DBEngine.execReturnDataTable(dr[Query].ToString(), CommonConst.A_LoginID, UserID)); // if the control is month or year list, so set theo current month and year if (cbx.Name.ToLower().Contains("month")) { dtInitValue = DBEngine.execReturnDataTable("select * from tblCurrentWorkingMonth"); cbx.EditValue = dtInitValue.Rows[0]["Month"]; } if (cbx.Name.ToLower().Contains("year")) { dtInitValue = DBEngine.execReturnDataTable("select * from tblCurrentWorkingMonth"); cbx.EditValue = dtInitValue.Rows[0]["Year"]; } if (cbx.Name.ToLower().Contains("currency")) { cbx.EditValue = "VND"; } grbFilter.Controls.Add(cbx); cbx.Location = new System.Drawing.Point(130, height); cbx.Width = 200; cbx.BringToFront(); break; } case "number": case "int": case "smallint": case "tinyint": case "money": { // Create textbox and set read number only TextBox txt = new TextBox(); txt.Name = TXT_PREFIX + dr[P_NAME].ToString(); txt.Location = new System.Drawing.Point(130, height); txt.Width = 200; txt.BringToFront(); //set read number only txt.KeyPress += new KeyPressEventHandler(txt_KeyPress); grbFilter.Controls.Add(txt); break; } case "datetime": case "smalldatetime": { // Create datetimepicker DevExpress.XtraEditors.DateEdit dtp = new DateEdit(); dtp.Name = DTP_PREFIX + dr[P_NAME].ToString(); dtp.Location = new System.Drawing.Point(130, height); dtp.Width = 200; dtp.Properties.LookAndFeel.UseDefaultLookAndFeel = false; dtp.Properties.LookAndFeel.SkinName = "Blue"; dtp.Properties.Mask.EditMask = "dd/MM/yyyy"; dtp.Properties.Mask.UseMaskAsDisplayFormat = true; grbFilter.Controls.Add(dtp); break; } default: { // Create textbox and set read number only TextBox txt = new TextBox(); txt.Name = TXT_PREFIX + dr[P_NAME].ToString(); txt.Location = new System.Drawing.Point(130, height); txt.Width = 200; txt.BringToFront(); grbFilter.Controls.Add(txt); // textbox here break; } } } } // enable export button btnExport.Enabled = true; if (txtExportType.Text.Trim().ToLower().Equals(EXPORT_TYPE)) { ShowHideControl(false); } else { strExtend = txtExcelFileName.Text.Substring(txtExcelFileName.Text.Length - 3, 3); if (strExtend.ToLower().Equals(XLS)) ShowHideControl(true); else ShowHideControl(false); } } catch (Exception ex) { HPA.Common.Helper.ShowException(ex, this.Name, "grvExportList_Click"); } }
/// <summary> /// Loads controls on the panel /// </summary> private void LoadControls() { foreach (SearchListBoxItem item in searchFieldsCollection) { //add masked textbox or textbox to the panel if (!string.IsNullOrEmpty(item.Pattern)) { //Add masked textbox to the panel MaskedTextBox fieldTextBox = new MaskedTextBox(); fieldTextBox.Location = new System.Drawing.Point(300, textLinePosition); fieldTextBox.Size = new System.Drawing.Size(286, 20); fieldTextBox.BringToFront(); fieldTextBox.Leave += new EventHandler(fieldTextBox_Leave); // fieldTextBox.MaskInputRejected += new MaskInputRejectedEventHandler(maskedTextBox_MaskInputRejected); string mask = AppData.Instance.DataPatternsDataTable.GetMaskByPattern(item.Pattern); //fieldTextBox.Mask = AppData.Instance.DataPatternsDataTable.GetExpressionByMask(mask, item.Pattern); fieldTextBox.Tag = item.Type; fieldTextBox.Name = item.Name; //fieldTextBox.Mask = mask; if (item.Type.Equals("Number") || item.Type.Equals("PhoneNumber")) { // fieldTextBox.PromptChar = '_'; } else if (item.Type.Equals("Date") || item.Type.Equals("DateTime")) { // fieldTextBox.PromptChar = '_'; fieldTextBox.Text = String.Format("{0}", string.Empty); } else if (item.Type.Equals("Time")) { // fieldTextBox.PromptChar = '_'; fieldTextBox.Text = String.Format("{0:T}", string.Empty); } splitContainer1.Panel2.Controls.Add(fieldTextBox); textLinePosition += 38; if (myControlDictionaryData.ContainsKey(item.Name.ToString())) { fieldTextBox.Text = myControlDictionaryData[item.Name.ToString()].ToString(); } myControlDictionary.Add(item.Name.ToString(), fieldTextBox); myControlItemDictionary.Add(fieldTextBox, item); fieldTextBox.Focus(); } else { //if (item.Type.Equals("YesNo")) //{ // ComboBox cbxYesNo = new ComboBox(); // Configuration config = Configuration.GetNewInstance(); // cbxYesNo.Items.AddRange(new object[] { config.Settings.RepresentationOfYes, config.Settings.RepresentationOfNo, config.Settings.RepresentationOfMissing }); // cbxYesNo.Location = new System.Drawing.Point(300, textLinePosition); // cbxYesNo.Size = new System.Drawing.Size(286, 20); // cbxYesNo.BringToFront(); // cbxYesNo.Leave += new EventHandler(fieldTextBox_Leave); // splitContainer1.Panel2.Controls.Add(cbxYesNo); // textLinePosition += 38; // myControlDictionary.Add(item.Name.ToString(), cbxYesNo); // myControlItemDictionary.Add(cbxYesNo, item); // cbxYesNo.Focus(); //} //else { ////add textbox to panel TextBox fieldTextBox = new TextBox(); fieldTextBox.Name = item.Name; fieldTextBox.Location = new System.Drawing.Point(300, textLinePosition); fieldTextBox.Size = new System.Drawing.Size(286, 20); fieldTextBox.BringToFront(); fieldTextBox.Leave += new EventHandler(fieldTextBox_Leave); splitContainer1.Panel2.Controls.Add(fieldTextBox); textLinePosition += 38; myControlDictionary.Add(item.Name.ToString(), fieldTextBox); myControlItemDictionary.Add(fieldTextBox, item); fieldTextBox.Focus(); } } //add field name label to panel Label fieldName = new Label(); fieldName.Tag = item.Name.ToString().ToUpper(); fieldName.Location = new System.Drawing.Point(26, labelLinePosition); fieldName.Size = new System.Drawing.Size(35, 13); fieldName.AutoSize = true; fieldName.FlatStyle = FlatStyle.System; fieldName.Text = item.Name.ToString(); splitContainer1.Panel2.Controls.Add(fieldName); labelLinePosition += 38; //add pattern label to panel Label lblPattern = new Label(); lblPattern.Tag = item.Name.ToString().ToUpper(); lblPattern.Location = new System.Drawing.Point(620, patternLinePosition); lblPattern.Size = new System.Drawing.Size(35, 13); lblPattern.AutoSize = true; lblPattern.FlatStyle = FlatStyle.System; splitContainer1.Panel2.Controls.Add(lblPattern); patternLinePosition += 38; if (!string.IsNullOrEmpty(item.Pattern)) { lblPattern.Text = item.Pattern.ToString(); } //myControlDictionary.Add(item.Name.ToString(), fieldTextBox); //myControlItemDictionary.Add(fieldTextBox, item); } }
private void editTextFor(ListViewItem item) { item.EnsureVisible(); txtLineEditBox = new TextBox(); int x = widthColumn(RESULT_TEXT_COLUMN_INDEX) + lvTargetTextsList.Bounds.X; int y = lvTargetTextsList.Bounds.Y + item.Bounds.Y; int width = lvTargetTextsList.Width - x; int height = item.Bounds.Height; txtLineEditBox.Bounds = new Rectangle(x, y, width, height); txtLineEditBox.Text = _beforeEditionText = itemText(item); txtLineEditBox.LostFocus += new EventHandler(editBox_LostFocus); txtLineEditBox.KeyDown += new KeyEventHandler(editBox_KeyDown); txtLineEditBox.Tag = item; lvTargetTextsList.Parent.Controls.Add(txtLineEditBox); txtLineEditBox.BringToFront(); txtLineEditBox.SelectAll(); txtLineEditBox.Focus(); _controlFocusedBeforeEdition = _lastFocusedControl; _lastFocusedControl = txtLineEditBox; }
public void makeTextBox(string codeNum, int col, int row, int timeInHour, string text) { datagridSaveCells(codeNum,col, row, timeInHour); TextBox course = new TextBox(); course.RightToLeft = RightToLeft.Yes; course.Text = text; // dataGiViScedule.CellFormatting int cellHeight = dataGiViScedule.Rows[row].Height; int cellWidth = dataGiViScedule.Columns[col].Width; Point cellLocation = dataGiViScedule.PointToScreen(dataGiViScedule.GetCellDisplayRectangle(col, row, false).Location); course.RightToLeft = RightToLeft.Yes; course.Font = new Font("David", 11); course.BackColor = Color.FromArgb(0, 204, 0); course.Multiline = true; course.Width = cellWidth; course.Height = cellHeight * timeInHour; course.Cursor = Cursors.Hand; course.ReadOnly = true; course.Location = PointToClient(new Point(cellLocation.X + cellWidth, cellLocation.Y)); this.Controls.Add(course); course.BringToFront(); course.Name = codeNum; course.Anchor = AnchorStyles.Top; course.Anchor = AnchorStyles.Right; course.MouseDown += new MouseEventHandler(course_MouseDown_Scedule); }
private void timer1_Tick_1(object sender, System.EventArgs e) { //int[] xy = new int[2]; //GetCursorPos(ref xy(0)); //int x = System.Windows.Forms.Cursor.Position.X; //Y座標を取得する //int y = System.Windows.Forms.Cursor.Position.Y; // Create a data stream object and listen to events. //Console.WriteLine(x + " " + y); //listBox1.Items.Add("Value=" + objAcc.get_accValue(child)); Accessibility.IAccessible objAcc = default(Accessibility.IAccessible); object child = null; AccessibleObjectFromPoint((int)gazeX,(int)gazeY, ref objAcc, ref child); //listBox1.Items.Clear(); // ERROR: Not supported in C#: OnErrorStatement int[] ltwh = new int[4]; //objAcc.accLocation((int)ltwh[0], ltwh[1], ltwh[2], ltwh[3], child); try { //listBox1.Items.Add("Name=" + objAcc.get_accName(child)); }catch{ } //label貼り付け try { //Console.WriteLine(objAcc.get_accName(child)); listUpdate(objAcc.get_accName(child)); if (!(preWord.Equals(objAcc.get_accName(child)))) { if (!((objAcc.get_accName(child).Equals("Form1"))||(objAcc.get_accName(child).Equals(" ")))) { preWord = objAcc.get_accName(child); sameWord = 0; } } else { if (!((objAcc.get_accName(child).Equals("Form1")) && (objAcc.get_accName(child).Equals(" ")&& (objAcc.get_accName(child).Equals(""))))) { sameWord++; if (sameWord == 16 - (allDanger)) { //ラベルの生成 List<System.Windows.Forms.TextBox> clist = new List<System.Windows.Forms.TextBox>(); System.Windows.Forms.TextBox tb = new System.Windows.Forms.TextBox(); tb.Top = (int)gazeY+21; tb.Left = (int)gazeX; tb.Height = 10; tb.Width = 70; this.Controls.Add(tb); for (int i = 0; i <= wordBox.Length; i++) { if (objAcc.get_accName(child).Equals(wordBox[i])) { //最前面へ tb.BringToFront(); clist.Add(tb); tb.Text = wordChangeBox[i]; wordBox[i] = "blank"; } } //if (tb.Text.Equals("")) return; tb.BackColor = Color.Red; //翻訳開始 //backgroundWorker1.RunWorkerAsync(objAcc.get_accName(child)); } } } } catch { } }
private void beginEditIncludeDir() { if(_editingIncludes) { endEditIncludeDir(true); } _editingIncludes = true; _dialog.unsetCancelButton(); if(_editingIndex != -1) { _txtIncludeDir = new TextBox(); _txtIncludeDir.Text = sliceIncludeList.Items[sliceIncludeList.SelectedIndex].ToString(); _editingIncludeDir = _txtIncludeDir.Text; sliceIncludeList.SelectionMode = SelectionMode.One; Rectangle rect = sliceIncludeList.GetItemRectangle(sliceIncludeList.SelectedIndex); _txtIncludeDir.Location = new Point(sliceIncludeList.Location.X + 2, sliceIncludeList.Location.Y + rect.Y); _txtIncludeDir.Width = sliceIncludeList.Width - 50; _txtIncludeDir.Parent = sliceIncludeList; _txtIncludeDir.KeyDown += new KeyEventHandler(includeDirKeyDown); _txtIncludeDir.KeyUp += new KeyEventHandler(includeDirKeyUp); groupBox1.Controls.Add(_txtIncludeDir); _btnSelectInclude = new Button(); _btnSelectInclude.Text = "..."; _btnSelectInclude.Location = new Point(sliceIncludeList.Location.X + _txtIncludeDir.Width, sliceIncludeList.Location.Y + rect.Y); _btnSelectInclude.Width = 49; _btnSelectInclude.Height = _txtIncludeDir.Height; _btnSelectInclude.Click += new EventHandler(selectIncludeClicked); groupBox1.Controls.Add(_btnSelectInclude); _txtIncludeDir.Show(); _txtIncludeDir.BringToFront(); _txtIncludeDir.Focus(); _btnSelectInclude.Show(); _btnSelectInclude.BringToFront(); } }
public resourceSubPanel(int iteration) { Point resourceNameLabelLocation = new Point(8, 11); Point numberRequiredLabelLocation = new Point(8, 37); Point resourceNameTextBoxLocation = new Point(87, 7); Point numberRequiredTextBoxLocation = new Point(109, 33); Point maxRadioButtonLocation = new Point(190, 32); Size resourceNameTextBoxSize = new Size(105, 20); Size numberRequiredTextBoxSize = new Size(23, 20); this.BackColor = Color.DarkGray; this.Size = new Size(241, 56); this.Show(); CheckBox minCheckBox = new CheckBox(); minCheckBox.Text = "Min"; minCheckBox.Font = GV.generalFont; minCheckBox.Location = new Point(75, 33); this.Controls.Add(minCheckBox); minCheckBox.AutoSize = true; minCheckBox.CheckedChanged += new EventHandler(checkBox_CheckedChanged); minCheckBox.Name = GV.minResourceRequiredName + "CheckBox"; //"minNumberRequiredCheckBox"; CheckBox maxCheckBox = new CheckBox(); maxCheckBox.Text = "Max"; maxCheckBox.Font = GV.generalFont; maxCheckBox.Location = new Point(158, 33); maxCheckBox.AutoSize = true; maxCheckBox.CheckedChanged += new EventHandler(checkBox_CheckedChanged); this.Controls.Add(maxCheckBox); maxCheckBox.Name = GV.maxResourceRequiredName + "CheckBox";//"maxNumberRequiredCheckBox"; TextBox minNumberRequiredTextBox = new TextBox(); minNumberRequiredTextBox.Size = numberRequiredTextBoxSize; minNumberRequiredTextBox.Text = "0"; minNumberRequiredTextBox.Enabled = false; minNumberRequiredTextBox.Location = new Point(125, 31); this.Controls.Add(minNumberRequiredTextBox); minNumberRequiredTextBox.BringToFront(); minNumberRequiredTextBox.TextChanged += new EventHandler(resourceTextBox_TextChanged); minNumberRequiredTextBox.Name = GV.minResourceRequiredName + "TextBox"; //"minNumberRequiredTextBox"; TextBox maxNumberRequiredTextBox = new TextBox(); maxNumberRequiredTextBox.Size = numberRequiredTextBoxSize; maxNumberRequiredTextBox.Location = new Point(213, 31); maxNumberRequiredTextBox.Text = "0"; this.Controls.Add(maxNumberRequiredTextBox); maxNumberRequiredTextBox.BringToFront(); maxNumberRequiredTextBox.Enabled = false; maxNumberRequiredTextBox.TextChanged += new EventHandler(resourceTextBox_TextChanged); maxNumberRequiredTextBox.Name = GV.maxResourceRequiredName + "TextBox"; //"maxNumberRequiredTextBox"; Label resourceNameLabel = new Label(); resourceNameLabel.Text = "Resource name:"; resourceNameLabel.Name = "resourceNameLabel"; resourceNameLabel.Font = GV.generalFont; resourceNameLabel.Location = new Point(8, 9); resourceNameLabel.AutoSize = true; this.Controls.Add(resourceNameLabel); Label numberRequiredLabel = new Label(); numberRequiredLabel.Text = " Number\nRequired"; numberRequiredLabel.Name = "numberRequiredLabel"; numberRequiredLabel.Font = GV.generalFont; numberRequiredLabel.Location = new Point(5, 25); numberRequiredLabel.AutoSize = true; this.Controls.Add(numberRequiredLabel); TextBox resourceNameTextBox = new TextBox(); resourceNameTextBox.Size = resourceNameTextBoxSize; resourceNameTextBox.TextChanged += new EventHandler(resourceTextBox_TextChanged); resourceNameTextBox.Location = new Point(125, 7); this.Controls.Add(resourceNameTextBox); resourceNameTextBox.BringToFront(); resourceNameTextBox.Name = GV.resourceNameTextBoxName; }
private void BeginEditing() { EndEditing(true); _editing = true; if (_editingIndex != -1) { _txtInclude = new TextBox(); _txtInclude.Leave += txtInclude_Leave; _txtInclude.Text = includeList.Items[includeList.SelectedIndex].ToString(); _editingIncludeDir = _txtInclude.Text; includeList.SelectionMode = SelectionMode.One; Rectangle rect = includeList.GetItemRectangle(includeList.SelectedIndex); _txtInclude.Location = new Point(includeList.Location.X + 2, includeList.Location.Y + rect.Y); _txtInclude.Width = includeList.Width - 50; _txtInclude.Parent = includeList; _txtInclude.KeyUp += new KeyEventHandler(txtInclude_KeyUp); groupBox1.Controls.Add(_txtInclude); _btnSelectInclude = new Button(); _btnSelectInclude.Text = "..."; _btnSelectInclude.Location = new Point(includeList.Location.X + _txtInclude.Width, includeList.Location.Y + rect.Y); _btnSelectInclude.Width = 50; _btnSelectInclude.Height = _txtInclude.Height; _btnSelectInclude.Click += new EventHandler(btnSelectInclude_Clicked); groupBox1.Controls.Add(_btnSelectInclude); _txtInclude.Show(); _txtInclude.BringToFront(); _txtInclude.Focus(); _btnSelectInclude.Show(); _btnSelectInclude.BringToFront(); } }
protected override void OnMouseHover(EventArgs e) { String temp = this.number; temp = temp.Replace("W", " "); Graphics g = this.Parent.CreateGraphics(); tempBox = new TextBox(); tempBox.Enabled = false; tempBox.Location = new Point(this.Location.X + 10, this.Location.Y + 5); tempBox.Text = temp; tempBox.Width = this.Width - 20; tempBox.Multiline = true; tempBox.Font = new Font(FontFamily.GenericMonospace, 8F); tempBox.Height = 63;//(int)this.CreateGraphics().MeasureString(this.number, Font).Height; //Rectangle rect = new Rectangle(this.Location.X, this.Location.Y + 20, width + 10, height + 10); this.Parent.Controls.Add(tempBox); tempBox.BringToFront(); //g.FillRectangle(Brushes.LawnGreen, rect); //((MouseEventArgs)e).X base.OnMouseHover(e); }
private void LoadDataAndShow() { try { tableName = this.UserName.ToString(); tblInfo = DBEngine.execReturnDataTable(string.Format("select * from tblDataSetting where TableName = '{0}'", this.UserName)); if (tblInfo != null && tblInfo.Rows.Count > 0) { //Load Primary keys if (!tblInfo.Rows[0]["TableEditorName"].ToString().Equals(string.Empty)) this.UserName = tblInfo.Rows[0]["TableEditorName"].ToString().Split('|')[0]; //m_dtPrimaryKeys = DBEngine.execReturnDataTable("sp_TableEditor_GetPrimaryKeys", "@Tablename", this.UserName.ToString()); strViewName = tblInfo.Rows[0]["ViewName"].ToString(); if (tblInfo.Rows[0]["IsShowLayout"] != DBNull.Value) IsShowLayout = Convert.ToBoolean(tblInfo.Rows[0]["IsShowLayout"]); else IsShowLayout = false; if (tblInfo.Rows[0]["AllowAdd"] != DBNull.Value) isAllowAdd = Convert.ToBoolean(tblInfo.Rows[0]["AllowAdd"]); else IsAdded = false; if (tblInfo.Rows[0]["ReadOnly"] != DBNull.Value) isReadOnly = Convert.ToBoolean(tblInfo.Rows[0]["ReadOnly"]); if (tblInfo.Rows[0]["IsProcedure"] != DBNull.Value) IsProcedure = Convert.ToBoolean(tblInfo.Rows[0]["IsProcedure"]); if (tblInfo.Rows[0]["IsProcessForm"] != DBNull.Value) IsProcessForm = Convert.ToBoolean(tblInfo.Rows[0]["IsProcessForm"]); strColumnReadOnly = tblInfo.Rows[0]["ReadOnlyColumns"].ToString().Split(','); strColumnFormatFont = tblInfo.Rows[0]["FormatFontColumns"].ToString().Split(','); strColumnPaint = tblInfo.Rows[0]["PaintColumns"].ToString().Split(','); strPaintRows = tblInfo.Rows[0]["PaintRows"].ToString().Split(','); strColumnHide = tblInfo.Rows[0][ColumnHide].ToString().Split(','); strColumnFixed = tblInfo.Rows[0][FixedColumns].ToString().Split(','); strGroupColumns = tblInfo.Rows[0][GroupColumns].ToString().Split(','); strColumnOrderBy = tblInfo.Rows[0][ColumnOrderBy].ToString().Split(','); strColumnCombobox = tblInfo.Rows[0]["ComboboxColumns"].ToString().Split('|'); m_dtColumnsName = DBEngine.execReturnDataTable("sp_TableEditor_Columns", "@Tablename", strViewName); m_dtColumnsName.PrimaryKey = new DataColumn[] { m_dtColumnsName.Columns[NAME] }; if (IsProcedure) { int height = 0; tableName = tblInfo.Rows[0]["TableEditorName"].ToString(); // đọc các tham số truyền vào dtParameter = DBEngine.execReturnDataTable("sp_Export_GetParameter", "@ProcedureName", strViewName, "@LanguageID", UIMessage.languageID); grbFilter.Controls.Clear(); if ((dtParameter != null) && (dtParameter.Rows.Count > 0)) { hideContainerLeft.Visible = true; cellLocation = new string[3, dtParameter.Rows.Count];// frist used for Name, second used for Location and third used for Value int index = 0; //generate filter condition foreach (DataRow dr in dtParameter.Rows) { //cut lose @LoginID if (dr[P_NAME].ToString().ToLower().Equals(CommonConst.A_LoginID.ToLower())) continue; height += 25; // set lable Label lbl = new Label() { Name = LBL_PREFIX + dr[P_NAME], Text = dr[Message_P].ToString() }; cellLocation[0, index] = lbl.Text; cellLocation[1, index] = dr[CellLocation].ToString(); cellLocation[2, index++] = dr[P_NAME].ToString(); grbFilter.Controls.Add(lbl); lbl.Location = new Point(10, height); // set input control switch (dr[DataType].ToString().ToLower()) { case "dropdownlist": { if (dr[P_NAME].ToString().ToLower() == CommonConst.A_EmployeeID.ToLower()) { ShowEmployeeList(new Point(110, height), dr[P_NAME].ToString()); break; } // create combobox for this once LookUpEdit cbx = new LookUpEdit() { Name = CBX_PREFIX + dr[P_NAME] }; // set data source AddDataSource(ref cbx, DBEngine.execReturnDataTable(dr[Query].ToString(), CommonConst.A_LoginID, UserID)); // if the control is month or year list, so set theo current month and year if (cbx.Name.ToLower().Contains("month")) { dtInitValue = DBEngine.execReturnDataTable("select * from tblCurrentWorkingMonth"); cbx.EditValue = dtInitValue.Rows[0]["Month"]; } if (cbx.Name.ToLower().Contains("year")) { dtInitValue = DBEngine.execReturnDataTable("select * from tblCurrentWorkingMonth"); cbx.EditValue = dtInitValue.Rows[0]["Year"]; } if (cbx.Name.ToLower().Contains("currency")) { cbx.EditValue = "VND"; } grbFilter.Controls.Add(cbx); cbx.Location = new Point(110, height); cbx.Width = 200; cbx.BringToFront(); break; } case "number": case "int": case "smallint": case "tinyint": case "money": { // Create textbox and set read number only TextBox txt = new TextBox() { Name = TXT_PREFIX + dr[P_NAME], Location = new Point(110, height), Width = 200 }; txt.BringToFront(); //set read number only txt.KeyPress += new KeyPressEventHandler(txt_KeyPress); grbFilter.Controls.Add(txt); break; } case "datetime": case "smalldatetime": { // Create datetimepicker DateEdit dtp = new DateEdit() { Name = DTP_PREFIX + dr[P_NAME], Location = new Point(110, height), Width = 200 }; dtp.Properties.LookAndFeel.UseDefaultLookAndFeel = false; dtp.Properties.LookAndFeel.SkinName = "Blue"; dtp.Properties.Mask.EditMask = "dd/MM/yyyy"; dtp.Properties.Mask.UseMaskAsDisplayFormat = true; grbFilter.Controls.Add(dtp); break; } case "boolean": case "bit": { // Create datetimepicker CheckEdit ckb = new CheckEdit() { Name = CKB_PREFIX + dr[P_NAME], Location = new Point(110, height) }; ckb.Properties.LookAndFeel.UseDefaultLookAndFeel = false; ckb.Properties.LookAndFeel.SkinName = "Blue"; grbFilter.Controls.Add(ckb); break; } default: { // Create textbox and set read number only TextBox txt = new TextBox() { Name = TXT_PREFIX + dr[P_NAME], Location = new Point(110, height), Width = 200 }; txt.BringToFront(); grbFilter.Controls.Add(txt); // textbox here break; } } } grbFilter.Height = 25+ height; } else hideContainerLeft.Visible = false; // thực thi câu truy vấn với tham số mặc định if (!IsProcessForm) m_dtTableData = LoadProduceData(); else { pnlFWCommand.Visible = false; } } else { hideContainerLeft.Visible = false; m_dtTableData = DBEngine.execReturnDataTable(MakeLoadAllDataQuery(strViewName)); } m_dtColumnsName_Org = DBEngine.execReturnDataTable("sp_TableEditor_Columns", "@Tablename", this.UserName.ToString()); } else { hideContainerLeft.Visible = false; //Load Primary keys m_dtColumnsName = DBEngine.execReturnDataTable("sp_TableEditor_Columns", "@Tablename", this.UserName.ToString()); m_dtColumnsName_Org = m_dtColumnsName.Copy(); m_dtTableData = DBEngine.execReturnDataTable(MakeLoadAllDataQuery(this.UserName.ToString())); } if (!IsProcessForm) { BuildVisibleColumnsProc(); grdTableEditor.DataSource = m_dtTableData; dt_OldValue = m_dtTableData.Copy(); RegisterEvents(); grvTableEditor.BestFitColumns(); } Control.ControlCollection ctrls = splitContainer1.Panel2.Controls; UIMessage.LoadLableName(ref ctrls); } catch (Exception ex) { HPA.Common.Helper.ShowException(ex, ex.Message, "Load and show data"); } if (!IsProcessForm) { m_dtTableData.DefaultView.RowFilter = strFilter; } }
internal static void MessageTextBox(string title, IList<string> lines, bool returnImediatly) { TextBox textBox = new TextBox(); Form form = new Form(); textBox.Multiline = true; int limit = 1000; if (lines.Count <= limit) { textBox.Lines = new List<string>(lines).ToArray(); } else { string[] shortLines = new string[limit + 2]; for (int lineIndex = 0; lineIndex < limit; lineIndex++) { shortLines[lineIndex] = lines[lineIndex]; } shortLines[limit] = string.Empty; shortLines[limit + 1] = "Note, text truncated at 1000 lines."; textBox.Lines = shortLines; } textBox.SelectionStart = 0; textBox.SelectionLength = 0; textBox.ScrollBars = ScrollBars.Both; textBox.Size = new Size(400, 400); textBox.Dock = DockStyle.Fill; Size size = textBox.Size; int controlHeight = size.Height; form.ControlBox = true; form.Text = title; size = textBox.Size; form.ClientSize = new Size(size.Width, controlHeight); form.Controls.Add(textBox); textBox.BringToFront(); if (returnImediatly) { form.Show(); Application.DoEvents(); Thread.Sleep(100); } else { using (textBox) using (form) { try { form.ShowDialog(); } finally { bool flag = form == null; if (!flag) { form.Dispose(); } } } } }
public ParameterForm(string title, IList<string> parameterNameList, IList<string> parameterValueList, IList<bool> canBeNullList = null) { InitializeComponent(); if (!string.IsNullOrWhiteSpace(title)) { Text = title; } if (parameterNameList == null) { return; } this.canBeNullList = canBeNullList; var labelY = 16; var textBoxY = 32; var textBoxWidth = mainPanel.Size.Width - 32; for (var i = 0; i < parameterNameList.Count; i++) { var parameter = parameterNameList[i]; var label = new Label { Name = string.Format("lbl{0}", parameter), Text = string.Format("{0}:", parameter), Location = new Point(16, labelY), Size = new Size(400, 20) }; mainPanel.Controls.Add(label); var textBox = new TextBox { Name = string.Format("txt{0}", parameter), AutoSize = false, Size = new Size(textBoxWidth, 24), Location = new Point(16, textBoxY), Tag = i }; if (parameterNameList.Count == parameterValueList.Count) { textBox.Text = parameterValueList[i]; } if (canBeNullList != null && parameterValueList.Count == canBeNullList.Count) { textBox.TextChanged += textBox_TextChanged; } mainPanel.Controls.Add(textBox); textBox.BringToFront(); labelY += 48; textBoxY += 48; } textBoxList = mainPanel.Controls.Cast<Control>().Where(c => c is TextBox).ToList(); var delta = parameterNameList.Count*48; Size = new Size(Size.Width, Size.Height + delta); textBox_TextChanged(null, null); }
private void buttonHelp_Click(object sender, EventArgs e) { string file = ""; //string uri = "file://" + CurrentDirectory + "Readme.htm"; //if (BufferDrawMode == BufferDrawModeGraph) // uri += "#graph"; //RegistryKey rk = Registry.ClassesRoot.OpenSubKey("htmlfile\\Shell\\Open\\Command"); //string ie = (string)rk.GetValue("Default"); bool ok = false; string browser = null; if (File.Exists("\\Windows\\iexplore.exe")) browser = "\\Windows\\iexplore.exe"; else if (File.Exists("\\Windows\\iesample.exe")) //some CE devices use iesample browser = "\\Windows\\iesample.exe"; if (browser != null) { try { System.Diagnostics.Process proc = new System.Diagnostics.Process(); //proc.StartInfo.FileName = "\"file://" + CurrentDirectory + "Readme.htm"; proc.StartInfo.FileName = browser; //start explicitly IE, because some other brosers (UC Browser) can not display files proc.StartInfo.Arguments = CurrentDirectory + "Readme.htm"; if (BufferDrawMode == BufferDrawModeGraph) proc.StartInfo.Arguments += "#graph"; proc.StartInfo.UseShellExecute = true; proc.Start(); ok = true; /* file = CurrentDirectory + "Readme.htm"; StreamReader sr = new StreamReader(file); string doc = sr.ReadToEnd(); if (BufferDrawMode_Save == BufferDrawModeGraph) doc = doc.Remove(0, doc.IndexOf("<a name=\"graph\"></a>")); webbrowser = new WebBrowser(); webbrowser.Parent = this; webbrowser.Dock = DockStyle.Fill; webbrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(eventHandler_ShowCloseButton); //webbrowser.Url = new Uri("http://127.0.0.1");// new Uri("\"file:" + file + "\""); //webbrowser.Stop(); webbrowser.DocumentText = doc; //WinCE gives IOException - can not display doc? webbrowser.BringToFront(); webbrowser.Focus(); //to bring Windows title bar in background ok = true; */ } catch { ok = false; } } if (!ok) { try { BufferDrawMode_Save = BufferDrawMode; BufferDrawMode = BufferDrawModeHelp; file = CurrentDirectory + "Readme.txt"; //max 64kB!! StreamReader sr = new StreamReader(file); string doc = sr.ReadToEnd(); textbox = new TextBox(); textbox.Parent = this; textbox.Dock = DockStyle.Fill; textbox.Multiline = true; textbox.ScrollBars = ScrollBars.Vertical; textbox.Text = doc; if (BufferDrawMode_Save == BufferDrawModeGraph) { textbox.SelectionStart = doc.Length - 1; //scroll to the end, then back to "Graph" to have it at top textbox.ScrollToCaret(); textbox.SelectionStart = doc.IndexOf(". Graph\r"); textbox.ScrollToCaret(); } textbox.BringToFront(); textbox.Focus(); eventHandler_ShowCloseButton(null, null); } catch (Exception ex) { MessageBox.Show("Cannot display '" + file + "'\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); HelpEndClick(null, null); } } }
public GridLine(bool isVertical, bool MajorLine, Size BitmapSize, Size WindowSize, Point Position, Grapher Owner) { owner = Owner; lineValue = new TextBox(); Location = new Point(); scaleX = (float)BitmapSize.Width / (float)WindowSize.Width; scaleY = (float)BitmapSize.Height / (float)WindowSize.Height; if (gridPen == null) gridPen = new Pen(Color.Black, 3); if (gridGraphics == null) gridGraphics = Graphics.FromImage(grid); oldBorders = new Rectangle(Position, WindowSize); disposed = false; lineValue.BackColor = Color.White; lineValue.Size = new Size(50, 20); lineValue.ReadOnly = true; lineValue.TextAlign = HorizontalAlignment.Center; vertical = isVertical; major = MajorLine; lineValue.Text = @"0"; //if (isVertical) //not even sure if tracking the size is useful with the new paradigm //{ // //gridLine.Height = WindowSize.Height; // lineSize.Height = WindowSize.Height; // if (MajorLine) // //gridLine.Width = gridLine.BackgroundImage.Width; // lineSize.Width = (int)gridPen.Width; // else // //gridLine.Width = gridLine.BackgroundImage.Width / 2; // lineSize.Width = (int)gridPen.Width / 2; // scale = BitmapSize.Height / (float)WindowSize.Height; //} //else //{ // //gridLine.Width = WindowSize.Width; // lineSize.Width = WindowSize.Width; // if (MajorLine) // //gridLine.Height = gridLine.BackgroundImage.Height; // lineSize.Height = (int)gridPen.Width; // else // //gridLine.Height = gridLine.BackgroundImage.Height / 2; // lineSize.Height = (int)gridPen.Width / 2; // scale = BitmapSize.Width / (float)WindowSize.Width; //} Location = Position; //Draw line onto transparent bitmap using position if (vertical) gridGraphics.DrawLine(gridPen, Location.X, Location.Y, Location.X, owner.ClientSize.Height); else gridGraphics.DrawLine(gridPen, Location.X, Location.Y, owner.ClientSize.Width, Location.Y); //Signal the graphbox to update it's image //this.Update(Position); // should just run error checking -- didn't seem to work. this.UpdateBox(); Owner.Controls.Add(lineValue); lineValue.BringToFront(); //box should appear on top of the line }
public static TextBox add_TextBox(this IStep step) { if (step.UI == null) return null; var textBox = new TextBox(); textBox.DeselectAll(); step.UI.Controls.Add(textBox); textBox.BringToFront(); return textBox; }
private void pnlGridDraw_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; pnlGridDraw.AutoSize = true; pnlGridDraw.Width = numOfCells * cellSize + 3; pnlGridDraw.Height = numOfCells * cellSize + 3; if (this.Width < pnlGridDraw.Width) this.Width = pnlGridDraw.Width + 5; for (int i = 0; i <= numOfCells; i++) { g.DrawLine(Pens.Black, i * cellSize, 0, i * cellSize, numOfCells * cellSize); g.DrawLine(Pens.Black, 0, i * cellSize, numOfCells * cellSize, i * cellSize); } int y; TextBox myTextBox; for (int i = 0; i < numOfCells; i++) { for (int j = 0; j < numOfCells; j++) { myTextBox = new TextBox(); y = j * cellSize; myTextBox.Text = Cells[i, j].ToString(); myTextBox.TextAlign = HorizontalAlignment.Center; myTextBox.Size = new Size(cellSize - 2, cellSize); myTextBox.Location = new Point(j * cellSize + pnlGridDraw.Location.X + 2, pnlGridDraw.Location.Y + i * cellSize); this.Controls.Add(myTextBox); textboxes.Add(myTextBox); myTextBox.BorderStyle = BorderStyle.Fixed3D; myTextBox.Enabled = true; //t.ReadOnly = true; myTextBox.Show(); myTextBox.BringToFront(); //t.MouseClick += text_MouseClick; myTextBox.MouseClick += text_MouseClick; } } this.Invalidate(); }
public void CreateGUI() { this.MetaTab.Controls.Clear(); int num = 0; int num2 = 0; int arg_25_0 = 0; checked { int num3 = [email protected] - 1; for (int i = arg_25_0; i <= num3; i++) { GroupBox groupBox = new GroupBox(); groupBox.Text = this.@struct[i].name; groupBox.Name = this.@struct[i].name + "GroupBox"; Point location; int j; if (!(this.@struct[i].name.Equals("Main"))) { ComboBox comboBox = new ComboBox(); Label label = new Label(); label.Text = this.@struct[i].name; Control arg_C2_0 = label; location = new Point(2, num); arg_C2_0.Location = location; label.Width = this.@struct[i].name.Length * 7; comboBox.Name = this.@struct[i].name + "ComboBox"; Control arg_11F_0 = comboBox; location = new Point(label.Width + 10, num); arg_11F_0.Location = location; comboBox.SelectedIndexChanged += new EventHandler(this.somethingChanged); comboBox.Click += new EventHandler(this.SetUserDidIt); this.MetaTab.Controls.Add(label); this.MetaTab.Controls.Add(comboBox); int arg_188_0 = 0; int num4 = this.@struct[0].values.Length - 1; for (j = arg_188_0; j <= num4; j++) { if (this.@struct[i].name.Equals(this.@struct[0].values[j].name) & this.@struct[0].values[j].type.Equals("reflexive")) { int arg_212_0 = 0; int num5 = this.@struct[0].values[j].count - 1; for (int k = arg_212_0; k <= num5; k++) { comboBox.Items.Add(k); } } } num += 25; } Control arg_252_0 = groupBox; location = new Point(2, num); arg_252_0.Location = location; int x = 10; int num6 = 15; int arg_277_0 = 0; int num7 = this.@struct[i].values.Length - 1; j = arg_277_0; Size size; while (j <= num7) { string type = this.@struct[i].values[j].type; if (type.Equals("float")) { goto IL_2E2; } if (type.Equals("string32")) { goto IL_2E2; } if (type.Equals("integer")) { goto IL_2E2; } if (type.Equals("short")) { goto IL_2E2; } if (type.Equals("id32") || type.Equals("id16")) { GroupBox groupBox2 = new GroupBox(); groupBox2.Tag = this.@struct[i].values[j].offset; groupBox2.Name = this.@struct[i].values[j].name.Replace(" ", "") + "Group"; groupBox2.Text = this.@struct[i].values[j].name; groupBox2.Width = this.MetaTab.Width - 20; groupBox2.Height = 20 + (this.@struct[i].values[j].offset_options.Length / 2 + this.@struct[i].values[j].offset_options.Length % 2) * 16; Control arg_5BD_0 = groupBox2; location = new Point(x, num6); arg_5BD_0.Location = location; groupBox2.TabIndex = num2; num2++; int x2 = 10; int num8 = 15; int arg_5F9_0 = 0; int num9 = this.@struct[i].values[j].offset_options.Length - 1; for (int k = arg_5F9_0; k <= num9; k++) { RadioButton radioButton = new RadioButton(); radioButton.Name = this.@struct[i].values[j].offset_options[k].op_name.Replace(" ", "") + "RadioButton"; radioButton.Text = this.@struct[i].values[j].offset_options[k].op_name; radioButton.Tag = this.@struct[i].values[j].offset_options[k].op_value; if (Operators.ConditionalCompareObjectEqual(this.@struct[i].values[j].offset_options[k].op_value, this.@struct[i].values[j].data, false)) { radioButton.Checked = true; } else { radioButton.Checked = false; } Control arg_71F_0 = radioButton; location = new Point(x2, num8); arg_71F_0.Location = location; Control arg_742_0 = radioButton; size = new Size(radioButton.Name.Length * 5 + 15, 15); arg_742_0.Size = size; radioButton.TabIndex = num2 + k; radioButton.CheckedChanged += new EventHandler(this.somethingChanged); groupBox2.Controls.Add(radioButton); radioButton.BringToFront(); if (k % 2 == 1) { x2 = 10; num8 += 15; } else { x2 = (int)Math.Round((double)this.MetaTab.Width / 2.0); } } groupBox.Controls.Add(groupBox2); num6 += groupBox2.Height; x = 10; num2 += this.@struct[i].values[j].offset_options.Length; } else { if (type.Equals("bitmask32")) { GroupBox groupBox3 = new GroupBox(); groupBox3.Tag = this.@struct[i].values[j].offset; groupBox3.Name = this.@struct[i].values[j].name.Replace(" ", "") + "Group"; groupBox3.Text = this.@struct[i].values[j].name; groupBox3.Width = this.MetaTab.Width - 20; groupBox3.Height = 20 + (this.@struct[i].values[j].offset_options.Length / 2 + this.@struct[i].values[j].offset_options.Length % 2) * 16; groupBox3.TabIndex = num2; Control arg_916_0 = groupBox3; location = new Point(x, num6); arg_916_0.Location = location; int x2 = 10; int num8 = 15; num2++; int arg_94A_0 = 0; int num10 = this.@struct[i].values[j].offset_options.Length - 1; for (int k = arg_94A_0; k <= num10; k++) { CheckBox checkBox = new CheckBox(); checkBox.Name = this.@struct[i].values[j].offset_options[k].op_name.Replace(" ", "") + "CheckBox"; checkBox.Text = this.@struct[i].values[j].offset_options[k].op_name; checkBox.Tag = this.@struct[i].values[j].offset_options[k].op_value; Control arg_A0E_0 = checkBox; location = new Point(x2, num8); arg_A0E_0.Location = location; Control arg_A31_0 = checkBox; size = new Size(checkBox.Name.Length * 5 + 15, 15); arg_A31_0.Size = size; checkBox.TabIndex = num2 + k; if (this.@struct[i].values[j].data != null) { object arg_ADE_0 = this.@struct[i].values[j].data; Type arg_ADE_1 = null; string arg_ADE_2 = "BitOn"; object[] array = new object[1]; object[] arg_AC6_0 = array; int arg_AC6_1 = 0; XMLMain.TAG_STRUCT[] arg_A99_0 = this.@struct; int num11 = i; XMLMain.VALUE_STRUCT[] arg_AA8_0 = arg_A99_0[num11].values; int num12 = j; XMLMain.OFFSET_OPTIONS[] arg_AB7_0 = arg_AA8_0[num12].offset_options; int num13 = k; arg_AC6_0[arg_AC6_1] = arg_AB7_0[num13].op_value; object[] array2 = array; object[] arg_ADE_3 = array2; string[] arg_ADE_4 = null; Type[] arg_ADE_5 = null; bool[] array3 = new bool[] { true }; object arg_B35_0 = NewLateBinding.LateGet(arg_ADE_0, arg_ADE_1, arg_ADE_2, arg_ADE_3, arg_ADE_4, arg_ADE_5, array3); if (array3[0]) { this.@struct[num11].values[num12].offset_options[num13].op_value = (int)Conversions.ChangeType(RuntimeHelpers.GetObjectValue(array2[0]), typeof(int)); } if (Conversions.ToBoolean(arg_B35_0)) { checkBox.Checked = true; } } checkBox.CheckedChanged += new EventHandler(this.somethingChanged); groupBox3.Controls.Add(checkBox); checkBox.BringToFront(); if (k % 2 == 1) { x2 = 10; num8 += 15; } else { x2 = (int)Math.Round((double)this.MetaTab.Width / 2.0); } } groupBox.Controls.Add(groupBox3); num6 += groupBox3.Height; num2 += this.@struct[i].values[j].offset_options.Length; x = 10; } } IL_BE9: j++; continue; IL_2E2: TextBox textBox = new TextBox(); Label label2 = new Label(); textBox.Name = this.@struct[i].values[j].name + "TextBox"; textBox.Tag = this.@struct[i].values[j].offset; if (this.@struct[i].values[j].data != null) { textBox.Text = Conversions.ToString(this.@struct[i].values[j].data); } label2.Name = this.@struct[i].values[j].name + "Label"; label2.Text = this.@struct[i].values[j].name; label2.TabIndex = num2; textBox.TabIndex = num2 + 1; label2.AutoSize = true; Control arg_404_0 = label2; location = new Point(x, num6); arg_404_0.Location = location; x = (int)Math.Round((double)this.MetaTab.Width / 2.0); Control arg_436_0 = textBox; size = new Size(75, 20); arg_436_0.Size = size; Control arg_44A_0 = textBox; location = new Point(x, num6); arg_44A_0.Location = location; textBox.TextChanged += new EventHandler(this.somethingChanged); groupBox.Controls.Add(label2); groupBox.Controls.Add(textBox); textBox.BringToFront(); num6 += 20; x = 10; num2 += 2; goto IL_BE9; } Control arg_C12_0 = groupBox; size = new Size(this.MetaTab.Width - 24, num6 + 5); arg_C12_0.Size = size; num += groupBox.Height; this.MetaTab.Controls.Add(groupBox); } } }
/// <summary> /// Event Handler for clicking the name field. This will generate a new text box over that field /// that will allow the user to enter in a new name. When the focus leaves this text box or when /// Enter/Return is pressed, the name will change (or not change if escape is pressed). /// </summary> /// <param name="sender">Sender</param> /// <param name="e">EventArgs for the event</param> private void ChangeName(object sender, EventArgs e) { TextBox newNameInput = new TextBox(); newNameInput.BackColor = SystemColors.HotTrack; newNameInput.Font = new Font("Segoe UI", 14.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); newNameInput.ForeColor = SystemColors.Control; newNameInput.Location = new Point(0, 250); newNameInput.Margin = new Padding(0); newNameInput.Name = "newNameInput"; newNameInput.Size = new Size(250, 30); newNameInput.TabIndex = 2; newNameInput.Text = "Enter the new name..."; newNameInput.TextAlign = HorizontalAlignment.Center; newNameInput.LostFocus += SaveNewName; newNameInput.KeyDown += SaveNewName; newNameInput.Visible = true; Controls.Add(newNameInput); newNameInput.BringToFront(); newNameInput.Focus(); }
public GoalDetailPanel() { this.BackgroundImage = GV.backPanelImage; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.BackColor = Color.Transparent; this.AutoScroll = true; this.Size = new Size(340, 605); this.Location = new Point(210, 50); Point checkBoxStartingLocation = new Point(5, 53); Point textBoxStartingLocation = new Point(240, 50); Size textBoxSize = new Size(35, 20); int checkBoxIncrement = 27; Point checkBoxCurrentLocation = checkBoxStartingLocation; Point textBoxCurrentLocation = textBoxStartingLocation; int textBoxIncrement = checkBoxIncrement; Label goalDescriptionLabel = new Label(); goalDescriptionLabel.Name = "goalDescriptionLabel"; goalDescriptionLabel.Text = "Goal description (optional)"; goalDescriptionLabel.Font = GV.generalFont; goalDescriptionLabel.AutoSize = true; goalDescriptionLabel.Location = new Point(138, 34); this.Controls.Add(goalDescriptionLabel); Label goalDetailPanelTitleLabel = new Label(); goalDetailPanelTitleLabel.Name = "goalDetailPanelTitleLabel"; goalDetailPanelTitleLabel.Text = "Goal parameter editor"; goalDetailPanelTitleLabel.Font = GV.titleFont; goalDetailPanelTitleLabel.AutoSize = true; goalDetailPanelTitleLabel.Location = new Point(70, 6); this.Controls.Add(goalDetailPanelTitleLabel); TextBox goalDescriptionTextBox = new TextBox(); goalDescriptionTextBox.Name = "description"; goalDescriptionTextBox.Size = new Size(127, 20); goalDescriptionTextBox.Location = new Point(5, 29); goalDescriptionTextBox.Multiline = true; goalDescriptionTextBox.WordWrap = true; goalDescriptionTextBox.MouseEnter += new EventHandler(goalDescriptionBox_MouseEnter); goalDescriptionTextBox.MouseLeave += new EventHandler(goalDescriptionBox_MouseLeave); goalDescriptionTextBox.TextChanged += new EventHandler(goalDescriptionTextBox_TextChanged); goalDescriptionTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.Controls.Add(goalDescriptionTextBox); int length = GV.allGoalsFieldArray.GetLength(1); for (int i = 0; i < length; i++) //creates each of the buttons for the control { InputTypes newGroup = new InputTypes(this, GV.allGoalsFieldArray, i, ref checkBoxCurrentLocation, ref textBoxCurrentLocation, textBoxSize, checkBoxIncrement); } goalDescriptionTextBox.BringToFront(); //gets the description TextBox to overlay all other items }
private void btnSubmit_Click(object sender, EventArgs e) { if (txtBoxUsername.Text == "" || txtBoxPassword.Text == "") { MessageBox.Show("Username and Password is required"); } else { if (cbHost.Text != "" && txtBoxKey.Text != "" && cbFunction.Text != "" && cbMethod.Text != "") { //viewer.Process(true); string str = String.Empty; Control.ControlCollection cc = gbREST.Controls; foreach (Control c in cc) { if (c != null) { string temp = c.Text.ToString(); if (temp != "") { str += temp; } else { if (typeof(TextBox) == c.GetType()) { MessageBox.Show("Missing parameter. Unable to process request"); } } } } string host = cbHost.Text; string url = cbHost.Text + str; string username = txtBoxUsername.Text; string password = txtBoxPassword.Text; string key = txtBoxKey.Text; string secret = txtBoxSecret.Text; string domain = txtBoxDomain.Text; string accessToken = getAccessToken(username, password, key, host); string xmlResponse = getXMLResponse(accessToken, url).ToString(); string title = cbFunction.Text; TabPage newTab = new TabPage(title); tabControlConcur.TabPages.Add(newTab); TextBox newTxtBox = new TextBox(); newTxtBox.Name = title; newTxtBox.Text = xmlResponse; newTxtBox.Size = new System.Drawing.Size(930, 464); newTxtBox.Multiline = true; newTxtBox.ScrollBars = ScrollBars.Vertical; newTxtBox.BringToFront(); newTab.Controls.Add(newTxtBox); int selectedTab = (this.tabControlConcur.TabPages.Count) - 1; this.tabControlConcur.SelectedTab = this.tabControlConcur.TabPages[selectedTab]; } else { MessageBox.Show("Incomplete Details. Unable to process request."); } } }
private void lVMacros_MouseDoubleClick(object sender, MouseEventArgs e) { if (lVMacros.SelectedIndices[0] < 0) { return; } if (lVMacros.SelectedItems[0].ImageIndex == 2) { TextBox tb = new TextBox { MaxLength = 5 }; tb.KeyDown += nud_KeyDown; tb.LostFocus += nud_LostFocus; selection = lVMacros.SelectedIndices[0]; Controls.Add(tb); changingDelay = true; tb.Location = new Point(lVMacros.Location.X + lVMacros.SelectedItems[0].Position.X, lVMacros.Location.Y + lVMacros.SelectedItems[0].Position.Y); tb.BringToFront(); lVMacros.MouseHover -= lVMacros_MouseHover; tb.TextChanged += tb_TextChanged; tb.Focus(); } else if (macros[lVMacros.SelectedIndices[0]] > 1000000000) { selection = lVMacros.SelectedIndices[0]; string lb = macros[lVMacros.SelectedIndices[0]].ToString().Substring(1); byte r = (byte)(int.Parse(lb[0].ToString()) * 100 + int.Parse(lb[1].ToString()) * 10 + int.Parse(lb[2].ToString())); byte g = (byte)(int.Parse(lb[3].ToString()) * 100 + int.Parse(lb[4].ToString()) * 10 + int.Parse(lb[5].ToString())); byte b = (byte)(int.Parse(lb[6].ToString()) * 100 + int.Parse(lb[7].ToString()) * 10 + int.Parse(lb[8].ToString())); AdvancedColorDialog advColorDialog = new AdvancedColorDialog { Color = Color.FromArgb(r, g, b) }; advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor; if (advColorDialog.ShowDialog() == DialogResult.OK) { macros[selection] = 1000000000 + advColorDialog.Color.R * 1000000 + advColorDialog.Color.G * 1000 + advColorDialog.Color.B; } lVMacros.Items[selection].Text = ($"Lightbar Color: {advColorDialog.Color.R},{advColorDialog.Color.G},{advColorDialog.Color.B}"); } else if ((macros[lVMacros.SelectedIndices[0]] > 1000000) && (macros[lVMacros.SelectedIndices[0]] != 1000000000)) { lVMacros.MouseHover -= lVMacros_MouseHover; string r = macros[lVMacros.SelectedIndices[0]].ToString().Substring(1); byte heavy = (byte)(int.Parse(r[0].ToString()) * 100 + int.Parse(r[1].ToString()) * 10 + int.Parse(r[2].ToString())); byte light = (byte)(int.Parse(r[3].ToString()) * 100 + int.Parse(r[4].ToString()) * 10 + int.Parse(r[5].ToString())); selection = lVMacros.SelectedIndices[0]; tb1 = new TextBox(); tb2 = new TextBox(); tb1.Name = "tBHeavy"; tb1.Name = "tBLight"; tb1.MaxLength = 3; tb2.MaxLength = 3; tb1.KeyDown += nud_KeyDown; tb2.KeyDown += nud_KeyDown; Controls.Add(tb1); Controls.Add(tb2); changingDelay = false; tb1.Location = new Point(lVMacros.Location.X + lVMacros.SelectedItems[0].Position.X, lVMacros.Location.Y + lVMacros.SelectedItems[0].Position.Y); tb1.Size = new Size(tb1.Size.Width / 2, tb1.Size.Height); tb2.Location = new Point(lVMacros.Location.X + lVMacros.SelectedItems[0].Position.X + tb1.Size.Width, lVMacros.Location.Y + lVMacros.SelectedItems[0].Position.Y); tb2.Size = tb1.Size; tb1.BringToFront(); tb2.BringToFront(); tb1.Text = heavy.ToString(); tb2.Text = light.ToString(); tb1.TextChanged += tb_TextChanged; tb2.TextChanged += tb_TextChanged; tb1.Focus(); } }
public MissionInfoPanel() { Point checkBoxStartingLocation = new Point(3, 50); Point textBoxStartingLocation = new Point(checkBoxStartingLocation.X + 200, checkBoxStartingLocation.Y -3); Size textBoxSize = new Size(30, 20); int checkBoxIncrement = 23; Point checkBoxCurrentLocation = checkBoxStartingLocation; Point textBoxCurrentLocation = textBoxStartingLocation; this.Location = new Point(553, 6); this.Size = new Size(310, 652); //To change this, also change Maximum size property this.MaximumSize = new Size(310, 652); this.BackgroundImage = GV.backPanelImage; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.BackColor = Color.Transparent; this.AutoScroll = true; Label missionNameLabel = new Label(); missionNameLabel.Name = "missionNameLabel"; missionNameLabel.Text = "Mission name"; missionNameLabel.AutoSize = true; missionNameLabel.Font = GV.generalFont; missionNameLabel.Location = new Point(13, 7); this.Controls.Add(missionNameLabel); ComboBox missionNameComboBox = new ComboBox(); missionNameComboBox.Name = "missionNameComboBox"; missionNameComboBox.Size = new Size(150, 21); missionNameComboBox.Location = new Point(113, 3); missionNameComboBox.DropDownStyle = ComboBoxStyle.DropDownList; missionNameComboBox.SelectedIndexChanged += new EventHandler(missionNameCB_SelectionChanged); this.Controls.Add(missionNameComboBox); Label missionDescriptionLabel = new Label(); missionDescriptionLabel.Name = "missionDescriptionLabel"; missionDescriptionLabel.Text = "Mission description"; missionDescriptionLabel.AutoSize = true; missionDescriptionLabel.Font = GV.generalFont; missionDescriptionLabel.Location = new Point(160, 30); //5,30 this.Controls.Add(missionDescriptionLabel); TextBox missionDescriptionTextBox = new TextBox(); missionDescriptionTextBox.Name = "description"; missionDescriptionTextBox.Location = new Point(5, 27); //140,20 missionDescriptionTextBox.Size = new Size(145, 20); missionDescriptionTextBox.Multiline = true; missionDescriptionTextBox.WordWrap = true; missionDescriptionTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; missionDescriptionTextBox.MouseHover += new EventHandler(missionDescriptionTextBox_MouseHover); missionDescriptionTextBox.MouseLeave += new EventHandler(missionDescriptionTextBox_MouseLeave); missionDescriptionTextBox.TextChanged += new EventHandler(missionDescriptionTextBox_TextChanged); this.Controls.Add(missionDescriptionTextBox); missionDescriptionTextBox.BringToFront(); int length = GV.missionFieldArray.GetLength(1); for (int i = 0; i < length; i++) //creates each of the buttons for the control { InputTypes newGroup = new InputTypes(this, GV.missionFieldArray, i, ref checkBoxCurrentLocation, ref textBoxCurrentLocation, textBoxSize, checkBoxIncrement); } panelStartingLocation.X = checkBoxCurrentLocation.X +10; panelStartingLocation.Y = checkBoxCurrentLocation.Y; }
private void CreateOneTextBox(int rowIndex, int columnIndex, string userSate, bool isRemoveIfCancel) { ListViewItem.ListViewSubItem subItem = this.Items[rowIndex].SubItems[columnIndex]; _tmpTextBox = new TextBox(); _tmpTextBox.Multiline = true; //只能使用标题框的宽度,使用item.SubItems[0]的宽度会有问题 _tmpTextBox.Bounds = new Rectangle(subItem.Bounds.Location, new Size(this.Columns[columnIndex].Width, subItem.Bounds.Height)); _tmpTextBox.Text = subItem.Text; _tmpTextBox.Tag = new string[] { rowIndex.ToString(), columnIndex.ToString(), userSate,isRemoveIfCancel.ToString()}; _tmpTextBox.KeyDown += tmpTextBox_KeyDown; _tmpTextBox.Leave += tmpTextBox_Leave; this.Controls.Add(_tmpTextBox); _tmpTextBox.BringToFront(); _tmpTextBox.Select(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { for (int j = 0; j < this.panel1.Controls.Count; j++) { panel1.Controls.RemoveAt(j); panel1.Refresh(); } Point p = new Point(5, 5); for (int i = 0; i < Convert.ToInt16(comboBox1.SelectedItem); i++) { Label lb = new Label(); lb.Text = "Option" + i; lb.Name = "lb" + i; lb.Location = new Point(p.Y, p.X); lb.BringToFront(); //p.X = lb.Location.X + lb.Width; p.Y = lb.Location.Y; TextBox tx = new TextBox(); tx.Name = "tx" + i; tx.Text = "Option" + i; tx.Location = new Point(p.Y, p.X + 30); tx.BringToFront(); p.X = tx.Location.X + tx.Width; // p.Y = tx.Location.X; this.panel1.Controls.Add(lb); this.panel1.Controls.Add(tx); this.panel1.Refresh(); } }