Пример #1
0
 private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
 {
     cbx0.Visible = false;
     cbx1.Visible = false;
     cbx2.Visible = false;
     System.Windows.Forms.ComboBox cbx = null;
     if (dataGrid1.CurrentCell.ColumnNumber == 0)
     {
         cbx = cbx0;
     }
     if (dataGrid1.CurrentCell.ColumnNumber == 1)
     {
         cbx = cbx1;
     }
     if (dataGrid1.CurrentCell.ColumnNumber == 2)
     {
         cbx = cbx2;
     }
     if (cbx != null)
     {
         System.Drawing.Rectangle rc = dataGrid1.GetCurrentCellBounds();
         cbx.SetBounds(rc.Left, rc.Top, rc.Width, rc.Height);
         cbx.SelectedIndex = -1;
         if (dataGrid1.CurrentCell.RowNumber < ds.Tables[0].Rows.Count)
         {
             if (dataGrid1.CurrentCell.ColumnNumber < ds.Tables[0].Columns.Count)
             {
                 cbx.Text = ds.Tables[0].Rows[dataGrid1.CurrentCell.RowNumber][dataGrid1.CurrentCell.ColumnNumber].ToString();
             }
         }
         SetDropdownWidth(cbx);
         cbx.Visible = true;
         cbx.BringToFront();
     }
 }
Пример #2
0
 private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
 {
     if (dataGrid1.CurrentCell.RowNumber >= 0)
     {
         if (dataGrid1.CurrentCell.ColumnNumber == 1)
         {
             System.Drawing.Rectangle rc = dataGrid1.GetCurrentCellBounds();
             cbx2.SetBounds(rc.Left, rc.Top, rc.Width, rc.Height);
             cbx2.SelectedIndex = -1;
             if (dataGrid1.CurrentCell.RowNumber < ds.Tables[0].Rows.Count)
             {
                 string s = ds.Tables[0].Rows[dataGrid1.CurrentCell.RowNumber][dataGrid1.CurrentCell.ColumnNumber].ToString();
                 for (int i = 0; i < cbx2.Items.Count; i++)
                 {
                     if (cbx2.Items[i].ToString() == s)
                     {
                         cbx2.SelectedIndex = i;
                         break;
                     }
                 }
             }
             cbx2.Visible = true;
             cbx2.BringToFront();
         }
     }
 }
Пример #3
0
        public DialogResult CatBox(string promptText, double cost, DateTime dt, ref string value)
        {
            Form form = new Form();
            Label label = new Label();
            Label amount = new Label();
            Label date = new Label();
            ComboBox comboBox = new ComboBox();
            Button buttonOk = new Button();
            CheckBox checkBox = new CheckBox();
            form.Text = "Specify a Category:";
            label.Text = promptText;
            amount.Text = cost.ToString("C");
            date.Text = dt.ToString();
            checkBox.Text = "Remember this relationship?";
            buttonOk.Text = "OK";
            buttonOk.DialogResult = DialogResult.OK;
            label.SetBounds(9, 20, 172, 13);
            amount.SetBounds(273, 20, 100, 13);
            date.SetBounds(173, 20, 100, 13);
            comboBox.SetBounds(12, 36, 372, 20);
            buttonOk.SetBounds(309, 72, 75, 23);
            checkBox.SetBounds(12, 72, 275, 24); // ???
            label.AutoSize = true;
            comboBox.Anchor = comboBox.Anchor | AnchorStyles.Right;
            buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
            checkBox.Anchor = checkBox.Anchor | AnchorStyles.Right;
            comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            form.ClientSize = new Size(396, 107);
            form.Controls.AddRange(new Control[] { label, amount, date, checkBox, comboBox, buttonOk });
            form.ClientSize = new Size(Math.Max(300, amount.Right + 10), form.ClientSize.Height);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.MinimizeBox = false;
            form.MaximizeBox = false;
            form.AcceptButton = buttonOk;

            SqlCeConnection cs = new SqlCeConnection(@"Data Source = Expenses.sdf");
            cs.Open();
            SqlCeDataReader r = null;
            SqlCeCommand getCats = new SqlCeCommand("SELECT * FROM Categories", cs);
            r = getCats.ExecuteReader();
            while (r.Read()) comboBox.Items.Add(r["Category"]);
            cs.Close();
            DialogResult dialogResult = form.ShowDialog();
            value = comboBox.Text;
            // remember relationship if option to do so is checked
            if (checkBox.Checked)
            {
                SqlCeConnection cs2 = new SqlCeConnection(@"Data Source = Expenses.sdf");
                cs2.Open();
                SqlCeCommand setCat = new SqlCeCommand("INSERT INTO CategorizedItems VALUES (@Description, @Category)", cs2);
                setCat.Parameters.AddWithValue("@Description", promptText);
                setCat.Parameters.AddWithValue("@Category", value);
                setCat.ExecuteNonQuery();
                cs2.Close();
            }
            return dialogResult;
        }
