Esempio n. 1
0
        void doButtontoUI(string name, int x, int y)
        {
            MyLabel lbl = new MyLabel();
            ComboBox cmbbutton = new ComboBox();
            MyButton mybut = new MyButton();
            HorizontalProgressBar hbar = new HorizontalProgressBar();
            ComboBox cmbaction = new ComboBox();

            // do this here so putting in text works
            this.Controls.AddRange(new Control[] { lbl, cmbbutton, mybut, hbar, cmbaction });

            lbl.Location = new Point(x, y);
            lbl.Size = new Size(47, 13);
            lbl.Text = "Button " + name;

            cmbbutton.Location = new Point(72, y);
            cmbbutton.Size = new Size(70, 21);
            cmbbutton.DataSource = getButtonNumbers();
            cmbbutton.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbbutton.Name = "cmbbutton" + name;
            if (MainV2.config["butno" + name] != null)
                cmbbutton.Text = (MainV2.config["butno" + name].ToString());
            cmbbutton.SelectedIndexChanged += new EventHandler(cmbbutton_SelectedIndexChanged);

            mybut.Location = new Point(BUT_detch1.Left, y);
            mybut.Size = BUT_detch1.Size;
            mybut.Text = BUT_detch1.Text;
            mybut.Name = "mybut" + name;
            mybut.Click += new EventHandler(BUT_detbutton_Click);

            hbar.Location = new Point(progressBar1.Left, y);
            hbar.Size = progressBar1.Size;
            hbar.Name = "hbar" + name;

            cmbaction.Location = new Point(hbar.Right + 5, y);
            cmbaction.Size = new Size(100, 21);
            cmbaction.DataSource = (Enum.GetValues(Common.getModes()));
            cmbaction.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbaction.Name = "cmbaction" + name;
            if (MainV2.config["butaction" + name] != null)
                cmbaction.Text = MainV2.config["butaction" + name].ToString();

            this.Height += 25;
        }
Esempio n. 2
0
        public static DialogResult MessageShowAgain(string title, string promptText)
        {
            Form form = new Form();
            System.Windows.Forms.Label label = new System.Windows.Forms.Label();
            CheckBox chk = new CheckBox();
            MyButton buttonOk = new MyButton();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainV2));
            form.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

            form.Text = title;
            label.Text = promptText;

            chk.Tag = ("SHOWAGAIN_" + title.Replace(" ","_"));
            chk.AutoSize = true;
            chk.Text = "Show me again?";
            chk.Checked = true;
            chk.Location = new Point(9,80);

            if (MainV2.config[(string)chk.Tag] != null && (string)MainV2.config[(string)chk.Tag] == "False") // skip it
            {
                form.Dispose();
                chk.Dispose();
                buttonOk.Dispose();
                label.Dispose();
                return DialogResult.OK;
            }

            chk.CheckStateChanged += new EventHandler(chk_CheckStateChanged);

            buttonOk.Text = "OK";
            buttonOk.DialogResult = DialogResult.OK;
            buttonOk.Location = new Point(form.Right - 100 ,80);

            label.SetBounds(9, 40, 372, 13);

            label.AutoSize = true;

            form.ClientSize = new Size(396, 107);
            form.Controls.AddRange(new Control[] { label, chk, buttonOk });
            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;

            MainV2.fixtheme(form);

            return form.ShowDialog();
        }
