Beispiel #1
0
 private void PropertyView_DoubleClick(object sender, EventArgs e)
 {
     lvItem_ = this.GetItemAt(mx_, my_);
     if (lvItem_ != null)
     {
         int x1 = this.Columns[0].Width + 2;
         if (mx_ >= x1)
         {
             int      x2   = x1 + this.Columns[1].Width;
             int      r    = lvItem_.Index;
             Property prop = (Property)propList_[r];
             if (prop.isSelection())
             {
                 addSelections(prop.getOptions());
                 comboBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height);
                 comboBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                 comboBox_.Show();
                 comboBox_.Text = lvItem_.SubItems[1].Text;
                 comboBox_.SelectAll();
                 comboBox_.Focus();
             }
             else
             {
                 editBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height - 2);
                 editBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                 editBox_.Show();
                 editBox_.Text = lvItem_.SubItems[1].Text;
                 editBox_.SelectAll();
                 editBox_.Focus();
             }
         }
     }
 }
Beispiel #2
0
 public Login()
 {
     InitializeComponent();
     textUsuario.Text = "admin";//Nombre de usuario administrador prederteminado
     textClave.Text = "12345";//Claver de usuario administrador prederteminado
     TextBox asd = new TextBox();
     asd.Show();
 }
Beispiel #3
0
        public NewMapDlg()
            : base()
        {
            FormBorderStyle = FormBorderStyle.FixedDialog;

            Label t = new Label();
            t.Text = "Width";
            t.Location = new Point(10, 10);
            t.Show();

            Label u = new Label();
            u.Text = "Height";
            u.Location = new Point(t.Left, t.Bottom + 5);
            u.Show();

            widthbox = new TextBox();
            widthbox.Location = new Point(t.Right + 5, 10);
            widthbox.Show();

            heightbox = new TextBox();
            heightbox.Location = new Point(widthbox.Left, widthbox.Bottom + 5);
            heightbox.Show();

            Button okbutton = new Button();
            okbutton.Text = "OK";
            okbutton.DialogResult = DialogResult.OK;
            okbutton.Location = new Point(t.Left, u.Bottom + 5);
            okbutton.Show();

            Button cancelbutton = new Button();
            cancelbutton.Text = "Cancel";
            cancelbutton.DialogResult = DialogResult.Cancel;
            cancelbutton.Location = new Point(okbutton.Right + 5, okbutton.Top);
            cancelbutton.Show();

            Controls.Add(t);
            Controls.Add(u);
            Controls.Add(widthbox);
            Controls.Add(heightbox);
            Controls.Add(okbutton);
            Controls.Add(cancelbutton);

            AcceptButton = okbutton;
            CancelButton = cancelbutton;

            Width = heightbox.Right + 35;
            Height = okbutton.Bottom + 35;
        }
Beispiel #4
0
        // create a edit box. The listbox item text message has been assigned
        // to the edit box text.
        private void CreateEditBox(object sender)
        {
            courseListListBox = (ListBox)sender;
            int       itemSelected = courseListListBox.SelectedIndex;
            Rectangle r            = courseListListBox.GetItemRectangle(itemSelected);
            string    itemText     = (string)courseListListBox.Items[itemSelected];

            editBox.Location = new System.Drawing.Point(r.X + 10, r.Y + 10);
            editBox.Size     = new System.Drawing.Size(r.Width - 10, r.Height - 10);
            editBox.Show();
            courseListListBox.Controls.AddRange(new System.Windows.Forms.Control[] { this.editBox });
            editBox.Text = itemText;
            editBox.Focus();
            editBox.SelectAll();
            editBox.KeyPress  += new System.Windows.Forms.KeyPressEventHandler(this.EditOver);
            editBox.LostFocus += new System.EventHandler(this.FocusOver);
        }
        private void createStackDisplay()
        {
            TextBox box;

            for (int i = 0; i < PIC.Data.OperationStack.STACK_SIZE; i++)
            {
                box = new TextBox();
                box.SetBounds(5 + STACK_X_OFFSET, stackIndex0Label.Bounds.Y - TEXT_BOX_Y_OFFSET + i * 20, 25, 25);
                box.Parent = this;
                box.ReadOnly = true;
                box.Show();
                stackBoxes[i] = box;
            }

            updateStackDisplay();
            //throw new NotImplementedException();
        }
Beispiel #6
0
        public void SMKDoubleClick(object sender, System.EventArgs e)
        {
            // Check the subitem clicked .
            int nStart = X;
            int spos   = 0;
            int epos   = this.Columns[0].Width;

            for (int i = 0; i < this.Columns.Count; i++)
            {
                if (nStart > spos && nStart < epos)
                {
                    subItemSelected = i;
                    break;
                }

                spos  = epos;
                epos += this.Columns[i].Width;
            }

            Console.WriteLine("SUB ITEM SELECTED = " + li.SubItems[subItemSelected].Text);
            subItemText = li.SubItems[subItemSelected].Text;

            string colName = this.Columns[subItemSelected].Text;

            if (colName == "Continent")
            {
                Rectangle r = new Rectangle(spos, li.Bounds.Y, epos, li.Bounds.Bottom);
                cmbBox.Size     = new System.Drawing.Size(epos - spos, li.Bounds.Bottom - li.Bounds.Top);
                cmbBox.Location = new System.Drawing.Point(spos, li.Bounds.Y);
                cmbBox.Show();
                cmbBox.Text = subItemText;
                cmbBox.SelectAll();
                cmbBox.Focus();
            }
            else
            {
                Rectangle r = new Rectangle(spos, li.Bounds.Y, epos, li.Bounds.Bottom);
                editBox.Size     = new System.Drawing.Size(epos - spos, li.Bounds.Bottom - li.Bounds.Top);
                editBox.Location = new System.Drawing.Point(spos, li.Bounds.Y);
                editBox.Show();
                editBox.Text = subItemText;
                editBox.SelectAll();
                editBox.Focus();
            }
        }
Beispiel #7
0
        public void SMKMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            m_currentLVSubItem = null;
            Point tmpPoint = new Point(e.X, e.Y);

            m_currentLVSubItem = this.HitTest(tmpPoint).SubItem;
            if (m_currentLVSubItem == null)
            {
                return;
            }

            editBox.Size     = new System.Drawing.Size(m_currentLVSubItem.Bounds.Width, m_currentLVSubItem.Bounds.Height);
            editBox.Location = new System.Drawing.Point(m_currentLVSubItem.Bounds.X, m_currentLVSubItem.Bounds.Y);
            editBox.Show();
            editBox.Text = m_currentLVSubItem.Text;
            editBox.SelectAll();
            editBox.Focus();
        }
Beispiel #8
0
        private void CreateEditBox(object sender)
        {
            listBox      = (ListBox)sender;
            itemSelected = listBox.SelectedIndex;
            Rectangle r        = listBox.GetItemRectangle(itemSelected);
            string    itemText = (string)listBox.Items[itemSelected];

            editBox.Location  = new System.Drawing.Point(r.X + 30, r.Y);
            editBox.Size      = new System.Drawing.Size(r.Width - 150, r.Height - 20);
            editBox.MaxLength = 6;
            editBox.Show();
            listBox.Controls.AddRange(new Control[] { this.editBox });
            editBox.Text = itemText.Remove(0, 5);
            editBox.Focus();
            editBox.SelectAll();
            editBox.KeyPress  += new KeyPressEventHandler(this.EditOver);
            editBox.LostFocus += new EventHandler(this.FocusOver);
        }
 /// <summary> Perform any readonly functions specific to the
 /// implementation of abstract_Element. </summary>
 protected override void Inner_Set_Read_Only()
 {
     if (read_only)
     {
         thisSchemeBox.Enabled = false;
         thisSchemeBox.Hide();
         readonlySchemeBox.Show();
         thisKeywordBox.ReadOnly  = true;
         thisKeywordBox.BackColor = Color.WhiteSmoke;
     }
     else
     {
         thisSchemeBox.Enabled = true;
         thisSchemeBox.Show();
         readonlySchemeBox.Hide();
         thisKeywordBox.ReadOnly  = false;
         thisKeywordBox.BackColor = Color.White;
     }
 }
