コード例 #1
0
        public string ShowDialog()
        {
            TextBox input = new TextBox()
            {
                Left = 16, Top = 45, Width = 240, TabIndex = 0, TabStop = true
            };

            using (var form = new DialogForm(new FormInfo("Search Form", 280, 160)))
            {
                Label label = new Label()
                {
                    Left = 16, Top = 20, Width = 240, Text = "Please Enter Search Term"
                };
                Button confirmation = new Button()
                {
                    Text = "Search", Left = 16, Width = 80, Top = 88, TabIndex = 1, TabStop = true
                };
                confirmation.Click += (sender, e) => { form.Close(); };
                form.Controls.Add(label);
                form.Controls.Add(input);
                form.Controls.Add(confirmation);
                form.AcceptButton    = confirmation;
                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.StartPosition   = FormStartPosition.CenterScreen;
                form.ControlBox      = false;
                form.ShowDialog();
            }

            return(input.Text);
        }
コード例 #2
0
        public void ShowDialog()
        {
            using (var form = new DialogForm(new FormInfo("About IronText", 260, 400)))
            {
                Label lblWritenby = new Label {
                    Text = "Written by Jay Katie Martin"
                };
                Label lblLicence = new Label {
                    Text = "Licence MIT"
                };
                Button close = new Button()
                {
                    Text = "Close", Width = 80, TabIndex = 1, TabStop = true
                };
                close.Click += (sender, e) => { form.Close(); };
                var layout = new FlowLayoutPanel();

                PictureBox picture = new PictureBox
                {
                    ImageLocation = @"Icons\logo.png",
                    Width         = 237,
                    Height        = 239,
                };
                form.Controls.Add(layout);
                layout.Dock          = DockStyle.Fill;
                layout.FlowDirection = FlowDirection.TopDown;
                layout.Controls.Add(picture);
                layout.Controls.Add(lblWritenby);
                layout.Controls.Add(lblLicence);
                layout.Controls.Add(close);



                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.StartPosition   = FormStartPosition.CenterScreen;
                form.ControlBox      = false;
                form.ShowDialog();
            }
        }
コード例 #3
0
        private string ShowForm(Idea idea)
        {
            TextBox input = new TextBox
            {
                Left      = 16,
                Top       = 45,
                Width     = 320,
                Height    = 250,
                TabIndex  = 0,
                TabStop   = true,
                Multiline = true,
                Text      = idea.Description
            };

            using (var form = new DialogForm(new FormInfo("Edit Idea", 400, 400)))
            {
                Label label = new Label()
                {
                    Left = 16, Top = 20, Width = 240, Text = "Please Enter Changes"
                };
                Button confirmation = new Button()
                {
                    Text = "Save", Left = 16, Width = 80, Top = 300, TabIndex = 1, TabStop = true
                };
                confirmation.Click += (sender, e) => { form.Close(); };
                form.Controls.Add(label);
                form.Controls.Add(confirmation);
                form.Controls.Add(input);
                //TODO build form
                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.StartPosition   = FormStartPosition.CenterScreen;
                form.ControlBox      = false;
                form.ShowDialog();
            }

            return(input.Text);
        }