Пример #1
0
        public static DialogResult InputBoxRec(string title, string promptText, ref string value, string RecFile)
        {
            Form    form         = new Form();
            Label   label        = new Label();
            TextBox textBox      = new TextBox();
            Button  buttonOk     = new Button();
            Button  buttonCancel = new Button();

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

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

            int w = form.Width, h = form.Height;

            label.Bounds        = new Rectangle(w * 10 / 480, h * 40 / 588, w * 460 / 480, h * 36 / 588);   //5, 20, 230, 18);
            textBox.Bounds      = new Rectangle(w * 10 / 480, h * 80 / 588, w * 460 / 480, h * 36 / 588);   //5, 40, 230, 18);
            buttonOk.Bounds     = new Rectangle(w * 165 / 480, h * 140 / 588, w * 150 / 480, h * 80 / 588); //80, 70, 75, 24);
            buttonCancel.Bounds = new Rectangle(w * 325 / 480, h * 140 / 588, w * 150 / 480, h * 80 / 588); //160, 70, 75, 24);

            //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(240, 100);
            form.Controls.Add(label);
            form.Controls.Add(textBox);
            form.Controls.Add(buttonOk);
            form.Controls.Add(buttonCancel);

            if (RecFile != null)
            {
                Button buttonRec = new Button();
                buttonRec.Text   = "Audio";
                buttonRec.Bounds = new Rectangle(w * 5 / 480, h * 140 / 588, w * 150 / 480, h * 80 / 588);
                form.Controls.Add(buttonRec);
                buttonRec.Click += buttonRec_Click; //buttonRec_Click;
                if (vr == null)
                {
                    vr = new VoiceRecorder();
                }
                vr.Position(w * 5 / 480, h * 280 / 588);
                vr.RecFile = RecFile;
            }

            form.BackColor    = GpsCycleComputer.Form1.bkColor;
            form.ForeColor    = GpsCycleComputer.Form1.foColor;
            label.BackColor   = GpsCycleComputer.Form1.bkColor;
            label.ForeColor   = GpsCycleComputer.Form1.foColor;
            textBox.BackColor = GpsCycleComputer.Form1.bkColor;
            textBox.ForeColor = GpsCycleComputer.Form1.foColor;
            //textBox.BorderStyle = BorderStyle.FixedSingle;

            //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;
            Microsoft.WindowsCE.Forms.InputPanel inputPanel = new Microsoft.WindowsCE.Forms.InputPanel();
            inputPanel.Enabled = true;
            DialogResult dialogResult = form.ShowDialog();

            inputPanel.Enabled = false;
            if (dialogResult == DialogResult.OK)
            {
                value = textBox.Text;
            }
            return(dialogResult);
        }
Пример #2
0
        public static DialogResult InputBoxRec(string title, string promptText, ref string value, string RecFile)
        {
            Form form = new Form();
            Label label = new Label();
            TextBox textBox = new TextBox();
            Button buttonOk = new Button();
            Button buttonCancel = new Button();

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

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

            int w = form.Width, h = form.Height;
            label.Bounds = new Rectangle(w *10/480, h *40/588, w *460/480, h *36/588);      //5, 20, 230, 18);
            textBox.Bounds = new Rectangle(w *10/480, h *80/588, w *460/480, h *36/588);    //5, 40, 230, 18);
            buttonOk.Bounds = new Rectangle(w *165/480, h *140/588, w *150/480, h *80/588);   //80, 70, 75, 24);
            buttonCancel.Bounds = new Rectangle(w *325/480, h *140/588, w *150/480, h *80/588);    //160, 70, 75, 24);

            //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(240, 100);
            form.Controls.Add(label);
            form.Controls.Add(textBox);
            form.Controls.Add(buttonOk);
            form.Controls.Add(buttonCancel);

            if (RecFile != null)
            {
                Button buttonRec = new Button();
                buttonRec.Text = "Audio";
                buttonRec.Bounds = new Rectangle(w * 5/480, h * 140/588, w * 150/480, h * 80/588);
                form.Controls.Add(buttonRec);
                buttonRec.Click += buttonRec_Click; //buttonRec_Click;
                if(vr == null) vr = new VoiceRecorder();
                vr.Position(w * 5/480, h * 280/588);
                vr.RecFile = RecFile;
            }
            
            form.BackColor = GpsCycleComputer.Form1.bkColor;
            form.ForeColor = GpsCycleComputer.Form1.foColor;
            label.BackColor = GpsCycleComputer.Form1.bkColor;
            label.ForeColor = GpsCycleComputer.Form1.foColor;
            textBox.BackColor = GpsCycleComputer.Form1.bkColor;
            textBox.ForeColor = GpsCycleComputer.Form1.foColor;
            //textBox.BorderStyle = BorderStyle.FixedSingle;
            
            //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;
            Microsoft.WindowsCE.Forms.InputPanel inputPanel = new Microsoft.WindowsCE.Forms.InputPanel();
            inputPanel.Enabled = true;
            DialogResult dialogResult = form.ShowDialog();
            inputPanel.Enabled = false;
            if (dialogResult == DialogResult.OK)
                value = textBox.Text;
            return dialogResult;
        }