Beispiel #10
0
        private void CreateEditBox(object sender)
        {
            this.jvmOptionsListBox = (ListBox)sender;
            this.itemSelected      = this.jvmOptionsListBox.SelectedIndex;
            Rectangle r        = this.jvmOptionsListBox.GetItemRectangle(this.itemSelected);
            string    itemText = (string)this.jvmOptionsListBox.Items[this.itemSelected];

            editBox.Location = new System.Drawing.Point(r.X /*+ DELTA*/, r.Y /* + DELTA*/);
            editBox.Size     = new System.Drawing.Size(r.Width /*- 10*/, r.Height /* - DELTA*/);
            editBox.Show();
            this.jvmOptionsListBox.Controls.AddRange(new System.Windows.Forms.Control[] { this.editBox });
            editBox.Text = itemText;
            editBox.Focus();
            editBox.SelectAll();
            editBox.KeyPress  += new System.Windows.Forms.KeyPressEventHandler(this.EditOver);
            editBox.LostFocus += new System.EventHandler(this.FocusOver);

            this.saveConfig.Enabled = true;
        }
		public void StartEdit(BaseElement el, TextBox textBox)
		{
			if (!(el is ILabelElement)) return;

			if (((ILabelElement) el).Label.ReadOnly) return;

			this.siteLabelElement = el;
			this.labelElement = ((ILabelElement) siteLabelElement).Label;
			this.labelTextBox = textBox;
			if (siteLabelElement is BaseLinkElement)
				this.direction = LabelEditDirection.Both;
			else
				this.direction = LabelEditDirection.UpDown;
			
			EditLabelAction.SetTextBoxLocation(siteLabelElement, labelTextBox);

			labelTextBox.AutoSize = true;
			labelTextBox.Show();
			labelTextBox.Text = labelElement.Text;
			labelTextBox.Font = labelElement.Font;
			labelTextBox.WordWrap = labelElement.Wrap;
			
			labelElement.Invalidate();
			
			switch(labelElement.Alignment)
			{
				case StringAlignment.Near:
					labelTextBox.TextAlign = HorizontalAlignment.Left;
					break;
				case StringAlignment.Center:
					labelTextBox.TextAlign = HorizontalAlignment.Center;
					break;
				case StringAlignment.Far:
					labelTextBox.TextAlign = HorizontalAlignment.Right;
					break;
			}	

			labelTextBox.KeyPress += new KeyPressEventHandler(labelTextBox_KeyPress);
			labelTextBox.Focus();
			center.X = textBox.Location.X + (textBox.Size.Width / 2);
			center.Y = textBox.Location.Y + (textBox.Size.Height / 2);
		}
 /// <summary> Perform any readonly functions specific to the
 /// implementation of abstract_Element. </summary>
 protected override void Inner_Set_Read_Only()
 {
     if (read_only)
     {
         thisCodeBox.Enabled = false;
         thisCodeBox.Hide();
         readonlyCodeBox.Text = thisCodeBox.Text;
         readonlyCodeBox.Show();
         thisStatementBox.ReadOnly  = true;
         thisStatementBox.BackColor = Color.WhiteSmoke;
     }
     else
     {
         thisCodeBox.Enabled = true;
         thisCodeBox.Show();
         readonlyCodeBox.Hide();
         thisStatementBox.ReadOnly  = false;
         thisStatementBox.BackColor = Color.White;
     }
 }
Beispiel #13
0
        private void CreateEditBox(object sender)
        {
            controls.lb_speechAct = (ListBox)sender;
            if (controls.lb_speechAct == null || controls.lb_speechAct.Items == null || controls.lb_speechAct.Items.Count < 1)
            {
                return;
            }
            itemSelected = controls.lb_speechAct.SelectedIndex;
            Rectangle r = controls.lb_speechAct.GetItemRectangle(itemSelected);

            Constants.SpeechActs item = (Constants.SpeechActs)controls.lb_speechAct.Items[itemSelected];
            itemText         = item.Name;
            itemId           = item.Id;
            editBox.Location = new System.Drawing.Point(r.X + delta, r.Y + delta);
            editBox.Size     = new System.Drawing.Size(r.Width - 10, r.Height - delta);
            editBox.Show();
            controls.lb_speechAct.Controls.AddRange(new System.Windows.Forms.Control[] { this.editBox });
            editBox.Text = itemText;
            editBox.Focus();
            editBox.SelectAll();
            editBox.KeyPress  += new System.Windows.Forms.KeyPressEventHandler(this.EditOver);
            editBox.LostFocus += new System.EventHandler(this.FocusOver);
        }
 protected void createNewHexBox(object sender, System.EventArgs e)
 {
     hexBox = new TextBox();
     hexBox.Text = value.ToString("X2");
     hexBox.MaxLength = 2;
     hexBox.Parent = this;
     hexBox.KeyDown += updateHexValue;
     hexBox.Show();
     Parent.MouseClick += clickBesideHexBox;
 }
Beispiel #15
0
        private void refreshList()
        {
            int c = (int)numericUpDown1.Value;
            while (c < Names.Count)
            {
                Names[c].Dispose();
                Names.RemoveAt(c);
                Weights[c].Dispose();
                Weights.RemoveAt(c);
            }
            while (c > Names.Count)
            {
                TextBox box =   new TextBox();
                box.Parent  =   panelSubtasks;
                box.Left    =   10;
                box.Top     =   25 + 30 * Names.Count;
                box.Show();

                Names.Add(box);

                TrackBar bar =  new TrackBar();
                bar.Parent  =   panelSubtasks;
                bar.Left = box.Width + 20;
                bar.Top = 25 + 30 * Weights.Count;
                bar.Width = 200;

                bar.Minimum = 0;
                bar.Maximum = 100;
                bar.Value = 50;
                bar.BringToFront();
                bar.Show();

                bar.Scroll += new System.EventHandler(refreshBars);

                Weights.Add(bar);
            }

            bool b = checkBoxSameName.Checked;
            textBoxSubtasksName.Enabled = b;
            int i = 1;
            foreach (TextBox name in Names)
            {
                name.Enabled = !b;
                if (b) name.Text = textBoxSubtasksName.Text + ' ' + i.ToString();
                i++;
            }
        }
        private void lagreagar_Click_1(object sender, EventArgs e)
        {
            Label Telefono = new Label();
            TextBox tTelefono = new TextBox();

            Telefono.Text = this.lteléfono.Text;
            Telefono.Size = this.lteléfono.Size;
            Telefono.Location = new Point(this.lteléfono.Location.X,
                                          this.lista.Last<TextBox>().Location.Y + 50);

            tTelefono.Size = this.lTelefono.Size;
            tTelefono.Location = new Point(this.lTelefono.Location.X,
                                          this.lista.Last<TextBox>().Location.Y + 50);

            Telefono.Show();
            tTelefono.Show();

            lista.Add(tTelefono);
            labelList.Add(Telefono);

            tTelefono.KeyPress += textBox5_KeyPress;
            tTelefono.KeyPress += lTelefono_TextChanged;
            tTelefono.MaxLength = 10;
            panel2.Controls.Add(tTelefono);
            panel2.Controls.Add(Telefono);

            bloquear_Boton();
            bQuitar.Enabled = true;
        }
        private void lagreagar_Click(object sender, EventArgs e)
        {
            Label Telefono = new Label();
            TextBox tTelefono = new TextBox();

            Telefono.Text = this.lTelefono.Text;
            Telefono.Size = this.lTelefono.Size;
            Telefono.Location = new Point(this.lTelefono.Location.X,
                                          this.lista.Last<TextBox>().Location.Y + 50);

            tTelefono.Size = this.lTelefono.Size;
            tTelefono.Location = new Point(this.lTelefono.Location.X,
                                          this.lista.Last<TextBox>().Location.Y + 50);

            tTelefono.Show();
            Telefono.Show();

            lista.Add(tTelefono);

            tTelefono.KeyPress += textBox5_KeyPress;
            tTelefono.MaxLength = 10;
            panel2.Controls.Add(tTelefono);
            panel2.Controls.Add(Telefono);
        }