Пример #4
0
        /// <summary>
        /// Shows a dialog box with an input field.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="prompt"></param>
        /// <param name="options"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static DialogResult Show(string title, string prompt, List<string> options, ref string value)
        {
            Form mForm = new Form();
            Label mLabel = new Label();
            ComboBox mComboBox = new ComboBox();
            Button mOKButton = new Button();

            mForm.Text = title;
            mLabel.Text = prompt;
            mComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            for (int i = 0; i < options.Count; i++)
            {
                mComboBox.Items.Add(options[i]);
            }
            mComboBox.SelectedIndex = 0;

            mOKButton.Text = "OK";
            mOKButton.DialogResult = DialogResult.OK;

            mForm.ClientSize = new Size(240, 80);
            mLabel.SetBounds(4, 4, mForm.ClientSize.Width - 8, 22);
            mComboBox.SetBounds(32, 26, mForm.ClientSize.Width - 64, 24);
            mOKButton.SetBounds(mForm.ClientSize.Width / 2 - 32, 54, 64, 22);

            mLabel.AutoSize = true;
            mComboBox.Anchor = AnchorStyles.Bottom;
            mOKButton.Anchor = AnchorStyles.Bottom;

            mForm.Controls.AddRange(new Control[] { mLabel, mComboBox, mOKButton });
            mForm.FormBorderStyle = FormBorderStyle.FixedDialog;
            mForm.StartPosition = FormStartPosition.CenterScreen;
            mForm.MinimizeBox = false;
            mForm.MaximizeBox = false;
            mForm.AcceptButton = mOKButton;

            DialogResult dialogResult = mForm.ShowDialog();
            value = mComboBox.Text;
            return dialogResult;
        }