Esempio n. 3
0
 private void InitializeComponent()
 {
     this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
     this.BUT_browselog = new ArdupilotMega.MyButton();
     this.BUT_browsedir = new ArdupilotMega.MyButton();
     this.TXT_logfile = new System.Windows.Forms.TextBox();
     this.TXT_jpgdir = new System.Windows.Forms.TextBox();
     this.TXT_offsetseconds = new System.Windows.Forms.TextBox();
     this.BUT_doit = new ArdupilotMega.MyButton();
     this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
     this.TXT_outputlog = new System.Windows.Forms.TextBox();
     this.label1 = new System.Windows.Forms.Label();
     this.BUT_estoffset = new ArdupilotMega.MyButton();
     this.SuspendLayout();
     //
     // openFileDialog1
     //
     this.openFileDialog1.FileName = "openFileDialog1";
     //
     // BUT_browselog
     //
     this.BUT_browselog.Location = new System.Drawing.Point(351, 12);
     this.BUT_browselog.Name = "BUT_browselog";
     this.BUT_browselog.Size = new System.Drawing.Size(75, 23);
     this.BUT_browselog.TabIndex = 0;
     this.BUT_browselog.Text = "Browse Log";
     this.BUT_browselog.UseVisualStyleBackColor = true;
     this.BUT_browselog.Click += new System.EventHandler(this.BUT_browselog_Click);
     //
     // BUT_browsedir
     //
     this.BUT_browsedir.Location = new System.Drawing.Point(351, 41);
     this.BUT_browsedir.Name = "BUT_browsedir";
     this.BUT_browsedir.Size = new System.Drawing.Size(75, 23);
     this.BUT_browsedir.TabIndex = 1;
     this.BUT_browsedir.Text = "Browse Directory";
     this.BUT_browsedir.UseVisualStyleBackColor = true;
     this.BUT_browsedir.Click += new System.EventHandler(this.BUT_browsedir_Click);
     //
     // TXT_logfile
     //
     this.TXT_logfile.Location = new System.Drawing.Point(28, 14);
     this.TXT_logfile.Name = "TXT_logfile";
     this.TXT_logfile.Size = new System.Drawing.Size(317, 20);
     this.TXT_logfile.TabIndex = 2;
     this.TXT_logfile.Text = "C:\\Users\\hog\\Pictures\\farm 1-10-2011\\100SSCAM\\2011-10-01 11-48 1.log";
     //
     // TXT_jpgdir
     //
     this.TXT_jpgdir.Location = new System.Drawing.Point(28, 43);
     this.TXT_jpgdir.Name = "TXT_jpgdir";
     this.TXT_jpgdir.Size = new System.Drawing.Size(317, 20);
     this.TXT_jpgdir.TabIndex = 3;
     this.TXT_jpgdir.Text = "C:\\Users\\hog\\Pictures\\farm 1-10-2011\\100SSCAM";
     //
     // TXT_offsetseconds
     //
     this.TXT_offsetseconds.Location = new System.Drawing.Point(180, 69);
     this.TXT_offsetseconds.Name = "TXT_offsetseconds";
     this.TXT_offsetseconds.Size = new System.Drawing.Size(100, 20);
     this.TXT_offsetseconds.TabIndex = 4;
     this.TXT_offsetseconds.Text = "0";
     //
     // BUT_doit
     //
     this.BUT_doit.Location = new System.Drawing.Point(194, 105);
     this.BUT_doit.Name = "BUT_doit";
     this.BUT_doit.Size = new System.Drawing.Size(75, 23);
     this.BUT_doit.TabIndex = 5;
     this.BUT_doit.Text = "Do It";
     this.BUT_doit.UseVisualStyleBackColor = true;
     this.BUT_doit.Click += new System.EventHandler(this.BUT_doit_Click);
     //
     // TXT_outputlog
     //
     this.TXT_outputlog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     | System.Windows.Forms.AnchorStyles.Left)
     | System.Windows.Forms.AnchorStyles.Right)));
     this.TXT_outputlog.Location = new System.Drawing.Point(28, 144);
     this.TXT_outputlog.Multiline = true;
     this.TXT_outputlog.Name = "TXT_outputlog";
     this.TXT_outputlog.ReadOnly = true;
     this.TXT_outputlog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
     this.TXT_outputlog.Size = new System.Drawing.Size(398, 143);
     this.TXT_outputlog.TabIndex = 6;
     //
     // label1
     //
     this.label1.AutoSize = true;
     this.label1.Location = new System.Drawing.Point(94, 75);
     this.label1.Name = "label1";
     this.label1.Size = new System.Drawing.Size(78, 13);
     this.label1.TabIndex = 7;
     this.label1.Text = "Seconds offset";
     //
     // BUT_estoffset
     //
     this.BUT_estoffset.Location = new System.Drawing.Point(286, 67);
     this.BUT_estoffset.Name = "BUT_estoffset";
     this.BUT_estoffset.Size = new System.Drawing.Size(75, 23);
     this.BUT_estoffset.TabIndex = 8;
     this.BUT_estoffset.Text = "Estimate Offset";
     this.BUT_estoffset.UseVisualStyleBackColor = true;
     this.BUT_estoffset.Click += new System.EventHandler(this.BUT_estoffset_Click);
     //
     // georefimage
     //
     this.ClientSize = new System.Drawing.Size(453, 299);
     this.Controls.Add(this.BUT_estoffset);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.TXT_outputlog);
     this.Controls.Add(this.BUT_doit);
     this.Controls.Add(this.TXT_offsetseconds);
     this.Controls.Add(this.TXT_jpgdir);
     this.Controls.Add(this.TXT_logfile);
     this.Controls.Add(this.BUT_browsedir);
     this.Controls.Add(this.BUT_browselog);
     this.Name = "georefimage";
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Esempio n. 4
0
        //from http://www.csharp-examples.net/inputbox/
        public static DialogResult InputBox(string title, string promptText, ref string value)
        {
            Form form = new Form();
            System.Windows.Forms.Label label = new System.Windows.Forms.Label();
            TextBox textBox = new TextBox();
            MyButton buttonOk = new MyButton();
            MyButton buttonCancel = new MyButton();

            form.TopMost = true;

            form.Text = title;
            label.Text = promptText;
            textBox.Text = value;

            buttonOk.Text = "OK";
            buttonCancel.Text = "Cancel";
            buttonOk.DialogResult = DialogResult.OK;
            buttonCancel.DialogResult = DialogResult.Cancel;

            label.SetBounds(9, 20, 372, 13);
            textBox.SetBounds(12, 36, 372, 20);
            buttonOk.SetBounds(228, 72, 75, 23);
            buttonCancel.SetBounds(309, 72, 75, 23);

            label.AutoSize = true;
            textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
            buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
            buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            form.ClientSize = new Size(396, 107);
            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;

            MainV2.fixtheme(form);

            DialogResult dialogResult = form.ShowDialog();
            if (dialogResult == DialogResult.OK)
            {
                value = textBox.Text;
            }
            return dialogResult;
        }