Beispiel #18
0
        void TrabajarConEncuesta(object sender, EventArgs e)
        {
            if (RBeditar.Checked == false && RBeliminar.Checked == false && RBmostrar.Checked == false)
            {
                MessageBox.Show("Debe seleccionar una opcion");
            }
            else
            {
                if (listaPublicaciones.SelectedRows.Count > 0 && RBeliminar.Checked == true)
                {
                    int filaSeleccionada = listaPublicaciones.CurrentRow.Index;

                    usuarioNL usuarioNL = new usuarioNL();
                    usuarioNL.borrarPublicacion(valor);
                    listaPublicaciones.Columns.Clear();
                    listaPublicaciones.DataSource = "";
                    CargarEncuesta();

                    MessageBox.Show("Eliminar!!!");
                }

                else if (listaPublicaciones.SelectedRows.Count > 0 && RBeditar.Checked == true)
                {
                    int filaSeleccionada = listaPublicaciones.CurrentRow.Index;

                    usuarioNL nl = new usuarioNL();

                    // Elementos ocultar
                    RBeditar.Hide();
                    RBeliminar.Hide();
                    RBmostrar.Hide();

                    lbContenidoTitulo.Hide();
                    lbContenido.Hide();
                    btnTrabajarPublicaciones.Hide();
                    listaPublicaciones.Hide();
                    btnAgregar.Hide();

                    //Mostrados
                    txtTituloUpdate.Show();
                    txtTituloUpdate.Text  = nl.CargarDataPublicacion(valor).titulo.ToString();
                    txtContenido.ReadOnly = false;

                    btnGuardarEdicion.Show();
                    btnCancelar.Show();
                }

                else if (listaPublicaciones.SelectedRows.Count > 0 && RBmostrar.Checked == true)
                {
                    int filaSeleccionada = listaPublicaciones.CurrentRow.Index;


                    usuarioNL nl = new usuarioNL();

                    lbContenidoFecha.Text    = "";
                    lbContenidoFecha.Text    = nl.CargarDataPublicacion(valor).fecha.ToString();
                    lbContenidoFecha.Visible = true;

                    lbContenidoTitulo.Text    = "";
                    lbContenidoTitulo.Text    = nl.CargarDataPublicacion(valor).titulo.ToString();
                    lbContenidoTitulo.Visible = true;

                    txtContenido.Text = "";
                    txtContenido.Text = nl.CargarDataPublicacion(valor).contenido.ToString();

                    RBeditar.Visible = true;
                }

                else
                {
                    MessageBox.Show("Debe seleccionar la columna pulsando en la columna a la izquierda del todo");
                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// Shows the player's score, whether they win/lose, and the top 10 on the leaderboard for the current level.
        /// </summary>
        /// <param name="sender">Reference to method that calls this event</param>
        /// <param name="e"></param>
        public void results(object sender, EventArgs e)
        {
            game.hideGameControls();

            int x         = gameMain.ActiveForm.Width;
            int x_textbox = 0;
            int x_button  = 0;
            int x_win     = 0;


            //Creates a panel for results of the game to show
            panel_results           = new Panel();
            panel_results.Dock      = System.Windows.Forms.DockStyle.Fill;
            panel_results.Location  = new System.Drawing.Point(0, 0);
            panel_results.Size      = new System.Drawing.Size(gameMain.ActiveForm.Width, gameMain.ActiveForm.Height);//THROWS ERROR EXCEPTION
            panel_results.Visible   = true;
            panel_results.BackColor = Color.AntiqueWhite;

            //Creates a label for player's final score
            label_score           = new Label();
            label_score.AutoSize  = true;
            label_score.BackColor = System.Drawing.Color.Transparent;
            label_score.Text      = "Score: " + gamePlay.score.ToString();
            label_score.Font      = new System.Drawing.Font("Comic Sans MS", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            label_score.Location  = new System.Drawing.Point(0, 0);//66, 114
            label_score.Name      = "label_score";
            label_score.Visible   = true;


            //Indicates whether the player reached the needed score to move on
            label_win_lose           = new Label();
            label_win_lose.AutoSize  = true;
            label_win_lose.BackColor = System.Drawing.Color.Transparent;
            label_win_lose.Font      = new System.Drawing.Font("Comic Sans MS", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            label_win_lose.ForeColor = System.Drawing.Color.Red;
            //x_win = ((x/2) - (label_win_lose.Width/2));
            label_win_lose.Location  = new System.Drawing.Point(212, 100);
            label_win_lose.Name      = "label_win_lose";
            this.label_win_lose.Size = new System.Drawing.Size(286, 86);


            //Creates a button for the player to return the game modes page
            button_return          = new Button();
            button_return.AutoSize = true;
            button_return.Size     = new System.Drawing.Size(100, 50); //200, 100
            button_return.Location = new Point(100, 650);              //100, 400
            button_return.Text     = "Return";
            button_return.Font     = new System.Drawing.Font("Comic Sans MS", 26F, FontStyle.Bold);
            button_return.Click   += new EventHandler(button_start_Click);

            //Creates a button for the player to move onto the next levels
            button_continue          = new Button();
            button_continue.AutoSize = true;
            button_continue.Size     = new System.Drawing.Size(100, 50); //200, 100
            button_continue.Location = new Point(400, 650);              //400, 400
            button_continue.Text     = "Continue";
            button_continue.Font     = new System.Drawing.Font("Comic Sans MS", 26F, FontStyle.Bold);

            //Creates TextBox for leadboard name entry
            textbox_leaderboard = new TextBox();
            //x_textbox = (x - textbox_leaderboard.Width) / 2;
            textbox_leaderboard.Name     = "textbox_leaderboard";
            textbox_leaderboard.Size     = new System.Drawing.Size(350, 150);
            textbox_leaderboard.TabIndex = 0;
            textbox_leaderboard.Font     = new System.Drawing.Font("Microsoft Sans Serif", 20F);
            textbox_leaderboard.Location = new System.Drawing.Point(180, 400);

            // this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);

            //Creates a button to save name for leaderboard
            button_leaderboard_name_save          = new Button();
            button_leaderboard_name_save.AutoSize = true;
            //x_button = (x - button_leaderboard_name_save.Width) / 2;
            button_leaderboard_name_save.Size     = new System.Drawing.Size(100, 50);
            button_leaderboard_name_save.Text     = "Submit";
            button_leaderboard_name_save.Font     = new System.Drawing.Font("Comic Sans MS", 26F, FontStyle.Bold);
            button_leaderboard_name_save.Location = new Point(305, 450);
            button_leaderboard_name_save.Click   += new EventHandler(save_name);


            //Creates a listBox for the top 5 leaderboard
            listBox_leaderboard = new ListBox();
            listBox_leaderboard.FormattingEnabled = true;
            listBox_leaderboard.Location          = new System.Drawing.Point(251, 200);
            listBox_leaderboard.Name     = "listBox_leaderboard";
            listBox_leaderboard.Size     = new System.Drawing.Size(200, 200);
            listBox_leaderboard.TabIndex = 0;
            listBox_leaderboard.Font     = new System.Drawing.Font("Comic Sans MS", 16F, FontStyle.Bold);


            //Add all created controls to panel
            panel_results.Controls.Add(button_return);
            panel_results.Controls.Add(button_continue);
            panel_results.Controls.Add(label_score);
            panel_results.Controls.Add(label_win_lose);
            panel_results.Controls.Add(button_leaderboard_name_save);
            panel_results.Controls.Add(textbox_leaderboard);
            panel_results.Controls.Add(listBox_leaderboard);

            //Add Panel to form
            this.Controls.Add(panel_results);
            label_win_lose.Show();
            label_score.Show();
            this.panel_results.BringToFront();

            //Depending on the player's score, it will say either they won or lost
            int passingScore = 1000;

            if (gamePlay.score >= passingScore)
            {
                label_win_lose.Text = "You Win!";

                //System.Media.SoundPlayer player = new System.Media.SoundPlayer(global::Mustache_ic___V2.Properties.Resources.WINNER);
                //player.Play();
                listBox_leaderboard.Hide();
                button_leaderboard_name_save.Show();
                textbox_leaderboard.Show();
            }
            else
            {
                label_win_lose.Text = "You Lose!";
                button_leaderboard_name_save.Hide();
                textbox_leaderboard.Hide();
                //listBox_leaderboard.Hide();
                //System.Media.SoundPlayer player = new System.Media.SoundPlayer(global::Mustache_ic___V2.Properties.Resources.Price_Is_Right_loser_clip);
                //player.Play();
                get_leaderboard();
            }
        }
Beispiel #20
0
        // Yeah, yeah, so I should probably make this accept params. We'll see if it happens later on. 
        private void populateUsers()
        {
            // Also shoutout to automatic definition handling 
            // Ah, C#, it's great to be here again.

            // Go through each user
            // (could have also used the count from anything else that holds a user property)
            for (int i = 0; i < Properties.Settings.Default.username.Count; i++)
            {

                int t = 0;
                
                Panel uA = new Panel();
                uA.Show();
                uA.BackColor = Color.White;
                //uA.BackColor = Color.FromName(Properties.Settings.Default.custColor[i]);
                uA.Left = 0;
                uA.Width = this.Width;
                uA.Height = 50;
                uA.Margin = new Padding(0, 2, 0, 0);
                
                userList.Controls.Add(uA);

                PictureBox pImg = new PictureBox();
                pImg.Image = Image.FromFile(Properties.Settings.Default.userimgacc_path[i]);
                pImg.Left = 0;
                pImg.Width = 50;
                pImg.Height = 50;
                pImg.Dock = DockStyle.Left;
                pImg.BackColor = Color.White;
                pImg.SizeMode = PictureBoxSizeMode.Zoom;
                
                Label turnip = new Label();
                turnip.Show();
                turnip.BackColor = Color.Transparent;
                turnip.AutoEllipsis = true;
                turnip.Left = 64;
                turnip.Width = this.Width - 64 - 50;
                turnip.Height = 50;
                turnip.Top = 0;
                turnip.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 11);
                turnip.ForeColor = Color.DimGray;
                //turnip.ForeColor = Color.White;
                turnip.TextAlign = ContentAlignment.MiddleLeft;
                turnip.Text = Properties.Settings.Default.username[i];

                uA.Controls.Add(pImg);
                uA.Controls.Add(turnip);

                Button dl = new Button();
                dl.Show();
                dl.BackColor = Color.Firebrick;
                
                dl.Width = 50;
                dl.Left = uA.Width - 50;
                dl.Height = 50;
                dl.Dock = DockStyle.Right;

                dl.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 11);
                dl.ForeColor = Color.White;
                dl.TextAlign = ContentAlignment.MiddleCenter;
                dl.Text = "X";

                dl.FlatStyle = FlatStyle.Flat;
                dl.FlatAppearance.BorderSize = 0;
                
                uA.Controls.Add(dl);

                // Shhhhhhhhhhh hidden controls

                Label toDel = new Label();

                toDel.Show();
                toDel.BackColor = Color.Transparent;
                toDel.AutoEllipsis = true;
                toDel.Left = 64;
                toDel.Width = this.Width - 64 - 50;
                toDel.Height = 18;
                toDel.Top = 50;
                toDel.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 11);
                toDel.ForeColor = Color.Red;
                toDel.TextAlign = ContentAlignment.MiddleLeft;
                toDel.Text = "To delete this account, enter the password:"******"PSR002: User data incorrectly populated for matching with user element.");
                            ts.Show();
                            ts.BringToFront();
                        }
                        else if (pBox.Text == Properties.Settings.Default.woahThereHello[t])
                        {
                            
                            Properties.Settings.Default.custColor.RemoveAt(t);
                            Properties.Settings.Default.lock_path.RemoveAt(t);
                            Properties.Settings.Default.loggedIn.RemoveAt(t);
                            Properties.Settings.Default.nickname.RemoveAt(t);
                            Properties.Settings.Default.space_back_path.RemoveAt(t);
                            Properties.Settings.Default.userimgacc_path.RemoveAt(t);
                            Properties.Settings.Default.username.RemoveAt(t);
                            Properties.Settings.Default.woahThereHello.RemoveAt(t);
                            Properties.Settings.Default.fontsOfScience.RemoveAt(t);
                            Properties.Settings.Default.darkerFontsOfScience.RemoveAt(t);
                            Properties.Settings.Default.Save();

                            try
                            {
                                System.IO.Directory.Delete(@"C:\ProjectSnowshoes\User\" + turnip.Text, true); // Note that we have to use this as a source for username, since we removed it from Settings earlier.
                            }
                            catch (Exception ex)
                            {
                                // This is a terrible way to do error reporting...knowing that errors might occur here if there's a problem with accounts not having actual files
                                // Hey, all that's not going to be a problem in Escape though, since we are getting away from VC# settings...and VC# for the most part as well.
                                TheScreenIsBlue ts = new TheScreenIsBlue("PSR003: User information removed, but files damaged or missing for requested username (" + ex.HResult + ").");
                                ts.Show();
                                ts.BringToFront();
                            }

                            goBackJack();
                        }
                        else
                        {
                            pBox.Text = "";
                            toDel.Text = "That won't work. Try something else.";
                        }
                    }
                };

            }
        }