Пример #5
0
        private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n >= 0)
            {
                listBox2.SelectedIndex = n;
                System.Drawing.Rectangle rc = listBox2.GetItemRectangle(n);
                cbxFK.SetBounds(rc.Left, rc.Top, rc.Width, rc.Height);
                EPField fld = listBox2.Items[n] as EPField;
                if (fld != null)
                {
                    for (int i = 0; i < subTable.fields.Count; i++)
                    {
                        if (fld == subTable.fields[i])
                        {
                            cbxFK.SelectedIndex = i;
                            break;
                        }
                    }
                }
                cbxFK.Visible = true;
            }
        }
        protected override void InitForm()
        {
            base.InitForm();

            this._objectList = (ObjectList)Component;
            this.CommitOnDeactivate = true;
            this.Icon = new Icon(
                typeof(System.Web.UI.Design.MobileControls.MobileControlDesigner),
                "Commands.ico"
            );
            this.Size = new Size(402, 300);
            this.Text = SR.GetString(SR.ObjectListCommandsPage_Title);

            GroupLabel grplblCommandList = new GroupLabel();
            grplblCommandList.SetBounds(4, 4, 392, LabelHeight);
            grplblCommandList.Text = SR.GetString(SR.ObjectListCommandsPage_CommandListGroupLabel);
            grplblCommandList.TabIndex = 0;
            grplblCommandList.TabStop = false;

            TreeList.TabIndex = 1;

            Label lblText = new Label();
            lblText.SetBounds(X, Y, ControlWidth, LabelHeight);
            lblText.Text = SR.GetString(SR.ObjectListCommandsPage_TextCaption);
            lblText.TabStop = false;
            lblText.TabIndex = TabIndex;

            _txtText = new TextBox();
            Y += LabelHeight;
            _txtText.SetBounds(X, Y, ControlWidth, CmbHeight);
            _txtText.TextChanged += new EventHandler(this.OnPropertyChanged);
            _txtText.TabIndex = TabIndex + 1;

            GroupLabel grplblData = new GroupLabel();
            grplblData.SetBounds(4, 238, 392, LabelHeight);
            grplblData.Text = SR.GetString(SR.ObjectListCommandsPage_DataGroupLabel);
            grplblData.TabIndex = TabIndex + 2;
            grplblData.TabStop = false;

            Label lblDefaultCommand = new Label();
            lblDefaultCommand.SetBounds(8, 260, 182, LabelHeight);
            lblDefaultCommand.Text = SR.GetString(SR.ObjectListCommandsPage_DefaultCommandCaption);
            lblDefaultCommand.TabStop = false;
            lblDefaultCommand.TabIndex = TabIndex + 3;

            _cmbDefaultCommand = new ComboBox();
            _cmbDefaultCommand.SetBounds(8, 276, 182, 64);
            _cmbDefaultCommand.DropDownStyle = ComboBoxStyle.DropDown;
            _cmbDefaultCommand.Sorted = true;
            _cmbDefaultCommand.TabIndex = TabIndex + 4;
            _cmbDefaultCommand.SelectedIndexChanged += new EventHandler(this.OnSetPageDirty);
            _cmbDefaultCommand.TextChanged += new EventHandler(this.OnSetPageDirty);

            this.Controls.AddRange(new Control[] 
                                    {
                                        grplblCommandList,
                                        lblText,
                                        _txtText,
                                        grplblData,
                                        lblDefaultCommand,
                                        _cmbDefaultCommand
                                    });
        }
Пример #7
0
        private void cbFiltro_SelectedValueChanged(object sender, EventArgs e)
        {
            pDinamico.Controls.Clear();
            
            DataTable dt;
            switch (cbFiltro.Text)
            {
                case "Cedula":
                    
                    pDinamico.Controls.Add(lCedula);
                    pDinamico.Controls.Add(tbCedula);

                    
                    break;
                case "Region":
                    
                    break;
                case "VIP":

                    actualizarLista("select i.CustomerID, i.FirstName, i.LastName, SUM(soh.totaldue) as totalCompras from Individual i inner join SalesOrderHeader soh on i.CustomerID=soh.CustomerID group by i.CustomerID, i.FirstName, i.LastName HAVING SUM(soh.totaldue) > (select avg(totaldue) from SalesOrderHeader) order by totalCompras desc;");
                    break;
                case "Categorias":
                    //sql
                    
                     SqlDataAdapter dad = new SqlDataAdapter("SELECT name FROM ProductCategory",con);
                    dt = new DataTable();
                    dad.Fill(dt);
                    DataRow fila = dt.NewRow();
                    fila["Name"]="";
                    dt.Rows.Add(fila);
                    
                    //crear combobox
                    //--Categorias
                     cbCategorias = new ComboBox();
                    cbCategorias.DataSource = dt;
                    
                     cbCategorias.DisplayMember = "Name";
                    cbCategorias.ValueMember = "ProductCategoryId";
                    cbCategorias.SelectedValue = "";
                    cbCategorias.SelectedValueChanged += new System.EventHandler(this.cbCategorias_selectedValueChanged);
                    cbCategorias.SetBounds(0,0,100,20);
                   
                    pDinamico.Controls.Add(cbCategorias);
                    patito = new Panel();
                    patito.SetBounds(120,0,130,50);
                    pDinamico.Controls.Add(patito);

                    
                    actualizarLista("select i.CustomerID, i.FirstName, i.LastName from Individual i inner join SalesOrderHeader soh on soh.CustomerID = i.CustomerID inner join SalesOrderDetail sod on sod.SalesOrderID = soh.SalesOrderID inner join Product p on p.ProductID = sod.ProductID  inner join ProductSubCategory ps on ps.ProductSubCategoryID = p.ProductSubCategoryID inner join ProductCategory pc on pc.ProductCategoryID = ps.ProductCategoryID and pc.ProductCategoryID = (select ProductCategoryID from ProductCategory where Name = '" + cbCategorias.Text + "') group by i.CustomerID, i.FirstName, i.LastName;");
                    break;
                default:

                    actualizarLista( "select i.CustomerID, i.FirstName, i.LastName from Individual i inner join SalesOrderHeader soh on soh.CustomerID = i.CustomerID group by i.CustomerID, i.FirstName, i.LastName");
                    break;
            }
        }
