public static DialogResult InputBox(string title, string promptText, ref string value) { Form form = new Form(); Label label = new Label(); TextBox textBox = new TextBox(); PulseButton.PulseButton buttonOk = new PulseButton.PulseButton(); PulseButton.PulseButton buttonCancel = new PulseButton.PulseButton(); buttonOk.ShapeType = PulseButton.PulseButton.Shape.Rectangle; buttonOk.BackColor = System.Drawing.SystemColors.Control; buttonOk.ButtonColorTop = System.Drawing.Color.GreenYellow; buttonOk.ButtonColorBottom = System.Drawing.Color.YellowGreen; buttonCancel.ShapeType = PulseButton.PulseButton.Shape.Rectangle; buttonOk.PulseWidth = 1; buttonOk.CornerRadius = 5; buttonCancel.PulseWidth = 1; buttonCancel.ButtonColorTop = System.Drawing.Color.MistyRose; buttonCancel.ButtonColorBottom = System.Drawing.Color.LightCoral; buttonCancel.BackColor = System.Drawing.SystemColors.Control; buttonCancel.CornerRadius = 5; form.Text = title; label.Text = promptText; textBox.Text = value; buttonOk.Text = "OK"; //buttonOk.Image = FAQ_Net.Properties.Resources.OK; buttonOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; buttonCancel.Text = "Cancel"; //buttonCancel.Image = FAQ_Net.Properties.Resources.No; buttonCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; buttonOk.DialogResult = DialogResult.OK; buttonCancel.DialogResult = DialogResult.Cancel; label.SetBounds(5, 5, 370, 13); textBox.SetBounds(5, 25, 370, 20); buttonOk.SetBounds(100, 50, 80, 25); buttonCancel.SetBounds(220, 50, 80, 25); label.AutoSize = true; textBox.Anchor = textBox.Anchor | AnchorStyles.Right; buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; form.ClientSize = new System.Drawing.Size(380, 80); form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel }); //form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; form.AcceptButton = buttonOk; form.CancelButton = buttonCancel; DialogResult dialogResult = form.ShowDialog(); value = textBox.Text; return(dialogResult); }
private void InitializeComponent() { this.btnSearchDown = new PulseButton.PulseButton(); this.wholeWord = new System.Windows.Forms.CheckBox(); this.matchCase = new System.Windows.Forms.CheckBox(); this.btnReplace = new PulseButton.PulseButton(); this.btnReplaceAll = new PulseButton.PulseButton(); this.txbReplace = new System.Windows.Forms.TextBox(); this.lblReplace = new System.Windows.Forms.Label(); this.btnSearchUp = new PulseButton.PulseButton(); this.cancel = new PulseButton.PulseButton(); this.findText = new System.Windows.Forms.TextBox(); this.FindLabel = new System.Windows.Forms.Label(); this.rbSearch = new System.Windows.Forms.RadioButton(); this.rbReplace = new System.Windows.Forms.RadioButton(); this.chkHighlightAll = new System.Windows.Forms.CheckBox(); this.panelGradient = new GradientControls.PanelGradient(); this.panelGradient.SuspendLayout(); this.SuspendLayout(); // // btnSearchDown // this.btnSearchDown.ButtonColorBottom = System.Drawing.Color.LightSkyBlue; this.btnSearchDown.ButtonColorTop = System.Drawing.Color.LightCyan; this.btnSearchDown.CornerRadius = 5; this.btnSearchDown.ForeColor = System.Drawing.SystemColors.ControlText; this.btnSearchDown.Image = global::FAQ_Net.Properties.Resources.down; this.btnSearchDown.Location = new System.Drawing.Point(331, 23); this.btnSearchDown.Name = "btnSearchDown"; this.btnSearchDown.PulseSpeed = 0.3F; this.btnSearchDown.PulseWidth = 1; this.btnSearchDown.ShapeType = PulseButton.PulseButton.Shape.Rectangle; this.btnSearchDown.Size = new System.Drawing.Size(25, 25); this.btnSearchDown.TabIndex = 2; this.btnSearchDown.TabStop = false; this.btnSearchDown.UseVisualStyleBackColor = true; this.btnSearchDown.Click += new System.EventHandler(this.btnSearchDown_Click); this.btnSearchDown.Enter += new System.EventHandler(this.findButton_Enter); // // wholeWord // this.wholeWord.AutoSize = true; this.wholeWord.Location = new System.Drawing.Point(601, 28); this.wholeWord.Name = "wholeWord"; this.wholeWord.Size = new System.Drawing.Size(143, 17); this.wholeWord.TabIndex = 345; this.wholeWord.TabStop = false; this.wholeWord.Text = "Только &слово целиком"; this.wholeWord.UseVisualStyleBackColor = true; // // matchCase // this.matchCase.AutoSize = true; this.matchCase.Location = new System.Drawing.Point(475, 28); this.matchCase.Name = "matchCase"; this.matchCase.Size = new System.Drawing.Size(120, 17); this.matchCase.TabIndex = 444; this.matchCase.TabStop = false; this.matchCase.Text = "С учетом &регистра"; this.matchCase.UseVisualStyleBackColor = true; // // btnReplace // this.btnReplace.ButtonColorBottom = System.Drawing.Color.LightSkyBlue; this.btnReplace.ButtonColorTop = System.Drawing.Color.LightCyan; this.btnReplace.CornerRadius = 5; this.btnReplace.ForeColor = System.Drawing.SystemColors.ControlText; this.btnReplace.Location = new System.Drawing.Point(362, 50); this.btnReplace.Name = "btnReplace"; this.btnReplace.PulseSpeed = 0.3F; this.btnReplace.PulseWidth = 1; this.btnReplace.ShapeType = PulseButton.PulseButton.Shape.Rectangle; this.btnReplace.Size = new System.Drawing.Size(75, 23); this.btnReplace.TabIndex = 683; this.btnReplace.Text = "Заменить"; this.btnReplace.UseVisualStyleBackColor = true; this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click); // // btnReplaceAll // this.btnReplaceAll.ButtonColorBottom = System.Drawing.Color.LightSkyBlue; this.btnReplaceAll.ButtonColorTop = System.Drawing.Color.LightCyan; this.btnReplaceAll.CornerRadius = 5; this.btnReplaceAll.ForeColor = System.Drawing.SystemColors.ControlText; this.btnReplaceAll.Location = new System.Drawing.Point(443, 50); this.btnReplaceAll.Name = "btnReplaceAll"; this.btnReplaceAll.PulseSpeed = 0.3F; this.btnReplaceAll.PulseWidth = 1; this.btnReplaceAll.ShapeType = PulseButton.PulseButton.Shape.Rectangle; this.btnReplaceAll.Size = new System.Drawing.Size(89, 23); this.btnReplaceAll.TabIndex = 682; this.btnReplaceAll.TabStop = false; this.btnReplaceAll.Text = "Заменить все"; this.btnReplaceAll.UseVisualStyleBackColor = true; this.btnReplaceAll.Click += new System.EventHandler(this.btnReplaceAll_Click); // // txbReplace // this.txbReplace.Location = new System.Drawing.Point(86, 52); this.txbReplace.Name = "txbReplace"; this.txbReplace.Size = new System.Drawing.Size(215, 20); this.txbReplace.TabIndex = 680; // // lblReplace // this.lblReplace.AutoSize = true; this.lblReplace.Location = new System.Drawing.Point(8, 55); this.lblReplace.Name = "lblReplace"; this.lblReplace.Size = new System.Drawing.Size(75, 13); this.lblReplace.TabIndex = 681; this.lblReplace.Text = "&Заменить на:"; // // btnSearchUp // this.btnSearchUp.ButtonColorBottom = System.Drawing.Color.LightSkyBlue; this.btnSearchUp.ButtonColorTop = System.Drawing.Color.LightCyan; this.btnSearchUp.CornerRadius = 5; this.btnSearchUp.ForeColor = System.Drawing.SystemColors.ControlText; this.btnSearchUp.Image = global::FAQ_Net.Properties.Resources.up; this.btnSearchUp.Location = new System.Drawing.Point(305, 23); this.btnSearchUp.Name = "btnSearchUp"; this.btnSearchUp.PulseSpeed = 0.3F; this.btnSearchUp.PulseWidth = 1; this.btnSearchUp.ShapeType = PulseButton.PulseButton.Shape.Rectangle; this.btnSearchUp.Size = new System.Drawing.Size(25, 25); this.btnSearchUp.TabIndex = 679; this.btnSearchUp.UseVisualStyleBackColor = true; this.btnSearchUp.Click += new System.EventHandler(this.btnSearchUp_Click); // // cancel // this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.cancel.ButtonColorBottom = System.Drawing.Color.LightSkyBlue; this.cancel.ButtonColorTop = System.Drawing.Color.LightCyan; this.cancel.CornerRadius = 5; this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.cancel.ForeColor = System.Drawing.SystemColors.ControlText; this.cancel.Location = new System.Drawing.Point(759, 3); this.cancel.Name = "cancel"; this.cancel.PulseSpeed = 0.3F; this.cancel.PulseWidth = 1; this.cancel.ShapeType = PulseButton.PulseButton.Shape.Rectangle; this.cancel.Size = new System.Drawing.Size(21, 20); this.cancel.TabIndex = 3; this.cancel.TabStop = false; this.cancel.Text = "X"; this.cancel.UseVisualStyleBackColor = true; this.cancel.Click += new System.EventHandler(this.cancel_Click); // // findText // this.findText.Location = new System.Drawing.Point(86, 26); this.findText.Name = "findText"; this.findText.Size = new System.Drawing.Size(215, 20); this.findText.TabIndex = 1; // // FindLabel // this.FindLabel.AutoSize = true; this.FindLabel.Location = new System.Drawing.Point(9, 29); this.FindLabel.Name = "FindLabel"; this.FindLabel.Size = new System.Drawing.Size(41, 13); this.FindLabel.TabIndex = 7; this.FindLabel.Text = "&Найти:"; // // rbSearch // this.rbSearch.AutoSize = true; this.rbSearch.Location = new System.Drawing.Point(13, 3); this.rbSearch.Name = "rbSearch"; this.rbSearch.Size = new System.Drawing.Size(56, 17); this.rbSearch.TabIndex = 685; this.rbSearch.Text = "Найти"; this.rbSearch.UseVisualStyleBackColor = true; // // rbReplace // this.rbReplace.AutoSize = true; this.rbReplace.Checked = true; this.rbReplace.Location = new System.Drawing.Point(75, 3); this.rbReplace.Name = "rbReplace"; this.rbReplace.Size = new System.Drawing.Size(75, 17); this.rbReplace.TabIndex = 686; this.rbReplace.TabStop = true; this.rbReplace.Text = "Заменить"; this.rbReplace.UseVisualStyleBackColor = true; this.rbReplace.CheckedChanged += new System.EventHandler(this.rbReplace_CheckedChanged); // // chkHighlightAll // this.chkHighlightAll.AutoSize = true; this.chkHighlightAll.Location = new System.Drawing.Point(362, 28); this.chkHighlightAll.Name = "chkHighlightAll"; this.chkHighlightAll.Size = new System.Drawing.Size(107, 17); this.chkHighlightAll.TabIndex = 687; this.chkHighlightAll.TabStop = false; this.chkHighlightAll.Text = "Подсветить все"; this.chkHighlightAll.UseVisualStyleBackColor = true; this.chkHighlightAll.CheckedChanged += new System.EventHandler(this.chkHighlightAll_CheckedChanged); // // panelGradient // this.panelGradient.BackColorBottom = System.Drawing.Color.Empty; this.panelGradient.Controls.Add(this.chkHighlightAll); this.panelGradient.Controls.Add(this.rbSearch); this.panelGradient.Controls.Add(this.rbReplace); this.panelGradient.Controls.Add(this.matchCase); this.panelGradient.Controls.Add(this.btnSearchDown); this.panelGradient.Controls.Add(this.btnReplace); this.panelGradient.Controls.Add(this.wholeWord); this.panelGradient.Controls.Add(this.btnReplaceAll); this.panelGradient.Controls.Add(this.btnSearchUp); this.panelGradient.Controls.Add(this.cancel); this.panelGradient.Controls.Add(this.lblReplace); this.panelGradient.Controls.Add(this.FindLabel); this.panelGradient.Controls.Add(this.findText); this.panelGradient.Controls.Add(this.txbReplace); this.panelGradient.Dock = System.Windows.Forms.DockStyle.Fill; this.panelGradient.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Horizontal; this.panelGradient.Location = new System.Drawing.Point(0, 0); this.panelGradient.Name = "panelGradient"; this.panelGradient.Size = new System.Drawing.Size(783, 78); this.panelGradient.TabIndex = 688; // // FindForm // this.BackColor = System.Drawing.SystemColors.Window; this.Controls.Add(this.panelGradient); this.Name = "FindForm"; this.Size = new System.Drawing.Size(783, 78); this.panelGradient.ResumeLayout(false); this.panelGradient.PerformLayout(); this.ResumeLayout(false); }