Beispiel #21
0
        public DialogResult AddWord()
        {
            Form wordForm = new Form();
            wordForm.StartPosition = FormStartPosition.CenterScreen;
            wordForm.FormBorderStyle = FormBorderStyle.Fixed3D;
            wordForm.Size = new Size(250, 180);
            wordForm.MinimizeBox = false;
            wordForm.MaximizeBox = false;
            wordForm.Text = "Новое слово";

            Label wordLabel = new Label();
            wordLabel.Location = new Point(10, 10);
            wordLabel.AutoSize = false;
            wordLabel.Size = new Size(230, 25);
            wordLabel.Font = new Font("Times New Roman", 12, FontStyle.Bold);
            wordLabel.Text = "Слово: ";

            Label translateLabel = new Label();
            translateLabel.Location = new Point(10, 60);
            translateLabel.AutoSize = false;
            translateLabel.Size = new Size(230, 25);
            translateLabel.Font = new Font("Times New Roman", 12, FontStyle.Bold);
            translateLabel.Text = "Перевод: ";

            wordTextBox = new TextBox();
            wordTextBox.Location = new Point(10, 35);
            wordTextBox.Size = new Size(215, 25);
            wordTextBox.Text = null;

            translateTextBox = new TextBox();
            translateTextBox.Location = new Point(10, 85);
            translateTextBox.Size = new Size(215, 25);
            translateTextBox.Text = null;

            Button okButton = new Button();
            okButton.Location = new Point(80, 115);
            okButton.Size = new Size(70, 25);
            okButton.DialogResult = DialogResult.OK;
            okButton.Text = "OK";

            Button cancelButton = new Button();
            cancelButton.Location = new Point(155, 115);
            cancelButton.Size = new Size(70, 25);
            cancelButton.DialogResult = DialogResult.Cancel;
            cancelButton.Text = "Cancel";

            wordForm.Controls.Add(wordLabel);
            wordForm.Controls.Add(translateLabel);
            wordForm.Controls.Add(wordTextBox);
            wordForm.Controls.Add(translateTextBox);
            wordForm.Controls.Add(okButton);
            wordForm.Controls.Add(cancelButton);
            wordLabel.Show();
            translateLabel.Show();
            wordTextBox.Show();
            translateTextBox.Show();
            okButton.Show();
            cancelButton.Show();
            wordForm.ShowDialog();

            return wordForm.DialogResult;
        }
Beispiel #22
0
        protected override void OnDoubleClick(EventArgs e)
        {
            base.OnDoubleClick(e);
            if (currentListItem == null)
            {
                return;
            }


            // Check the subitem clicked .
            try
            {
                int nStart = lastX;
                int spos   = 0;
                int epos   = Columns[0].Width;
                for (int i = 0; i < this.Columns.Count; i++)
                {
                    if (nStart > spos && nStart < epos)
                    {
                        subItemSelected = i;
                        break;
                    }

                    spos  = epos;
                    epos += this.Columns[i + 1].Width;
                }

                //Console.WriteLine("SUB ITEM SELECTED = " + currentListItem.SubItems[subItemSelected].Text);
                subItemText = currentListItem.SubItems[subItemSelected].Text;

                //this causes a problem if the value is empty
                string colName = this.Columns[subItemSelected].Text;
                RaiseBeforeTaskChanged(GetTask(currentListItem.Index));
                //TODO: can this be generalized or made available in design mode?
                if (colName == "Status")
                {
                    Rectangle r = new Rectangle(spos, currentListItem.Bounds.Y, epos, currentListItem.Bounds.Bottom);
                    cmbBox.Size     = new System.Drawing.Size(epos - spos, currentListItem.Bounds.Bottom - currentListItem.Bounds.Top);
                    cmbBox.Location = new System.Drawing.Point(spos + 2, currentListItem.Bounds.Y + 1);
                    cmbBox.Visible  = true;
                    cmbBox.Show();
                    cmbBox.Text = subItemText;
                    cmbBox.SelectAll();
                    cmbBox.Focus();
                }
                else
                {
                    Rectangle r = new Rectangle(spos, currentListItem.Bounds.Y, epos, currentListItem.Bounds.Bottom);
                    editBox.Size     = new System.Drawing.Size(epos - spos, currentListItem.Bounds.Bottom - currentListItem.Bounds.Top);
                    editBox.Location = new System.Drawing.Point(spos + 2, currentListItem.Bounds.Y + 1);
                    editBox.Visible  = true;
                    editBox.Show();
                    editBox.Text = subItemText;
                    editBox.SelectAll();
                    editBox.Focus();
                }
                currentListItem.Checked = !currentListItem.Checked;                 //seems double-clicking switches the check state
            }
            catch (Exception exc)
            {
            }
        }
Beispiel #23
0
 private void bserr_Click(object sender, EventArgs e)
 {
     Form form = new Form();
     form.StartPosition = FormStartPosition.Manual;
     form.Width = base.Width;
     form.Height = base.Height / 4;
     form.Location = this.bserr.PointToScreen(new Point(0, this.bserr.Height));
     form.FormBorderStyle = FormBorderStyle.SizableToolWindow;
     form.Text = "Error message from analiser";
     form.Show(this);
     TextBox textBox = new TextBox();
     textBox.BorderStyle = BorderStyle.None;
     textBox.Multiline = true;
     textBox.Parent = form;
     textBox.Dock = DockStyle.Fill;
     textBox.ScrollBars = ScrollBars.Vertical;
     textBox.BackColor = Color.FromKnownColor(KnownColor.Info);
     textBox.ForeColor = Color.FromKnownColor(KnownColor.InfoText);
     textBox.Text = ((Exception)this.bserr.Tag).ToString();
     textBox.Show();
     Button button = new Button();
     button.Click += new EventHandler(this.buttonCloseMe_Click);
     button.Parent = form;
     button.Text = "Close!";
     form.AcceptButton = button;
     form.CancelButton = button;
     form.Activate();
     textBox.Select();
     textBox.SelectAll();
 }
            public CompletionToolTipWindow(ListBox completions,TextBox documentation)
            {
                _completions = completions;
                _documentation = documentation;

                FormBorderStyle = FormBorderStyle.None;
                StartPosition = FormStartPosition.Manual;
                TopMost = true;
                ShowInTaskbar = false;
                BackColor = Color.White;
                Opacity = 0.9;

                Controls.Add(completions);
                Controls.Add(documentation);

                Width = completions.PreferredSize.Width;
                Height = completions.Height + documentation.Height;
                completions.Width = Width;
                documentation.Width = Width;
                documentation.Location = new Point(completions.Location.X,completions.Location.Y + completions.Height);

                completions.Show();
                documentation.Show();
            }
        private void BuildSudokuTable()
        {
            cells = new TextBox[Program.TABLEWIDTH, Program.TABLEHEIGHT];

            int yCellOffset = 1;
            int xCellOffset = 1;

            int hMargin = 2;
            int vMargin = 0;

            int hlineCellsCounter = 1;
            int vLineCellsCounter = 1;

            for (int i = 0; i < Program.TABLEWIDTH; i++)
            {
                for (int j = 0; j < Program.TABLEHEIGHT; j++)
                {
                    TextBox cell = new TextBox();

                    cell.Parent = panelSudokuTable;
                    cell.BorderStyle = BorderStyle.FixedSingle;
                    cell.Location = new Point(40 * (xCellOffset - 1) + hMargin - 1, 30 * (yCellOffset - 1) + vMargin + 1);
                    cell.Width = 40;
                    cell.Height = 0;
                    cell.TextAlign = HorizontalAlignment.Center;
                    cell.MaxLength = 1;
                    cell.Font = Program.cellsFont;
                    cell.TextChanged += new EventHandler(cell_TextChanged);
                    cell.Show();

                    cells[i, j] = cell;

                    if (hlineCellsCounter % Program.CELLRANKGROUP == 0)
                        hMargin = hMargin + 2;

                    hlineCellsCounter++;
                    xCellOffset++;
                }
                if (vLineCellsCounter % Program.CELLRANKGROUP == 0)
                    vMargin = vMargin + 1;

                vLineCellsCounter++;
                hlineCellsCounter = 1;
                xCellOffset = 1;
                yCellOffset++;
                hMargin = 2;
            }
            cellsRank = Program.MAXVALUE;

            panelSudokuTable.Width = cells[Program.TABLEWIDTH - 1, Program.TABLEWIDTH - 1].Right + 1;
            panelSudokuTable.Height = cells[Program.TABLEHEIGHT - 1, Program.TABLEHEIGHT - 1].Bottom + 1;

            this.Width = panelSudokuTable.Width + 62;
            this.Height = panelSudokuTable.Height + 188;

            panelSudokuTable.Location = new Point(((groupBox1.Width - panelSudokuTable.Width) / 2),
            ((groupBox1.Height - panelSudokuTable.Height) / 2) + 3 );
        }
        private void cboCriteriaID_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.lblID.Text = cboCriteriaID.Text;

            CriteriaRequester cReq = (CriteriaRequester)this.CriteriaList[this.cboCriteriaID.Text];

            this.pnlCriteriaInput.Controls.Clear();

            if (cReq.CritType == CriteriaRequester.CriteriaType.Text)
            {
                TextBox txtSearchCriteriaInput = new TextBox();
                this.pnlCriteriaInput.Controls.Add(txtSearchCriteriaInput);
                txtSearchCriteriaInput.Width = this.pnlCriteriaInput.Width - 10;
                txtSearchCriteriaInput.Show();
                this.CurrentInputObject = txtSearchCriteriaInput;
            }
            else if (cReq.CritType == CriteriaRequester.CriteriaType.DropDown)
            {
                ComboBox cBox = new ComboBox();
                this.pnlCriteriaInput.Controls.Add(cBox);
                cBox.Width = this.pnlCriteriaInput.Width - 10;
                cBox.DropDownStyle = ComboBoxStyle.DropDownList;

                foreach (String ID in cReq.DropDownContent)
                {
                    cBox.Items.Add(ID);
                }

                cBox.Show();
                this.CurrentInputObject = cBox;
            }

            this.cboLogic_SelectedIndexChanged(this, new EventArgs());
        }