Пример #8
0
        /// <summary>
        ///   Initializes the UI of the form.
        /// </summary>
        private void InitForm()
        {
            Debug.Assert(GetBaseControl() != null);
            _isBaseControlList = (GetBaseControl() is List);   // SelectionList otherwise.

            GroupLabel appearanceGroup   = new GroupLabel();
            GroupLabel pagingGroup       = null;
            Label      itemCountLabel    = null;
            Label      itemsPerPageLabel = null;
            Label      rowsLabel         = null;
            Label      decorationLabel   = null;
            Label      selectTypeLabel   = null;

            if (_isBaseControlList)
            {
                pagingGroup          = new GroupLabel();
                itemCountLabel       = new Label();
                _itemCountTextBox    = new TextBox();
                itemsPerPageLabel    = new Label();
                _itemsPerPageTextBox = new TextBox();
                decorationLabel      = new Label();
                _decorationCombo     = new ComboBox();
            }
            else
            {
                rowsLabel        = new Label();
                _rowsTextBox     = new TextBox();
                selectTypeLabel  = new Label();
                _selectTypeCombo = new ComboBox();
            }

            appearanceGroup.SetBounds(4, 4, 372, 16);
            appearanceGroup.Text     = SR.GetString(SR.ListGeneralPage_AppearanceGroupLabel);
            appearanceGroup.TabIndex = 0;
            appearanceGroup.TabStop  = false;

            if (_isBaseControlList)
            {
                decorationLabel.SetBounds(8, 24, 200, 16);
                decorationLabel.Text     = SR.GetString(SR.ListGeneralPage_DecorationCaption);
                decorationLabel.TabStop  = false;
                decorationLabel.TabIndex = 1;

                _decorationCombo.SetBounds(8, 40, 161, 21);
                _decorationCombo.DropDownStyle         = ComboBoxStyle.DropDownList;
                _decorationCombo.SelectedIndexChanged += new EventHandler(this.OnSetPageDirty);
                _decorationCombo.Items.AddRange(new object[] {
                    SR.GetString(SR.ListGeneralPage_DecorationNone),
                    SR.GetString(SR.ListGeneralPage_DecorationBulleted),
                    SR.GetString(SR.ListGeneralPage_DecorationNumbered)
                });
                _decorationCombo.TabIndex = 2;

                pagingGroup.SetBounds(4, 77, 372, 16);
                pagingGroup.Text     = SR.GetString(SR.ListGeneralPage_PagingGroupLabel);
                pagingGroup.TabIndex = 3;
                pagingGroup.TabStop  = false;

                itemCountLabel.SetBounds(8, 97, 161, 16);
                itemCountLabel.Text     = SR.GetString(SR.ListGeneralPage_ItemCountCaption);
                itemCountLabel.TabStop  = false;
                itemCountLabel.TabIndex = 4;

                _itemCountTextBox.SetBounds(8, 113, 161, 20);
                _itemCountTextBox.TextChanged += new EventHandler(this.OnSetPageDirty);
                _itemCountTextBox.KeyPress    += new KeyPressEventHandler(this.OnKeyPressNumberTextBox);
                _itemCountTextBox.TabIndex     = 5;

                itemsPerPageLabel.SetBounds(211, 97, 161, 16);
                itemsPerPageLabel.Text     = SR.GetString(SR.ListGeneralPage_ItemsPerPageCaption);
                itemsPerPageLabel.TabStop  = false;
                itemsPerPageLabel.TabIndex = 6;

                _itemsPerPageTextBox.SetBounds(211, 113, 161, 20);
                _itemsPerPageTextBox.TextChanged += new EventHandler(this.OnSetPageDirty);
                _itemsPerPageTextBox.KeyPress    += new KeyPressEventHandler(this.OnKeyPressNumberTextBox);
                _itemsPerPageTextBox.TabIndex     = 7;
            }
            else
            {
                selectTypeLabel.SetBounds(8, 24, 161, 16);
                selectTypeLabel.Text     = SR.GetString(SR.ListGeneralPage_SelectTypeCaption);
                selectTypeLabel.TabStop  = false;
                selectTypeLabel.TabIndex = 1;

                _selectTypeCombo.SetBounds(8, 40, 161, 21);
                _selectTypeCombo.DropDownStyle         = ComboBoxStyle.DropDownList;
                _selectTypeCombo.SelectedIndexChanged += new EventHandler(this.OnSetPageDirty);
                _selectTypeCombo.Items.AddRange(new object[] {
                    SR.GetString(SR.ListGeneralPage_SelectTypeDropDown),
                    SR.GetString(SR.ListGeneralPage_SelectTypeListBox),
                    SR.GetString(SR.ListGeneralPage_SelectTypeRadio),
                    SR.GetString(SR.ListGeneralPage_SelectTypeMultiSelectListBox),
                    SR.GetString(SR.ListGeneralPage_SelectTypeCheckBox)
                });
                _selectTypeCombo.TabIndex = 2;

                rowsLabel.SetBounds(211, 24, 161, 16);
                rowsLabel.Text     = SR.GetString(SR.ListGeneralPage_RowsCaption);
                rowsLabel.TabStop  = false;
                rowsLabel.TabIndex = 3;

                _rowsTextBox.SetBounds(211, 40, 161, 20);
                _rowsTextBox.TextChanged += new EventHandler(this.OnSetPageDirty);
                _rowsTextBox.KeyPress    += new KeyPressEventHandler(this.OnKeyPressNumberTextBox);
                _rowsTextBox.TabIndex     = 4;
            }

            this.Text = SR.GetString(SR.ListGeneralPage_Title);
            this.Size = new Size(382, 270);
            this.CommitOnDeactivate = true;
            this.Icon = new Icon(
                typeof(System.Web.UI.Design.MobileControls.MobileControlDesigner),
                "General.ico"
                );

            this.Controls.AddRange(new Control[]
            {
                appearanceGroup
            });

            if (_isBaseControlList)
            {
                this.Controls.AddRange(new Control[]
                {
                    _itemsPerPageTextBox,
                    itemsPerPageLabel,
                    _itemCountTextBox,
                    itemCountLabel,
                    pagingGroup,
                    decorationLabel,
                    _decorationCombo
                });
            }
            else
            {
                this.Controls.AddRange(new Control[]
                {
                    _rowsTextBox,
                    rowsLabel,
                    selectTypeLabel,
                    _selectTypeCombo
                });
            }
        }
