Beispiel #1
0
        private void init()
        {
            _cancelBtn             = new Button();
            _replaceBtn            = new Button();
            _searchBtn             = new Button();
            _replaceAllBtn         = new Button();
            _replaceDataTextBox    = new System.Windows.Forms.TextBox();
            _searchWordsTextBox    = new System.Windows.Forms.TextBox();
            _tLabel                = new Label();
            _replaceLabel          = new Label();
            _caseSensitiveChechBox = new CheckBox();
            _mPanel                = new Panel();
            _slabel                = new Label();
            _f          = new Form();
            _formHelper = new UI.Forms.FormHelper(_f);
            _f.SuspendLayout();
            //
            // cancelBtn
            //
            _cancelBtn.BackColor = Color.Transparent;
            _cancelBtn.FlatStyle = FlatStyle.Flat;
            _cancelBtn.ForeColor = Color.DarkSlateGray;
            _cancelBtn.Location  = new Point(317, 142);
            _cancelBtn.Size      = new Size(75, 22);
            _cancelBtn.TabIndex  = 0;
            _cancelBtn.Text      = "取消";
            _cancelBtn.UseVisualStyleBackColor = false;
            _cancelBtn.Click += new System.EventHandler(btns_Click);
            //
            // excBtn
            //
            _replaceBtn.BackColor = Color.Transparent;
            _replaceBtn.FlatStyle = FlatStyle.Flat;
            _replaceBtn.ForeColor = Color.DarkSlateGray;
            _replaceBtn.Location  = new Point(317, 68);
            _replaceBtn.Size      = new Size(75, 22);
            _replaceBtn.TabIndex  = 1;
            _replaceBtn.Text      = "替换";
            _replaceBtn.UseVisualStyleBackColor = false;
            _replaceBtn.Enabled = false;
            _replaceBtn.Click  += new System.EventHandler(btns_Click);
            //
            // btn_s
            //
            _searchBtn.BackColor = Color.Transparent;
            _searchBtn.FlatStyle = FlatStyle.Flat;
            _searchBtn.ForeColor = Color.DarkSlateGray;
            _searchBtn.Location  = new Point(317, 31);
            _searchBtn.Size      = new Size(75, 22);
            _searchBtn.TabIndex  = 2;
            _searchBtn.Text      = "查找下一个";
            _searchBtn.Enabled   = false;
            _searchBtn.UseVisualStyleBackColor = false;
            _searchBtn.Click += new System.EventHandler(btns_Click);
            //
            // btn_excall
            //
            _replaceAllBtn.BackColor = Color.Transparent;
            _replaceAllBtn.FlatStyle = FlatStyle.Flat;
            _replaceAllBtn.ForeColor = Color.DarkSlateGray;
            _replaceAllBtn.Location  = new Point(317, 105);
            _replaceAllBtn.Size      = new Size(75, 22);
            _replaceAllBtn.TabIndex  = 3;
            _replaceAllBtn.Text      = "全部替换";
            _replaceAllBtn.UseVisualStyleBackColor = false;
            _replaceAllBtn.Enabled = false;
            _replaceAllBtn.Click  += new System.EventHandler(btns_Click);
            //
            // tb_exc
            //
            _replaceDataTextBox.BorderStyle = BorderStyle.FixedSingle;
            _replaceDataTextBox.ForeColor   = Color.DarkSlateGray;
            _replaceDataTextBox.Location    = new Point(89, 69);
            _replaceDataTextBox.Size        = new Size(203, 21);
            _replaceDataTextBox.TabIndex    = 4;
            _replaceDataTextBox.BackColor   = _owner.BackColor;
            //
            // tb_s
            //
            _searchWordsTextBox.BorderStyle  = BorderStyle.FixedSingle;
            _searchWordsTextBox.ForeColor    = Color.DarkSlateGray;
            _searchWordsTextBox.Location     = new Point(89, 32);
            _searchWordsTextBox.Size         = new Size(203, 21);
            _searchWordsTextBox.TabIndex     = 5;
            _searchWordsTextBox.BackColor    = _owner.BackColor;
            _searchWordsTextBox.TextChanged += new System.EventHandler(soWordsTextBox_TextChanged);
            //
            // label_title
            //
            _tLabel.BackColor = _owner.BorderColor;
            _tLabel.Cursor    = Cursors.SizeAll;
            _tLabel.Dock      = DockStyle.Top;
            _tLabel.ForeColor = _owner.BackColor;
            _tLabel.Location  = new Point(0, 0);
            _tLabel.Size      = new Size(420, 20);
            _tLabel.TabIndex  = 6;
            _tLabel.Text      = "替换";
            _tLabel.TextAlign = ContentAlignment.MiddleCenter;
            //
            // label_exc
            //
            _replaceLabel.AutoSize  = true;
            _replaceLabel.BackColor = Color.Transparent;
            _replaceLabel.ForeColor = Color.DarkSlateGray;
            _replaceLabel.Location  = new Point(27, 75);
            _replaceLabel.Size      = new Size(53, 12);
            _replaceLabel.TabIndex  = 7;
            _replaceLabel.Text      = "替换为:";
            //
            // cb_lower
            //
            _caseSensitiveChechBox.AutoSize  = true;
            _caseSensitiveChechBox.BackColor = Color.Transparent;
            _caseSensitiveChechBox.ForeColor = Color.DarkSlateGray;
            _caseSensitiveChechBox.Location  = new Point(29, 146);
            _caseSensitiveChechBox.Size      = new Size(84, 16);
            _caseSensitiveChechBox.TabIndex  = 8;
            _caseSensitiveChechBox.Text      = "区分大小写";
            _caseSensitiveChechBox.UseVisualStyleBackColor = false;
            //
            // mPanel
            //
            _mPanel.BackColor = _owner.BackColor;
            _mPanel.Controls.Add(_slabel);
            _mPanel.Controls.Add(_replaceLabel);
            _mPanel.Controls.Add(_caseSensitiveChechBox);
            _mPanel.Controls.Add(_cancelBtn);
            _mPanel.Controls.Add(_replaceBtn);
            _mPanel.Controls.Add(_tLabel);
            _mPanel.Controls.Add(_searchBtn);
            _mPanel.Controls.Add(_searchWordsTextBox);
            _mPanel.Controls.Add(_replaceAllBtn);
            _mPanel.Controls.Add(_replaceDataTextBox);
            _mPanel.Dock     = DockStyle.Fill;
            _mPanel.Location = new Point(3, 0);
            _mPanel.Size     = new Size(420, 175);
            _mPanel.TabIndex = 9;
            //
            // label_s
            //
            _slabel.AutoSize  = true;
            _slabel.BackColor = Color.Transparent;
            _slabel.ForeColor = Color.DarkSlateGray;
            _slabel.Location  = new Point(27, 37);
            _slabel.Size      = new Size(41, 12);
            _slabel.TabIndex  = 9;
            _slabel.Text      = "查找:";
            //
            // f
            //
            _f.AutoScaleDimensions = new SizeF(6F, 12F);
            _f.BackColor           = _owner.BorderColor;
            _f.Owner      = _owner;
            _f.ClientSize = new Size(426, 180);
            _f.Controls.Add(_mPanel);
            _f.FormBorderStyle = FormBorderStyle.None;
            _f.Opacity         = 0.9D;
            _f.Padding         = new Padding(3, 0, 3, 3);
            _f.ShowIcon        = false;
            _f.ShowInTaskbar   = false;
            _f.StartPosition   = FormStartPosition.Manual;
            _f.Text            = "替换";
            _f.Load           += new System.EventHandler(f_Load);
            _f.Shown          += new System.EventHandler(f_Shown);
            _mPanel.ResumeLayout(false);
            _mPanel.PerformLayout();
            _f.ResumeLayout(false);

            _formHelper.Move(_mPanel);
            _formHelper.Move(_tLabel);
        }