Beispiel #27
0
        private void EditListView_MouseDown(object sender, MouseEventArgs e)
        {
            int mx = e.X;

            lvItem_ = this.GetItemAt(2, e.Y);
            if (lvItem_ == null)
            {
                if (this.Items.Count <= 0)
                {
                    lvItem_ = addItemWithSubItems("");
                }
                else if (!this.Items[this.Items.Count - 1].Text.Equals(""))
                {
                    lvItem_ = addItemWithSubItems("");
                }
                else
                {
                    lvItem_ = this.Items[this.Items.Count - 1];
                }
            }

            int x1 = 0;
            int x2 = this.Columns[0].Width;

            subItemSelected_ = 0;
            if (mx >= x2)
            {
                for (int i = 1; i < this.Columns.Count; i++)
                {
                    x1  = x2;
                    x2 += this.Columns[i].Width;
                    if (mx < x2)
                    {
                        subItemSelected_ = i;
                        break;
                    }
                }
            }
            x1          += 2;
            subItemText_ = lvItem_.SubItems[subItemSelected_].Text;
            string colName = this.Columns[subItemSelected_].Text;

            if (colName.Equals("Type"))
            {
                comboBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height - 2);
                comboBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                comboBox_.Show();
                comboBox_.Text = subItemText_;
                comboBox_.SelectAll();
                comboBox_.Focus();
            }
            else
            {
                editBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height);
                editBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                editBox_.Show();
                editBox_.Text = subItemText_;
                editBox_.SelectAll();
                editBox_.Focus();
            }
        }
Beispiel #28
0
 void HideLinkShowText(LinkLabel link, TextBox text, TimeSpan length)
 {
     text.Text = App.TimeToStringHHMM(length);
     text.SelectAll();
     text.Show();
     text.Focus();
     link.Hide();
 }
Beispiel #29
0
        public bool AddPlayerCharacterToPanel()
        {
            if(GameManagement.playerCharacters.Count != 0)
            {
                int playerIndex = GameManagement.playerCharacters.Count-1;
                PlayerCharacter player = GameManagement.playerCharacters[playerIndex];

                if (this.PlayerCharacterPanel.Controls.Find("pcPanel" + player.name, true).Count() > 0)
                {
                    return false;
                }

                Panel pcPanel1 = new Panel();
                pcPanel1.Parent = this.PlayerCharacterPanel;

                Label CharNameDisp = new Label();
                Label RaceClassDisp = new Label();
                Button MoreInfoButton = new Button();
                Label ArmorClassDisp = new Label();
                Label LevelDisp = new Label();
                Label HPDisp = new Label();
                Button DamageBtn = new Button();
                Button HealButton = new Button();
                TextBox HPModTextBox = new TextBox();

                //
                // pcPanel1
                //
                pcPanel1.Controls.Add(DamageBtn);
                pcPanel1.Controls.Add(HealButton);
                pcPanel1.Controls.Add(HPModTextBox);
                pcPanel1.Controls.Add(MoreInfoButton);
                pcPanel1.Controls.Add(ArmorClassDisp);
                pcPanel1.Controls.Add(LevelDisp);
                pcPanel1.Controls.Add(HPDisp);
                pcPanel1.Controls.Add(RaceClassDisp);
                pcPanel1.Controls.Add(CharNameDisp);
                pcPanel1.Location = new System.Drawing.Point(3, 3);
                pcPanel1.Name = "pcPanel" + player.name;
                pcPanel1.Size = new System.Drawing.Size(219, 82);
                pcPanel1.TabIndex = 0;

                //
                // CharNameDisp
                //
                CharNameDisp.AutoSize = true;
                CharNameDisp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
                CharNameDisp.Location = new System.Drawing.Point(2, 5);
                CharNameDisp.Name = "CharNameDisp" + playerIndex;
                CharNameDisp.Size = new System.Drawing.Size(91, 20);
                CharNameDisp.TabIndex = 0;
                CharNameDisp.Text = player.name;
                CharNameDisp.Parent = pcPanel1;
                CharNameDisp.Show();

                //
                // RaceClassDisp
                //
                RaceClassDisp.AutoSize = true;
                RaceClassDisp.Location = new System.Drawing.Point(5, 39);
                RaceClassDisp.Name = "RaceClassDisp" + playerIndex;
                RaceClassDisp.Size = new System.Drawing.Size(70, 13);
                RaceClassDisp.TabIndex = 1;

                if(player.subClass == null)
                {
                    RaceClassDisp.Text = String.Format("{0}, {1}", player.race, player.primaryClass);
                }
                else
                {
                    RaceClassDisp.Text = String.Format("{0}, {1}/{2}", player.race, player.primaryClass, player.subClass);
                }

                RaceClassDisp.Parent = pcPanel1;
                RaceClassDisp.Show();

                //
                // HPDisp
                //
                HPDisp.AutoSize = false;
                HPDisp.Location = new System.Drawing.Point(139, 39);
                HPDisp.Name = "HPDisp" + playerIndex;
                HPDisp.Size = new System.Drawing.Size(77, 13);
                HPDisp.TabIndex = 2;
                HPDisp.Text = String.Format("HP: {0}/{1}", player.currentHitPoints, player.hitPoints);
                HPDisp.TextAlign = ContentAlignment.MiddleRight;
                HPDisp.Parent = pcPanel1;
                HPDisp.Show();

                //
                // LevelDisp
                //
                LevelDisp.AutoSize = true;
                LevelDisp.Location = new System.Drawing.Point(5, 26);
                LevelDisp.Name = "LevelDisp" + playerIndex;
                LevelDisp.Size = new System.Drawing.Size(45, 13);
                LevelDisp.TabIndex = 3;
                LevelDisp.Text = String.Format("Level: {0}", player.primaryClassLevel);
                LevelDisp.Parent = pcPanel1;
                LevelDisp.Show();

                //
                // ArmorClassDisp
                //
                ArmorClassDisp.AutoSize = false;
                ArmorClassDisp.Location = new System.Drawing.Point(139, 26);
                ArmorClassDisp.Name = "ArmorClassDisp" + playerIndex;
                ArmorClassDisp.Size = new System.Drawing.Size(77, 13);
                ArmorClassDisp.TabIndex = 4;
                ArmorClassDisp.Text = String.Format("AC: {0}", player.armorClass);
                ArmorClassDisp.TextAlign = ContentAlignment.MiddleRight;
                ArmorClassDisp.Parent = pcPanel1;
                ArmorClassDisp.Show();

                //
                // MoreInfoButton
                //
                MoreInfoButton.Location = new System.Drawing.Point(8, 55);
                MoreInfoButton.Name = "MoreInfoButton" + playerIndex;
                MoreInfoButton.Size = new System.Drawing.Size(35, 24);
                MoreInfoButton.TabIndex = 5;
                MoreInfoButton.Text = "...";
                MoreInfoButton.UseVisualStyleBackColor = true;
                MoreInfoButton.Parent = pcPanel1;
                MoreInfoButton.Show();

                //
                // HealButton
                //
                HealButton.Location = new System.Drawing.Point(131, 55);
                HealButton.Name = "HealButton" + playerIndex;
                HealButton.Size = new System.Drawing.Size(20, 24);
                HealButton.TabIndex = 7;
                HealButton.Text = "+";
                HealButton.UseVisualStyleBackColor = true;
                HealButton.Parent = pcPanel1;
                HealButton.Click += new System.EventHandler(this.HealPlayerButton_Click);
                HealButton.Show();

                //
                // DamageBtn
                //
                DamageBtn.Location = new System.Drawing.Point(196, 55);
                DamageBtn.Name = "DamageBtn" + playerIndex;
                DamageBtn.Size = new System.Drawing.Size(20, 24);
                DamageBtn.TabIndex = 8;
                DamageBtn.Text = "-";
                DamageBtn.UseVisualStyleBackColor = true;
                DamageBtn.Parent = pcPanel1;
                DamageBtn.Click += new System.EventHandler(this.DamagePlayerButton_Click);
                DamageBtn.Show();

                //
                // HPModTextBox
                //
                HPModTextBox.Location = new System.Drawing.Point(152, 55);
                HPModTextBox.Name = "HPModTextBox" + playerIndex;
                HPModTextBox.Size = new System.Drawing.Size(43, 25);
                HPModTextBox.TabIndex = 6;
                HPModTextBox.Parent = pcPanel1;
                HPModTextBox.Show();

                //Cleanup
                CharNameDisp = null;
                RaceClassDisp = null;
                MoreInfoButton = null;
                ArmorClassDisp = null;
                LevelDisp = null;
                HPDisp = null;
                DamageBtn = null;
                HealButton = null;
                HPModTextBox = null;
            }

            return true;
        }
        private void BeginEditing()
        {
            EndEditing(true);
            _editing = true;
            if (_editingIndex != -1)
            {
                _txtInclude = new TextBox();
                _txtInclude.Leave += txtInclude_Leave;
                _txtInclude.Text = includeList.Items[includeList.SelectedIndex].ToString();
                _editingIncludeDir = _txtInclude.Text;
                includeList.SelectionMode = SelectionMode.One;

                Rectangle rect = includeList.GetItemRectangle(includeList.SelectedIndex);
                _txtInclude.Location = new Point(includeList.Location.X + 2,
                                                 includeList.Location.Y + rect.Y);
                _txtInclude.Width = includeList.Width - 50;
                _txtInclude.Parent = includeList;
                _txtInclude.KeyUp += new KeyEventHandler(txtInclude_KeyUp);
                groupBox1.Controls.Add(_txtInclude);

                _btnSelectInclude = new Button();
                _btnSelectInclude.Text = "...";
                _btnSelectInclude.Location = new Point(includeList.Location.X + _txtInclude.Width,
                                                       includeList.Location.Y + rect.Y);
                _btnSelectInclude.Width = 50;
                _btnSelectInclude.Height = _txtInclude.Height;
                _btnSelectInclude.Click += new EventHandler(btnSelectInclude_Clicked);
                groupBox1.Controls.Add(_btnSelectInclude);


                _txtInclude.Show();
                _txtInclude.BringToFront();
                _txtInclude.Focus();

                _btnSelectInclude.Show();
                _btnSelectInclude.BringToFront();
            }
        }