Пример #9
0
Файл: GUI.cs Проект: VicBoss/KR
        private DialogResult ComboboxInputBox(string title, string promptText,
            ref Object value, Object[] items)
        {
            Form form = new Form();
            Label label = new Label();
            ComboBox comboBox = new ComboBox();
            comboBox.AutoCompleteMode = AutoCompleteMode.Suggest;
            comboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
            Button buttonOk = new Button();
            Button buttonCancel = new Button();

            form.Text = title;
            label.Text = promptText;
            comboBox.Items.AddRange(items);
            comboBox.SelectedIndex = 0;

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

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

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

            form.ClientSize = new Size(396, 107);
            form.Controls.AddRange(new Control[] { label, comboBox, buttonOk, 
				buttonCancel });
            form.ClientSize = new Size(Math.Max(300, label.Right + 10),
                form.ClientSize.Height);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.MinimizeBox = false;
            form.MaximizeBox = false;
            form.AcceptButton = buttonOk;
            form.CancelButton = buttonCancel;

            DialogResult dialogResult = form.ShowDialog();
            value = comboBox.SelectedItem;
            return dialogResult;
        }
        private static DialogResult AddAccountForm(ref LoLLauncherClient client)
        {
            Form form = new Form();
            TextBox user = new TextBox();
            TextBox pw = new TextBox();
            ComboBox region = new ComboBox();
            ComboBox queue = new ComboBox();
            Button buttonOk = new Button();
            Button buttonCancel = new Button();
            user.Text = "Username";
            pw.Text = "Password";
            region.Text = "Region";
            region.Items.AddRange(Enum.GetNames(typeof(LoLLauncher.Region)));
            queue.Text = "Queue";
            queue.Items.AddRange(Enum.GetNames(typeof(LoLLauncher.QueueTypes)));
            buttonOk.Text = "OK";
            buttonCancel.Text = "Cancel";
            buttonOk.DialogResult = DialogResult.OK;
            buttonCancel.DialogResult = DialogResult.Cancel;

            user.SetBounds(10, 10, 100, 23);
            pw.SetBounds(120, 10, 100, 23);
            region.SetBounds(10, 43, 100, 23);
            queue.SetBounds(120, 43, 100, 23);
            buttonOk.SetBounds(228, 72, 75, 23);
            buttonCancel.SetBounds(309, 72, 75, 23);

            buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
            buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            form.ClientSize = new Size(396, 107);
            form.Controls.AddRange(new Control[] { user, pw, region, queue, buttonOk, buttonCancel });
            form.ClientSize = new Size(Math.Max(300, user.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;

            DialogResult dialogResult = form.ShowDialog();
            if (dialogResult == DialogResult.OK)
            {
                client.Init(user.Text, pw.Text, (LoLLauncher.Region)Enum.Parse(typeof(LoLLauncher.Region), region.SelectedItem.ToString()),
                    (LoLLauncher.QueueTypes)Enum.Parse(typeof(LoLLauncher.QueueTypes), queue.SelectedItem.ToString()));
            }
            return dialogResult;
        }
Пример #11
0
        /// <summary>
        /// 单击查询窗体datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SearchDgv_Click(object sender, EventArgs e)
        {
            //string sqlstatus = "SELECT NAME FROM SPFLOWSTATUS_TAB where id not in (6,8,9,15) ORDER BY ID";
            string sqlstatus = "SELECT NAME FROM SP_FLOWSTATUS_TAB  ORDER BY ID";
            if (table_name == "SP_SPOOL_TAB" || table_name == "FLOWLOG_VIEW")
            {
                ComboBox cb = new ComboBox();
                foreach( DataGridViewRow dr in this.SearchDgv.Rows )
                {
                    if(dr.Cells[4].Selected == true)
                    {
                        int id = dr.Index;
                        if(dr.Cells[0].Value.ToString() == "FLOWSTATUS")
                        {
                             Rectangle rec = this.SearchDgv.GetCellDisplayRectangle(4, id, true);
                            cb.SetBounds(rec.Location.X, rec.Location.Y, rec.Width, rec.Height);
                            this.SearchDgv.Controls.Add(cb);
                            cb.Items.Add(string.Empty);
                            DetailInfo.Application_Code.FillComboBox.GetFlowStatus(cb,sqlstatus);
                            cb.BringToFront();
                            cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);
                        }
                        else
                        {
                            foreach (Control combo in this.SearchDgv.Controls)
                            {
                                if (combo is ComboBox)
                                {
                                    combo.Dispose();
                                }
                            }
                        }
                    }
                }

            }
        }
Пример #12
0
        public NewRaceInputBox()
        {
            label = new Label();
            label2 = new Label();
            labelNote = new Label();
            cbxGameName = new ComboBox();
            cbxRunCategory = new ComboBox();
            buttonOk = new Button();
            buttonCancel = new Button();

            Task.Factory.StartNew(() =>
            {
                try
                {
                    var gameNames = SpeedRunsLiveAPI.Instance.GetGameNames().ToArray();
                    this.InvokeIfRequired(() =>
                    {
                        try
                        {
                            cbxGameName.Items.AddRange(gameNames);
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex);
                        }
                    });
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                }
            });

            cbxGameName.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            cbxGameName.TextChanged += cbxGameName_TextChanged;

            cbxRunCategory.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbxRunCategory.Items.AddRange(new [] { "Any%", "Low%", "100%" });
            cbxRunCategory.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

            Text = "New Race";
            label.Text = "Game:";
            label2.Text = "Category:";
            labelNote.Text = "Creating a race without any opponents is against the rules.";

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

            label.SetBounds(9, 20, 372, 13);
            label2.SetBounds(9, 66, 372, 13);
            cbxGameName.SetBounds(12, 36, 372, 20);
            cbxRunCategory.SetBounds(12, 82, 372, 20);
            labelNote.SetBounds(9, 118, 372, 13);
            buttonOk.SetBounds(228, 145, 75, 23);
            buttonCancel.SetBounds(309, 145, 75, 23);

            label.AutoSize = true;
            label2.AutoSize = true;
            labelNote.AutoSize = true;
            cbxGameName.Anchor = cbxGameName.Anchor | AnchorStyles.Right;
            cbxRunCategory.Anchor = cbxGameName.Anchor | AnchorStyles.Right;
            buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
            buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            ClientSize = new Size(396, 180);
            Controls.AddRange(new Control[] { label, label2, labelNote, cbxGameName, cbxRunCategory, buttonOk, buttonCancel });
            ClientSize = new Size(Math.Max(300, label.Right + 10), ClientSize.Height);
            FormBorderStyle = FormBorderStyle.FixedDialog;
            StartPosition = FormStartPosition.CenterScreen;
            MinimizeBox = false;
            MaximizeBox = false;
            AcceptButton = buttonOk;
            CancelButton = buttonCancel;

            FormClosing += NewRaceInputBox_FormClosing;

            cbxGameName.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

            cbxRunCategory.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbxRunCategory.Items.AddRange(new string[] { "Any%", "Low%", "100%" });
            cbxRunCategory.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

            RefreshCategoryAutoCompleteList("");
        }