Beispiel #2
0
 private void init()
 {
     _mPanel = new Panel();
     _tLabel = new Label();
     _caseSensstiveCheckBox    = new CheckBox();
     _sequentialSearchCheckBox = new CheckBox();
     _schTextBox   = new System.Windows.Forms.TextBox();
     _schBtn       = new Button();
     _cancelBtn    = new Button();
     _schTextLabel = new Label();
     _f            = new Form();
     _formHelper   = new UI.Forms.FormHelper(_f);
     //
     // mPanel
     //
     _mPanel.BackColor = _owner.BackColor;
     _mPanel.Controls.Add(_schTextLabel);
     _mPanel.Controls.Add(_cancelBtn);
     _mPanel.Controls.Add(_schBtn);
     _mPanel.Controls.Add(_schTextBox);
     _mPanel.Controls.Add(_sequentialSearchCheckBox);
     _mPanel.Controls.Add(_caseSensstiveCheckBox);
     _mPanel.Controls.Add(_tLabel);
     _mPanel.Dock      = DockStyle.Fill;
     _mPanel.ForeColor = Color.DarkSlateGray;
     _mPanel.Location  = new Point(3, 0);
     _mPanel.Size      = new Size(420, 175);
     _mPanel.TabIndex  = 0;
     //
     // tLabel
     //
     _tLabel.BackColor = _owner.BorderColor;
     _tLabel.Dock      = DockStyle.Top;
     _tLabel.ForeColor = _owner.BackColor;
     _tLabel.Location  = new Point(0, 0);
     _tLabel.Size      = new Size(420, 20);
     _tLabel.TabIndex  = 0;
     _tLabel.Text      = "查找";
     _tLabel.TextAlign = ContentAlignment.MiddleCenter;
     _tLabel.Cursor    = Cursors.SizeAll;
     //
     //
     //
     _caseSensstiveCheckBox.AutoSize = true;
     _caseSensstiveCheckBox.Checked  = true;
     _caseSensstiveCheckBox.Location = new Point(136, 131);
     _caseSensstiveCheckBox.Size     = new Size(72, 16);
     _caseSensstiveCheckBox.TabIndex = 3;
     _caseSensstiveCheckBox.Text     = "区分大小写";
     _caseSensstiveCheckBox.UseVisualStyleBackColor = true;
     _caseSensstiveCheckBox.BackColor          = Color.Transparent;
     _caseSensstiveCheckBox.CheckStateChanged += new EventHandler(caseSensstiveCheckedChanged);
     //
     // sequentialSearchCheckBox
     //
     _sequentialSearchCheckBox.AutoSize = true;
     _sequentialSearchCheckBox.Checked  = true;
     _sequentialSearchCheckBox.Location = new Point(230, 131);
     _sequentialSearchCheckBox.Size     = new Size(72, 16);
     _sequentialSearchCheckBox.TabIndex = 3;
     _sequentialSearchCheckBox.Text     = "顺序查找";
     _sequentialSearchCheckBox.UseVisualStyleBackColor = true;
     _sequentialSearchCheckBox.BackColor          = Color.Transparent;
     _sequentialSearchCheckBox.CheckStateChanged += new EventHandler(caseSensstiveCheckedChanged);
     //
     // schTextBox
     //
     _schTextBox.BorderStyle  = BorderStyle.FixedSingle;
     _schTextBox.Location     = new Point(99, 40);
     _schTextBox.Size         = new Size(227, 21);
     _schTextBox.TabIndex     = 4;
     _schTextBox.BackColor    = _owner.BackColor;
     _schTextBox.TextChanged += new EventHandler(searchWordsTextBox_TextChanged);
     //
     // schBtn
     //
     _schBtn.FlatStyle = FlatStyle.Flat;
     _schBtn.Location  = new Point(332, 39);
     _schBtn.Enabled   = false;
     _schBtn.Size      = new Size(75, 23);
     _schBtn.TabIndex  = 5;
     _schBtn.Text      = "查找下一个";
     _schBtn.UseVisualStyleBackColor = true;
     _schBtn.BackColor = Color.Transparent;
     _schBtn.Click    += new EventHandler(btn_s_Click);
     //
     // cancelBtn
     //
     _cancelBtn.FlatStyle = FlatStyle.Flat;
     _cancelBtn.Location  = new Point(332, 127);
     _cancelBtn.Size      = new Size(75, 23);
     _cancelBtn.TabIndex  = 6;
     _cancelBtn.Text      = "取消";
     _cancelBtn.UseVisualStyleBackColor = true;
     _cancelBtn.BackColor = Color.Transparent;
     _cancelBtn.Click    += new EventHandler((object sender, EventArgs e) => { _f.Hide(); });
     //
     // schTextLabel
     //
     _schTextLabel.AutoSize  = true;
     _schTextLabel.Location  = new Point(16, 44);
     _schTextLabel.Size      = new Size(77, 12);
     _schTextLabel.TabIndex  = 7;
     _schTextLabel.Text      = "查找关键词:";
     _schTextLabel.BackColor = Color.Transparent;
     //
     // f
     //
     _f.BackColor  = _owner.BorderColor;
     _f.Owner      = _owner;
     _f.ClientSize = new Size(426, 180);
     _f.Controls.Add(_mPanel);
     _f.FormBorderStyle = FormBorderStyle.None;
     _f.ShowIcon        = false;
     _f.ShowInTaskbar   = false;
     _f.Location        = new Point(_owner.Left + 66, _owner.Top + _owner.Height / 3);
     _f.StartPosition   = FormStartPosition.Manual;
     _f.Padding         = new Padding(3, 0, 3, 3);
     _f.Text            = "查找";
     _mPanel.ResumeLayout(false);
     _mPanel.PerformLayout();
     _f.ResumeLayout(false);
     _f.Load  += new EventHandler(f_Load);
     _f.Shown += new EventHandler(f_Shown);
 }