Beispiel #31
0
 private void logButton_Click(object sender, EventArgs e)
 {
     if (splitContainer2.Panel1.Controls.Count > 0 && splitContainer2.Panel1.Controls[0] is TextBox)
     {
         ClearScreen();
     }
     else
     {
         View.DisposeAndClearPanel(splitContainer2.Panel1);
         TextBox box = new TextBox()
         {
             Multiline = true,
             Left = 0,
             Top = 0,
             Size = splitContainer2.Panel1.Size,
             ScrollBars = ScrollBars.Vertical
         };
         splitContainer2.Panel1.Controls.Add(box);
         box.Show();
         box.AppendText(logData.ToString());
     }
 }
        public void LoadSearchConfig(String EditConfigFile)
        {
            this.ConfigFile = EditConfigFile;

            if (!File.Exists(this.ConfigFile))
                return;

            using (StreamReader sr = new StreamReader(this.ConfigFile))
            {
                String line;
                int cLine = 0;
                // Read and display lines from the file until the end of
                // the file is reached.
                while ((line = sr.ReadLine()) != null)
                {
                    cLine++;

                    if ((cLine == 1) && (line != "editor.config.begin"))
                        return; /* invalid or corrupt config file */

                    string[] cfgLine = line.Split('^');

                    if (cfgLine[0] == "set.editor.title")
                    {
                        this.EditorTitle = cfgLine[1];
                    }

                    //configure.editor.window^636^458
                    if (cfgLine[0] == "configure.editor.window")
                    {
                        this.EditorWidth = int.Parse(cfgLine[1]);
                        this.EditorHeight = int.Parse(cfgLine[2]);
                    }

                    if (cfgLine[0] == "add.tab")
                    {
                        // add.tab^TabTitle^canselect yes or no
                        //cfgLine[1];
                        TabPage tPage = new TabPage(cfgLine[1]);
                        this.EditorTabs.Add(cfgLine[1], tPage);
                    }

                    if (cfgLine[0] == "add.button")
                    {
                        //# add.button^id^tabpage^width^height^top^left^value^function
                        //# function can be -   savetodb ,  or closeeditor

                        //add.button^close^General^25^20^100^100^Close^closeeditor
                        TabPage tPage = (TabPage)this.EditorTabs[cfgLine[2]];

                        if (tPage == null)
                            return;

                        Button cmdButton = new Button();

                        cmdButton.Width = int.Parse(cfgLine[3]);
                        cmdButton.Height = int.Parse(cfgLine[4]);

                        cmdButton.Name = cfgLine[1];

                        tPage.Controls.Add(cmdButton);

                        cmdButton.Top = int.Parse(cfgLine[5]);
                        cmdButton.Left = int.Parse(cfgLine[6]);

                        cmdButton.Text = cfgLine[7];

                        cmdButton.Tag = cfgLine[8];

                        cmdButton.Show();

                        cmdButton.Click += new EventHandler(cmdButton_Click);

                    }
                    if (cfgLine[0] == "add.label")
                    {
                        // add.label^id^tabpage^width^height^top^left^value
                        TabPage tPage = (TabPage)this.EditorTabs[cfgLine[2]];

                        if (tPage == null)
                            return;

                        Label lblNew = new Label();

                        lblNew.Width = int.Parse(cfgLine[3]);
                        lblNew.Height = int.Parse(cfgLine[4]);

                        lblNew.Name = cfgLine[1];

                        tPage.Controls.Add(lblNew);

                        lblNew.Top = int.Parse(cfgLine[5]);
                        lblNew.Left = int.Parse(cfgLine[6]);

                        lblNew.Text = cfgLine[7];

                        lblNew.Show();

                    }
                    if (cfgLine[0] == "add.input.control")
                    {
                        // add.input.control^type^id^tabpage^width^height^top^left^dbfield^default value

                        TabPage tPage = (TabPage)this.EditorTabs[cfgLine[3]];

                        if (tPage == null)
                            return;

                        if (cfgLine[1] == "text")
                        {
                            TextBox tBox = new TextBox();

                            tBox.Width = int.Parse(cfgLine[4]);
                            tBox.Height = int.Parse(cfgLine[5]);

                            tBox.Tag = cfgLine[8];
                            tBox.Name = cfgLine[2];

                            tPage.Controls.Add(tBox);

                            tBox.Top = int.Parse(cfgLine[6]);
                            tBox.Left = int.Parse(cfgLine[7]);

                            tBox.Text = cfgLine[9];

                            tBox.Show();

                        }
                        else if (cfgLine[1] == "dropdown")
                        {

                        }
                        else if (cfgLine[1] == "checkbox")
                        {

                        }

                    }

                }
            }
        }
Beispiel #33
0
        private void beginEditIncludeDir()
        {
            if(_editingIncludes)
            {
                endEditIncludeDir(true);
            }
            _editingIncludes = true;
            _dialog.unsetCancelButton();
            if(_editingIndex != -1)
            {
                _txtIncludeDir = new TextBox();
                _txtIncludeDir.Text = sliceIncludeList.Items[sliceIncludeList.SelectedIndex].ToString();
                _editingIncludeDir = _txtIncludeDir.Text;
                sliceIncludeList.SelectionMode = SelectionMode.One;

                Rectangle rect = sliceIncludeList.GetItemRectangle(sliceIncludeList.SelectedIndex);
                _txtIncludeDir.Location = new Point(sliceIncludeList.Location.X + 2,
                                                    sliceIncludeList.Location.Y + rect.Y);
                _txtIncludeDir.Width = sliceIncludeList.Width - 50;
                _txtIncludeDir.Parent = sliceIncludeList;
                _txtIncludeDir.KeyDown += new KeyEventHandler(includeDirKeyDown);
                _txtIncludeDir.KeyUp += new KeyEventHandler(includeDirKeyUp);
                groupBox1.Controls.Add(_txtIncludeDir);

                _btnSelectInclude = new Button();
                _btnSelectInclude.Text = "...";
                _btnSelectInclude.Location = new Point(sliceIncludeList.Location.X + _txtIncludeDir.Width,
                                                       sliceIncludeList.Location.Y + rect.Y);
                _btnSelectInclude.Width = 49;
                _btnSelectInclude.Height = _txtIncludeDir.Height;
                _btnSelectInclude.Click += new EventHandler(selectIncludeClicked);
                groupBox1.Controls.Add(_btnSelectInclude);

                _txtIncludeDir.Show();
                _txtIncludeDir.BringToFront();
                _txtIncludeDir.Focus();

                _btnSelectInclude.Show();
                _btnSelectInclude.BringToFront();
            }
        }
        private void cboLogic_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cboLogic.Text == "BETWEEN")
            {
                /* make an exact copy of the current input control and place it next to the other */

                if (this.CurrentInputObject.GetType() == typeof(TextBox))
                {
                    TextBox tBox1 = (TextBox)this.CurrentInputObject;
                    TextBox tBox2 = new TextBox();

                    tBox1.Width = (this.pnlCriteriaInput.Width - 10) / 2;
                    tBox2.Width = (this.pnlCriteriaInput.Width - 10) / 2;

                    tBox2.Left = tBox1.Left + tBox1.Width + 5;

                    this.CurrentInputObject2 = tBox2;

                    this.pnlCriteriaInput.Controls.Add(tBox2);
                    tBox2.Show();
                }
                else if (this.CurrentInputObject.GetType() == typeof(ComboBox))
                {
                    ComboBox cBox1 = (ComboBox)this.CurrentInputObject;
                    ComboBox cBox2 = new ComboBox();

                    cBox1.Width = (this.pnlCriteriaInput.Width - 10) / 2;
                    cBox2.Width = (this.pnlCriteriaInput.Width - 10) / 2;

                    cBox2.Left = cBox2.Left + cBox2.Width + 5;

                    cBox2.DropDownStyle = cBox1.DropDownStyle;

                    this.CurrentInputObject2 = cBox2;

                    foreach (String cboItem in cBox1.Items)
                    {
                        cBox2.Items.Add(cboItem);
                    }

                    cBox2.SelectedIndex = cBox1.SelectedIndex;

                    this.pnlCriteriaInput.Controls.Add(cBox2);
                    cBox2.Show();
                }
            }
            else
            {
                /* not between */
                if (this.CurrentInputObject2 != null)
                {
                    /* this implies that the inputcriteria was setup for between/range, but now does not need to be */
                    this.pnlCriteriaInput.Controls.Clear();
                    // now call the initial combobox selector setup

                    this.CurrentInputObject2 = null;
                    this.cboCriteriaID_SelectedIndexChanged(this, new EventArgs());

                }
            }
        }
        private void pnlGridDraw_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            pnlGridDraw.AutoSize = true;
            pnlGridDraw.Width = numOfCells * cellSize + 3;
            pnlGridDraw.Height = numOfCells * cellSize + 3;
            if (this.Width < pnlGridDraw.Width)
                this.Width = pnlGridDraw.Width + 5;
            for (int i = 0; i <= numOfCells; i++)
            {
                g.DrawLine(Pens.Black, i * cellSize, 0, i * cellSize, numOfCells * cellSize);
                g.DrawLine(Pens.Black, 0, i * cellSize, numOfCells * cellSize, i * cellSize);
            }
            int y;
            TextBox myTextBox;
            for (int i = 0; i < numOfCells; i++)
            {
                for (int j = 0; j < numOfCells; j++)
                {
                    myTextBox = new TextBox();
                    y = j * cellSize;

                    myTextBox.Text = Cells[i, j].ToString();
                    myTextBox.TextAlign = HorizontalAlignment.Center;
                    myTextBox.Size = new Size(cellSize - 2, cellSize);
                    myTextBox.Location = new Point(j * cellSize + pnlGridDraw.Location.X + 2, pnlGridDraw.Location.Y + i * cellSize);
                    this.Controls.Add(myTextBox);
                    textboxes.Add(myTextBox);
                    myTextBox.BorderStyle = BorderStyle.Fixed3D;
                    myTextBox.Enabled = true;
                    //t.ReadOnly = true;
                    myTextBox.Show();
                    myTextBox.BringToFront();
                    //t.MouseClick +=  text_MouseClick;
                    myTextBox.MouseClick += text_MouseClick;
                }
            }
            this.Invalidate();
        }