Пример #13
0
        public static DialogResult InputBoxQuestScripts(string title, string promptText, ref string value)
        {
            Form form = new Form();
            Label label = new Label();
            ComboBox comboBoxBox = new ComboBox();
            Button buttonOk = new Button();
            Button buttonCancel = new Button();
            buttonOk.FlatStyle = FlatStyle.Flat;
            buttonCancel.FlatStyle = FlatStyle.Flat;
            comboBoxBox.FlatStyle = FlatStyle.Flat;

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

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

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

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

            form.ClientSize = new Size(396, 107);
            form.Controls.AddRange(new Control[] { label, comboBoxBox, buttonOk, buttonCancel });
            form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.MinimizeBox = false;
            form.MaximizeBox = false;
            form.AcceptButton = buttonOk;
            form.CancelButton = buttonCancel;

            String[] QList = Directory.GetFiles("DIIIBData\\Quest", "*.D3S");
            String CutDummy = String.Empty;
            foreach (String Dummy in QList)
            {
                CutDummy = Dummy.Substring(16);
                CutDummy = CutDummy.Substring(0, CutDummy.Length - 4);
                comboBoxBox.Items.Add(CutDummy);
            }

            DialogResult dialogResult = form.ShowDialog();
            if(comboBoxBox.SelectedIndex != -1)
                value = comboBoxBox.Items[comboBoxBox.SelectedIndex].ToString();
            return dialogResult;
        }