Beispiel #1
0
        public void Find()
        {
            if (_cd != null)
            {
                _cd.Dispose();
            }
            _cd = new WinForm(WinFormStyle.Dialog)
            {
                Size = new Size(350, Convert.ToInt32(350 / vbo.GoldenRatio)),
                Text = "Найти..."
            };

            _cd.Add <Panel>(WinFormConfig.SinglePageForm);
            TableLayoutPanel tlpRows = _cd.Items["FormRowsPanel"].LinkedControl as TableLayoutPanel;
            TableLayoutPanel p       = tlpRows.Add <TableLayoutPanel>(new WinFormItem("WorkCells")
            {
                CellsSize = new Pair <int>(2, 2)
            });

            p.ColumnStyles[0].SizeType = SizeType.Percent;
            p.ColumnStyles[0].Width    = 100;
            p.ColumnStyles[1].SizeType = SizeType.Absolute;
            p.ColumnStyles[1].Width    = 100;
            ComboBox cbox = p.Add <ComboBox>(new WinFormItem("SearchText")
            {
                PresentationType = typeof(ComboBox),
                DataType         = typeof(string),
                Value            = GetInitialSearchText()
            });

            cbox.Items.AddRange(_searches.ToArray());
            SetAutoComplete(cbox);
            _cd.Activated += new EventHandler((o, e) => { ((WinForm)o).GetControl <ComboBox>("SearchText").Focus(); });
            Button btn = p.Add <Button>("Find");

            btn.Text         = "Найти";
            btn.Click       += new EventHandler(Btn_Click);
            _cd.AcceptButton = btn;
            CheckBox cb = p.Add <CheckBox>(new WinFormItem("MatchCase")
            {
                Value = (_stringComparison != StringComparison.InvariantCultureIgnoreCase), DataType = typeof(bool), PresentationType = typeof(CheckBox)
            });

            cb.Text = "С учетом регистра";
            tlpRows.Add <Label>("Blank");
            _cd.Show(this);
        }
Beispiel #2
0
        public void Replace()
        {
            //Object[] values = InputBox.Show(new WinFormItem("DateOper") { Caption = "Дата операции", DataType = typeof(DateTime), Value = vbo.Date() },
            //	new WinFormItem("Amount") { Caption = "Сумма", DataType = typeof(decimal), Value = 1000000, Format = vbo.CurrencyFormat });

            if (_cd != null)
            {
                _cd.Dispose();
            }
            _cd = new WinForm(WinFormStyle.Dialog)
            {
                Size = new Size(350, Convert.ToInt32(350 / vbo.GoldenRatio)),
                Text = "Найти..."
            };

            _cd.Add <Panel>(WinFormConfig.SinglePageForm);
            TableLayoutPanel tlpRows = _cd.Items["FormRowsPanel"].LinkedControl as TableLayoutPanel;
            TableLayoutPanel p       = tlpRows.Add <TableLayoutPanel>(new WinFormItem("WorkCells")
            {
                CellsSize = new Pair <int>(2, 3)
            });

            p.ColumnStyles[0].SizeType = SizeType.Percent;
            p.ColumnStyles[0].Width    = 100;
            p.ColumnStyles[1].SizeType = SizeType.Absolute;
            p.ColumnStyles[1].Width    = 100;

            ComboBox cbox = p.Add <ComboBox>(new WinFormItem("SearchText")
            {
                PresentationType = typeof(ComboBox),
                DataType         = typeof(string),
                Value            = GetInitialSearchText(),
                CellAddress      = new Pair <int>(0, 0)
            });

            cbox.Items.AddRange(_searches.ToArray());
            SetAutoComplete(cbox);
            _cd.Activated += new EventHandler((o, e) => { ((WinForm)o).GetControl <ComboBox>("SearchText").Focus(); });

            cbox = p.Add <ComboBox>(new WinFormItem("ReplaceText")
            {
                PresentationType = typeof(ComboBox),
                DataType         = typeof(string),
                Value            = _replaceText,
                CellAddress      = new Pair <int>(0, 1)
            });
            cbox.Items.AddRange(_replaces.ToArray());
            SetAutoComplete(cbox);

            CheckBox cb = p.Add <CheckBox>(new WinFormItem("MatchCase")
            {
                Value            = (_stringComparison != StringComparison.InvariantCultureIgnoreCase),
                DataType         = typeof(bool),
                PresentationType = typeof(CheckBox),
                CellAddress      = new Pair <int>(0, 2)
            });

            cb.Text = "С учетом регистра";

            Button btn = p.Add <Button>("Find");

            btn.Text         = "Найти";
            btn.Click       += new EventHandler(Btn_Click);
            _cd.AcceptButton = btn;

            btn        = p.Add <Button>("Replace");
            btn.Text   = "Заменить";
            btn.Click += new EventHandler(Btn_Click);

            btn        = p.Add <Button>("ReplaceAll");
            btn.Text   = "Заменить все";
            btn.Click += new EventHandler(Btn_Click);
            tlpRows.Add <Label>("Blank");

            _cd.Show(this);
        }