Beispiel #36
0
        private void Agregar_Click(object sender, EventArgs e)
        {
            Label cantidad, valor, descripcion;
            TextBox textCantidad, textValor, textDescripcion;

            cantidad = new Label();
            valor = new Label();
            descripcion = new Label();

            textCantidad = new TextBox();
            textValor = new TextBox();
            textDescripcion = new TextBox();

            cantidad.Text = this.lcantidad.Text;
            valor.Text = this.lvalor.Text;
            descripcion.Text = this.lDescripcion.Text;

            textCantidad.Size = this.tcantidad.Size;
            textCantidad.TabIndex = 2;
            textValor.Size = this.tvalor.Size;
            textValor.TabIndex = 2;
            textDescripcion.Multiline = true;
            textDescripcion.Size = this.tDescripcion.Size;

            cantidad.Location = new Point(this.lcantidad.Location.X, listaDesc.Last<TextBox>().Location.Y + 100);
            textCantidad.Location = new Point(this.tcantidad.Location.X, cantidad.Location.Y);

            valor.Location = new Point(this.lvalor.Location.X, cantidad.Location.Y);
            textValor.Location = new Point(this.tvalor.Location.X, valor.Location.Y);

            descripcion.Location = new Point(this.lDescripcion.Location.X, cantidad.Location.Y + 58);
            textDescripcion.Location = new Point(this.tDescripcion.Location.X, descripcion.Location.Y);

            // textBox1_KeyPress

            //textValor.KeyPress += tvalor_KeyPress;
            textValor.KeyPress += tvalor_KeyPress;
            textValor.MaxLength = 7;

            textCantidad.KeyPress += tcantidad_KeyPress;
            textCantidad.MaxLength = 7;

            textDescripcion.KeyPress += tDescripcion_KeyPress;
            textCantidad.MaxLength = 150;

            cantidad.Show();
            textCantidad.Show();
            valor.Show();
            textValor.Show();
            descripcion.Show();
            textDescripcion.Show();

            panel2.Controls.Add(textCantidad);
            panel2.Controls.Add(cantidad);
            panel2.Controls.Add(textValor);
            panel2.Controls.Add(valor);
            panel2.Controls.Add(descripcion);
            panel2.Controls.Add(textDescripcion);

            listaDesc.Add(textDescripcion);
            listaLabelDesc.Add(descripcion);
            listaCant.Add(textCantidad);
            listaLabelCant.Add(cantidad);
            listaVal.Add(textValor);
            listaLabelVal.Add(valor);

            bQuitar.Enabled = true;
        }
Beispiel #37
0
        // Methods
        public fts_winsnap()
        {
            // Set working dir to exe dir so app don't crash on startup
            var  exePath     = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
            bool autoStarted = Environment.CurrentDirectory != exePath;

            if (autoStarted)
            {
                Environment.CurrentDirectory = exePath;
            }

            // Read settings from disk (if there are any)
            LoadSettings();

            // Check registry for startup option
            var registryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
            var v           = registryKey.GetValue("fts_winsnap") as string;

            if (v == Application.ExecutablePath)
            {
                _runOnStartup = true;
            }

            // WinForm Component initialization
            InitializeComponent();
            this._notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(new System.Windows.Forms.MenuItem[] {
                new System.Windows.Forms.MenuItem("Show fts_winsnap", (object sender, System.EventArgs e) => { this?.Show(); }),
                new System.Windows.Forms.MenuItem("Close fts_winsnap", (object sender, System.EventArgs e) => { this?.Close(); })
            });
            Application.ApplicationExit += new EventHandler(this.OnApplicationExit);

            // Minimize to task bar if app was automatically launched by Windows on startup
            if (autoStarted)
            {
                this.ShowInTaskbar = false;
                this.WindowState   = FormWindowState.Minimized;
            }

            // Register hotkeys
            RegisterHotKey(this.Handle, 0, Constants.WM_MOD_CTRL | Constants.WM_MOD_ALT, (int)Keys.Left);
            RegisterHotKey(this.Handle, 1, Constants.WM_MOD_CTRL | Constants.WM_MOD_ALT, (int)Keys.Right);
            RegisterHotKey(this.Handle, 2, Constants.WM_MOD_CTRL | Constants.WM_MOD_ALT, (int)Keys.Up);
            RegisterHotKey(this.Handle, 3, Constants.WM_MOD_CTRL | Constants.WM_MOD_ALT, (int)Keys.Down);
            RegisterHotKey(this.Handle, 4, Constants.WM_MOD_CTRL | Constants.WM_MOD_SHIFT | Constants.WM_MOD_ALT, (int)Keys.Down);
            RegisterHotKey(this.Handle, 5, Constants.WM_MOD_CTRL | Constants.WM_MOD_SHIFT | Constants.WM_MOD_ALT, (int)Keys.Left);
            RegisterHotKey(this.Handle, 6, Constants.WM_MOD_CTRL | Constants.WM_MOD_SHIFT | Constants.WM_MOD_ALT, (int)Keys.Right);
            RegisterHotKey(this.Handle, 7, Constants.WM_MOD_CTRL | Constants.WM_MOD_SHIFT | Constants.WM_MOD_ALT, (int)Keys.Up);


            // Initialize fonts for UI
            var helveticaFamily = new FontFamily("Helvetica");
            var monospaceFamily = new FontFamily(System.Drawing.Text.GenericFontFamilies.Monospace);

            var pfc = new System.Drawing.Text.PrivateFontCollection();

            pfc.AddFontFile(@"Karla-Regular.ttf");
            var karlaFamily = pfc.Families[0];


            // Initialize per-monitor settings
            while (_settings.monitorSettings.Count < Screen.AllScreens.Count())
            {
                var newSettings = new Settings.MonitorSettings();
                _settings.monitorSettings.Add(newSettings);
            }

            // createLabel helper
            Func <string, FontFamily, float, FontStyle, Padding, Rectangle, Label> createLabel =
                (string text, FontFamily fontFamily, float fontScale, FontStyle fontStyle, Padding padding, Rectangle bounds) => {
                var newLabel = new Label();
                newLabel.Text     = text;
                newLabel.Font     = new Font(fontFamily, newLabel.Font.Size * fontScale, fontStyle);
                newLabel.AutoSize = true;
                newLabel.Padding  = padding;
                newLabel.Bounds   = bounds;
                this.Controls.Add(newLabel);
                return(newLabel);
            };

            // Create UI for each monitor
            int idx = 1;
            int y   = 0;

            foreach (var monitor in Screen.AllScreens)
            {
                // Create a new layout for this monitor
                var newLayout = new MonitorLayout(monitor);
                _layouts.Add(newLayout);

                // Grab settings for this monitor
                var monitorSettings = _settings.monitorSettings[idx - 1];

                // Monitor #
                var titleLabel = createLabel("Monitor " + idx.ToString(), karlaFamily, 2f, FontStyle.Bold, new Padding(4), new Rectangle(0, y, 0, 0));

                // Resolution: 1920x1080
                var resolutionLabel = createLabel("Resolution: " + monitor.Bounds.Width.ToString() + "x" + monitor.Bounds.Height.ToString(),
                                                  karlaFamily, 1.5f, FontStyle.Regular, new Padding(32, 3, 3, 3), new Rectangle(titleLabel.Bounds.Left, titleLabel.Bounds.Bottom, 0, 0));

                // Resize: <NumberField>
                var resizeLabel = createLabel("Resize: ", karlaFamily, 1.5f, FontStyle.Regular, new Padding(32, 0, 0, 0), new Rectangle(0, resolutionLabel.Bottom, 0, 0));

                var resizeControl = new NumericUpDown();
                resizeControl.Bounds        = new Rectangle(resizeLabel.Bounds.Right + 4, resizeLabel.Bounds.Top, 50, 0);
                resizeControl.Minimum       = -30;
                resizeControl.Maximum       = 30;
                resizeControl.Value         = monitorSettings.adjustSize;
                resizeControl.AutoSize      = true;
                resizeControl.TabStop       = false;
                resizeControl.ValueChanged += (object sender, EventArgs e) => {
                    // Update settings
                    newLayout.adjustSize       = (int)resizeControl.Value;
                    monitorSettings.adjustSize = newLayout.adjustSize;
                    SaveSettings();
                };

                this.Controls.Add(resizeControl);


                // Layout plus predefined buttons
                var layout = createLabel("Layout: ", karlaFamily, 1.5f, FontStyle.Regular, new Padding(32, 8, 3, 3), new Rectangle(resizeLabel.Bounds.Left, resizeLabel.Bounds.Bottom + 5, 0, 0));

                var    customField = new System.Windows.Forms.TextBox();
                Button selectedBtn = null;
                Button customBtn   = null;

                // Helper to style button visuals
                Action <Button> styleButton = (Button b) => {
                    b.Padding   = new Padding(3);
                    b.AutoSize  = true;
                    b.Font      = new Font(helveticaFamily, b.Font.Size * 1.2f, FontStyle.Bold);
                    b.FlatStyle = FlatStyle.Flat;
                    b.FlatAppearance.BorderSize         = 1;
                    b.FlatAppearance.BorderColor        = midGray;
                    b.FlatAppearance.MouseOverBackColor = medBlue;
                    b.FlatAppearance.MouseDownBackColor = medBlue;
                    b.FlatAppearance.CheckedBackColor   = darkBlue;
                    b.ForeColor = darkGray;
                    b.BackColor = faintGray;
                };

                // Helper to set layous from json (throw exception on bad json!)
                Action <string> UpdateLayouts = (string json) => {
                    var layoutEntries         = JsonConvert.DeserializeObject <IList <IList <int> > >(json);
                    List <Rectangle> newRects = new List <Rectangle>(layoutEntries.Count);
                    foreach (var layoutEntry in layoutEntries)
                    {
                        int minX = layoutEntry[0];
                        int minY = layoutEntry[1];
                        int maxX = layoutEntry[2];
                        int maxY = layoutEntry[3];
                        newRects.Add(new Rectangle(minX, minY, maxX - minX, maxY - minY));
                    }
                    newLayout.SetLayouts(newRects);
                };

                // Handler for when user clicks button
                Action <Button, string> clickButton = (Button b, string json) => {
                    // Update layouts
                    try { UpdateLayouts(json); }
                    catch (System.Exception /*ex*/) { return; }

                    // Show/Hide json field if 'Custom' button is clicked
                    if (b == customBtn)
                    {
                        customField.Show();
                    }
                    else
                    {
                        customField.Hide();
                    }

                    // Reset colors on previously selected button
                    if (selectedBtn != null)
                    {
                        selectedBtn.ForeColor = darkGray;
                        selectedBtn.BackColor = faintGray;
                    }

                    // Set colors on nwely selected button
                    b.BackColor = darkBlue;
                    b.ForeColor = Color.White;
                    selectedBtn = b;

                    // Update settings
                    monitorSettings.selectedButton = b.Text;
                    SaveSettings();
                };

                Button initialButton = null;
                string initialJson   = null;

                // Helper to make a button
                Func <Rectangle, string, string, Button> makeButton = (Rectangle bounds, string label, string json) => {
                    // Create button
                    var newBtn = new System.Windows.Forms.Button();
                    newBtn.Bounds = bounds;
                    newBtn.Text   = label;
                    styleButton(newBtn);

                    Action <object, EventArgs> onClick = (object s, EventArgs e) => { clickButton(newBtn, json); };
                    newBtn.Click += (object s, EventArgs e) => { onClick(s, e); };

                    this.Controls.Add(newBtn);

                    // Check if this is the default selection
                    if (label == monitorSettings.selectedButton)
                    {
                        initialButton = newBtn;
                        initialJson   = json;
                    }

                    return(newBtn);
                };

                Button btn = null;
                int    pad = 3;

                btn = makeButton(new Rectangle(layout.Bounds.Right, layout.Bounds.Top, 0, 0), "1x1", "[[0,0,100,100]]");

                btn = makeButton(new Rectangle(btn.Bounds.Right + pad, btn.Bounds.Top, 0, 0), "2x1", "[[0,0,50,100], [50,0,100,100]]");
                btn = makeButton(new Rectangle(btn.Bounds.Right + pad, btn.Bounds.Top, 0, 0), "1x2", "[[0,0,100,50], [0,50,100,100]]");
                btn = makeButton(new Rectangle(btn.Bounds.Right + pad, btn.Bounds.Top, 0, 0), "2x2", "[[0,0,50,50], [50,0,100,50], [0,50,50,100], [50,50,100,100]]");

                btn = makeButton(new Rectangle(layout.Bounds.Right, btn.Bounds.Bottom + 5, 0, 0), "3x1", "[[0,0,33,100], [33,0,67,100], [67,0,100,100]]");
                btn = makeButton(new Rectangle(btn.Bounds.Right + pad, btn.Bounds.Top, 0, 0), "1x3", "[[0,0,100,33], [0,33,100,67], [0,67,100,100]]");
                btn = makeButton(new Rectangle(btn.Bounds.Right + pad, btn.Bounds.Top, 0, 0), "3x3", "[[0,0,33,33], [33,0,67,33], [67,0,100,33], [0,33,33,67], [33,33,67,67], [67,33,100,67], [0,67,33,100], [33,67,67,100], [67,67,100,100]]");

                customBtn = makeButton(new Rectangle(btn.Bounds.Right + pad, btn.Bounds.Top, 0, 0), "Custom", monitorSettings.customJson);


                // Custom field holds JSON layout data. Can be hand edited by user if 'Custom' button is selected
                customField.Bounds       = new Rectangle(layout.Bounds.Right, btn.Bounds.Bottom + 4, this.Width / 2, layout.Bounds.Height);
                customField.TabStop      = false;
                customField.Font         = new Font(monospaceFamily, customField.Font.Size, FontStyle.Regular);
                customField.Text         = monitorSettings.customJson;
                customField.TextChanged += (object sender, EventArgs e) => {
                    try {
                        UpdateLayouts(customField.Text);
                        customField.BackColor = Color.White;

                        monitorSettings.customJson = customField.Text;
                        SaveSettings();
                    }
                    catch (Exception /*ex*/) {
                        customField.BackColor = paleRed;
                    }
                };
                this.Controls.Add(customField);

                // Click initial button for initial state
                clickButton(initialButton, initialJson);

                y = customField.Bounds.Bottom + 15;
                ++idx;
            }


            // 'Controls' section header
            var controls = createLabel("Controls", karlaFamily, 2f, FontStyle.Bold, new Padding(4), new Rectangle(0, y, 0, 0));

            // 'Move: Ctrl  +  Alt +  ArrowKey'
            var moveLabel    = createLabel("Move: ", karlaFamily, 1.5f, FontStyle.Regular, new Padding(32, 3, 3, 3), new Rectangle(controls.Bounds.Left, controls.Bounds.Bottom, 0, 0));
            var moveControls = createLabel("Ctrl  +  Alt +  ArrowKey", karlaFamily, 1.5f, FontStyle.Regular, new Padding(3), new Rectangle(110, moveLabel.Bounds.Top, 0, 0));

            // 'Expand: Ctrl  +  Alt  +  Shift  +  ArrowKey'
            var expandLabel = createLabel("Expand: ", karlaFamily, 1.5f, FontStyle.Regular, new Padding(32, 3, 3, 3), new Rectangle(moveLabel.Bounds.Left, moveLabel.Bounds.Bottom, 0, 0));
            var expandText  = createLabel("Ctrl  +  Alt  +  Shift  +  ArrowKey", karlaFamily, 1.5f, FontStyle.Regular, new Padding(3), new Rectangle(110, expandLabel.Bounds.Top, 0, 0));


            // 'Options' section header
            var optionsLabel = createLabel("Options", karlaFamily, 2f, FontStyle.Bold, new Padding(4), new Rectangle(0, expandText.Bounds.Bottom + 30, 0, 0));

            var runOnStartupLabel = createLabel("Run on Startup: ", karlaFamily, 1.5f, FontStyle.Regular, new Padding(32, 0, 0, 0), new Rectangle(0, optionsLabel.Bottom, 0, 0));

            var runOnStartup = new System.Windows.Forms.CheckBox();

            runOnStartup.Checked         = _runOnStartup;
            runOnStartup.Bounds          = new Rectangle(runOnStartupLabel.Bounds.Right + 10, runOnStartupLabel.Bounds.Top + 5, 0, 0);
            runOnStartup.AutoSize        = true;
            runOnStartup.CheckedChanged += (object sender, EventArgs e) => {
                // Add or remove register key
                var rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);

                if (runOnStartup.Checked)
                {
                    rk.SetValue("fts_winsnap", Application.ExecutablePath);
                }
                else
                {
                    rk.DeleteValue("fts_winsnap", false);
                }

                // Update settings
                _runOnStartup = runOnStartup.Checked;
                SaveSettings();
            };
            this.Controls.Add(runOnStartup);
        }
Beispiel #38
0
        private void bagregar_Click(object sender, EventArgs e)
        {
            Label Telefono = new Label();
            TextBox tTelefono = new TextBox();

            Telefono.Text = this.lTelefono.Text;
            Telefono.Size = this.lTelefono.Size;
            Telefono.Location = new Point(this.lTelefono.Location.X,
                                          this.lista.Last<TextBox>().Location.Y + 50);

            tTelefono.Size = this.textTelefono.Size;
            tTelefono.Location = new Point(this.textTelefono.Location.X,
                                          this.lista.Last<TextBox>().Location.Y + 50);

            tTelefono.Show();
            Telefono.Show();

            lista.Add(tTelefono);
            labelList.Add(Telefono);

            tTelefono.KeyPress += textBox4_KeyPress;
            tTelefono.TextChanged += textTelefono_TextChanged;
            tTelefono.MaxLength = 10;
            contenedorARepetir.Controls.Add(Telefono);
            contenedorARepetir.Controls.Add(tTelefono);

            BloquearBoton();
            bQuitar.Enabled = true;
        }