private void statDiagnosisDataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1 && e.Button == MouseButtons.Right)
            {
                if (statDiagnosisDataGridView.Columns[e.ColumnIndex] == PFIO || statDiagnosisDataGridView.Columns[e.ColumnIndex] == DFIO ||
                    statDiagnosisDataGridView.Columns[e.ColumnIndex] == Texts)
                {
                    int            x    = e.Location.X + statDiagnosisDataGridView.Location.X + statDiagnosisDataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Location.X;
                    int            y    = e.Location.Y + statDiagnosisDataGridView.Location.Y + statDiagnosisDataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Location.Y;
                    CheckedListBox list = listParam(ref x, y);

                    if (statDiagnosisDataGridView.Columns[e.ColumnIndex] == DFIO)
                    {
                        list.Leave    += new EventHandler(list_DisposedDOC);
                        list.KeyDown  += new KeyEventHandler(list_KeyDownDOC);
                        list.GotFocus += new EventHandler(list_GotFocusDOC);
                    }
                    else if (statDiagnosisDataGridView.Columns[e.ColumnIndex] == PFIO)
                    {
                        list.Leave    += new EventHandler(list_LostFocusPAT);
                        list.KeyDown  += new KeyEventHandler(list_KeyDownPAT);
                        list.GotFocus += new EventHandler(list_GotFocusPAT);
                    }
                    else if (statDiagnosisDataGridView.Columns[e.ColumnIndex] == Texts)
                    {
                        list.Leave    += new EventHandler(list_LostFocusTR);
                        list.KeyDown  += new KeyEventHandler(list_KeyDownTR);
                        list.GotFocus += new EventHandler(list_GotFocusTR);
                    }
                    this.Controls.Add(list);
                    list.BringToFront();
                    list.Focus();
                }
            }
        }
示例#2
0
        private void CheckedListBox1_MouseHover(object sender, EventArgs e)
        {
            CheckedListBox chk = (CheckedListBox)sender;

            chk.BorderStyle = BorderStyle.FixedSingle;
            chk.Focus();
        }
示例#3
0
 protected override void OnDropDown(EventArgs e)
 {
     lst.Visible = !lst.Visible;
     if (!lst.Visible)
     {
         //this.Focus();
         return;
     }
     lst.Focus();
     lst.ItemHeight  = this.ItemHeight;
     lst.BorderStyle = BorderStyle.FixedSingle;
     lst.Size        = new Size(this.DropDownWidth, this.ItemHeight * (this.MaxDropDownItems - 1) - (int)this.ItemHeight / 2);
     lst.Location    = new Point(this.Left, this.Top + this.ItemHeight + 6);
     lst.BeginUpdate();
     lst.Items.Clear();
     for (int i = 0; i < this.itemsList.Count; i++)
     {
         lst.Items.Add(this.itemsList[i]);
         if (this.checkedValues.ContainsKey(this.itemsList[i]))
         {
             lst.SetItemChecked(i, true);
         }
     }
     lst.EndUpdate();
     if (!this.Parent.Controls.Contains(lst))
     {
         this.Parent.Controls.Add(lst);
     }
     lst.BringToFront();
 }
示例#4
0
        //下拉列表事件
        protected override void OnDropDown(EventArgs e)
        {
            if (IsMultiSelect)
            {
                list.Visible = !list.Visible;
                if (list.Visible)
                {
                    list.Focus();
                    list.ItemHeight  = this.ItemHeight;
                    list.BorderStyle = BorderStyle.FixedSingle;
                    list.Font        = this.Font;
                    list.Size        = new Size(this.DropDownWidth, this.ItemHeight * (this.MaxDropDownItems - 1) - (int)this.ItemHeight / 2);
                    list.Location    = new Point(this.Left, this.Top + this.ItemHeight + 6);

                    list.BeginUpdate();
                    if (this.DataSource != null)
                    {
                        list.DataSource    = this.DataSource;
                        list.DisplayMember = this.DisplayMember;
                        list.ValueMember   = this.ValueMember;
                    }

                    list.EndUpdate();

                    if (!this.Parent.Controls.Contains(list))
                    {
                        this.Parent.Controls.Add(list);
                        list.BringToFront();
                    }
                }
            }
        }
示例#5
0
        public static bool inputError <T>(object obj, string errorMessage)
        {
            hasMessage(errorMessage);
            if (typeof(T) == typeof(TextBox))
            {
                TextBox control = (TextBox)obj;
                control.SelectAll();
                control.Focus();
            }
            else if (typeof(T) == typeof(ComboBox))
            {
                ComboBox control = (ComboBox)obj;
                control.Focus();
            }
            else if (typeof(T) == typeof(DateTimePicker))
            {
                DateTimePicker control = (DateTimePicker)obj;
                control.Focus();
            }
            else if (typeof(T) == typeof(CheckedListBox))
            {
                CheckedListBox control = (CheckedListBox)obj;
                control.Focus();
            }

            return(false);
        }
示例#6
0
        private void MoveListRow(int offset, CheckedListBox lb)
        {
            if (lb.SelectedIndex < 0)
            {
                return;
            }
            int idx = lb.SelectedIndex;

            if ((offset == -1 && idx == 0) || (offset == 1 && idx == lb.Items.Count - 1))
            {
                return;
            }

            string s  = lb.Items[idx].ToString();
            bool   ch = false;

            ch = lb.GetItemChecked(idx);
            lb.Items.RemoveAt(idx);
            lb.Items.Insert(idx + offset, s);
            lb.SetItemChecked(idx + offset, ch);
            lb.Refresh();
            lb.SetSelected(idx, false);
            lb.Focus();
            lb.SetSelected(idx + offset, true);
        }
 protected override void OnMouseUp(MouseEventArgs e)
 {
     if (IsMultiSelect)
     {
         this.DroppedDown = false;
         lst.Focus();
     }
 }
示例#8
0
    private void showEditParams(String[] urlParams)
    {
        paramsForm                 = new Form();
        paramsForm.Width           = 560;
        paramsForm.Height          = 440;
        paramsForm.Text            = "Please select parameters to edit..";
        paramsForm.FormBorderStyle = FormBorderStyle.FixedDialog;
        paramsForm.StartPosition   = FormStartPosition.CenterParent;
        paramsForm.MinimizeBox     = false;
        paramsForm.MaximizeBox     = false;

        // add url label
        TextBox txtUrl = new TextBox();

        txtUrl.ReadOnly = true;
        txtUrl.Location = new Point(20, 10);
        txtUrl.Width    = paramsForm.Width - 40;
        txtUrl.Text     = editWithSession.fullUrl;
        paramsForm.Controls.Add(txtUrl);

        // jsonp type option
        chkJsonp           = new CheckBox();
        chkJsonp.Text      = "Is this a JSONP request? I'll replace response body with the value you selected.";
        chkJsonp.Location  = new Point(20, 40);
        chkJsonp.Width     = paramsForm.Width - 40;
        chkJsonp.BackColor = Color.DarkOrange;
        paramsForm.Controls.Add(chkJsonp);

        // add params ui
        paramList          = new CheckedListBox();
        paramList.Location = new Point(20, 70);
        paramList.Width    = paramsForm.Width - 40;
        paramList.Height   = 300;
        paramList.Items.AddRange(urlParams);
        //paramList.CheckOnClick = true;

        for (int i = 0; i < paramList.Items.Count; i++)
        {
            paramList.SetItemChecked(i, true);
        }

        paramsForm.Controls.Add(paramList);

        // add "Edit it!" button
        Button btn_go = new Button();

        btn_go.Text     = "Edit it!";
        btn_go.Width    = 250;
        btn_go.Height   = 22;
        btn_go.Location = new Point(paramsForm.Width / 2 - btn_go.Width / 2, 370);
        btn_go.Click   += new EventHandler(this.OnFeditParamsWithClick);
        paramsForm.Controls.Add(btn_go);

        paramsForm.AcceptButton = btn_go;
        paramList.Focus();

        paramsForm.ShowDialog();
    }
        void chkLst_Validating(object sender, CancelEventArgs e)
        {
            CheckedListBox miLst    = (CheckedListBox)sender;
            string         msjError = dicMsjError.First(item => item.Key == miLst.Name).Value;

            if (miLst.CheckedItems.Count == 0)
            {
                e.Cancel = true;
                miLst.Focus();
                this.errProvider.SetError(miLst, msjError);
            }
        }
示例#10
0
 public static bool clbEmpty(CheckedListBox box)
 {
     if (box.Text == "")
     {
         MessageBox.Show("Please choose an episode to play");
         box.Focus();
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#11
0
 public static void ValidirajCheckedListBox(CancelEventArgs e, ErrorProvider errorProvider, CheckedListBox checkedListBox, string message)
 {
     if (checkedListBox.CheckedItems.Count == 0)
     {
         e.Cancel = true;
         checkedListBox.Focus();
         errorProvider.SetError(checkedListBox, message);
     }
     else
     {
         e.Cancel = false;
         errorProvider.SetError(checkedListBox, null);
     }
 }
示例#12
0
        /// <summary>
        /// 跳转到指定的页数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripComboBox_GotoPage_SelectedIndexChanged(object sender, EventArgs e)
        {
            int iGotoPage = 0;

            int.TryParse(toolStripComboBox_GotoPage.Text, out iGotoPage);
            if (iGotoPage <= 0 || iGotoPage > _totalPageIndex)
            {
                return;
            }

            ShowDesignatePageItem(iGotoPage);
            _currentPageIndex = iGotoPage;

            _KeyWordCheckedListBox.Focus();
        }
示例#13
0
 private void CheckedChanged(CheckedListBox clb, bool check)
 {
     for (int i = 0; i < clb.Items.Count; i++)
     {
         clb.SetItemChecked(i, check);
     }
     clb.Refresh();
     clb.Focus();
     if (clb.SelectedIndex >= 0)
     {
         clb.SetSelected(clb.SelectedIndex, true);
     }
     else if (clb.Items.Count > 0)
     {
         clb.SetSelected(0, true);
     }
 }
 private void toolStripButtonFiltrPAT_Click(object sender, EventArgs e)
 {
     if (toolStripButtonFiltrPAT.Tag == null)
     {
         int            x    = toolStripFILTR.Location.X + toolStripButtonFiltrPAT.Bounds.Location.X;
         int            y    = toolStripFILTR.Location.Y + toolStripButtonFiltrPAT.Bounds.Location.Y + toolStripButtonFiltrPAT.Height;
         CheckedListBox list = listParam(ref x, y);
         toolStripButtonFiltrPAT.Tag = list;
         list.Leave    += new EventHandler(list_LostFocusPAT);
         list.KeyDown  += new KeyEventHandler(list_KeyDownPAT);
         list.GotFocus += new EventHandler(list_GotFocusPAT);
         this.Controls.Add(list);
         list.BringToFront();
         list.Focus();
     }
     else
     {
         statDiagnosisDataGridView.Focus();
     }
 }
示例#15
0
        private void MoveListViewItem(ref CheckedListBox lv, bool moveUp)
        {
            int selIdx;
            int newIdx;

            selIdx = lv.SelectedIndex;
            if (moveUp)
            {
                // ignore moveup of row(0)
                if (selIdx == 0)
                {
                    return;
                }

                newIdx = selIdx - 1;
            }
            else
            {
                // ignore movedown of last item
                if (selIdx == lv.Items.Count - 1)
                {
                    return;
                }

                newIdx = selIdx + 1;
            }

            Script s = (Script)lv.SelectedItem;

            lv.Items.RemoveAt(selIdx);
            lv.Items.Insert(newIdx, s);
            mAllowCheck = true;
            lv.SetItemChecked(newIdx, s.Enabled);
            mAllowCheck      = false;
            lv.SelectedIndex = newIdx;

            lv.Refresh();
            lv.Focus();
        }
示例#16
0
        private void m_clbUtilities_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            var currentFont = m_rtbDescription.SelectionFont;

#if __MonoCS__
            // Creating the bold equivalent of the current font doesn't seem to work in Mono,
            // as we crash shortly due to failures in GDIPlus.GdipMeasureString() using that
            // font.
            var boldFont = currentFont;
#else
            var boldFontStyle = FontStyle.Bold;
            using (var boldFont = new Font(currentFont.FontFamily, currentFont.Size, boldFontStyle))
#endif
            {
                m_whatDescription = m_whenDescription = m_redoDescription = null;
                ((IUtility)m_clbUtilities.SelectedItem).OnSelection();
                m_rtbDescription.Clear();
                // What
                m_rtbDescription.SelectionFont = boldFont;
                m_rtbDescription.AppendText(FwCoreDlgs.ksWhatItDoes);
                m_rtbDescription.AppendText(Environment.NewLine);
                m_rtbDescription.SelectionFont = currentFont;
                if (string.IsNullOrEmpty(m_whatDescription))
                {
                    m_rtbDescription.AppendText(FwCoreDlgs.ksQuestions);
                }
                else
                {
                    m_rtbDescription.AppendText(m_whatDescription);
                }
                m_rtbDescription.AppendText(string.Format("{0}{0}", Environment.NewLine));

                // When
                m_rtbDescription.SelectionFont = boldFont;
                m_rtbDescription.AppendText(FwCoreDlgs.ksWhenToUse);
                m_rtbDescription.AppendText(Environment.NewLine);
                m_rtbDescription.SelectionFont = currentFont;
                if (string.IsNullOrEmpty(m_whenDescription))
                {
                    m_rtbDescription.AppendText(FwCoreDlgs.ksQuestions);
                }
                else
                {
                    m_rtbDescription.AppendText(m_whenDescription);
                }
                m_rtbDescription.AppendText(string.Format("{0}{0}", Environment.NewLine));

                // Cautions
                m_rtbDescription.SelectionFont = boldFont;
                m_rtbDescription.AppendText(FwCoreDlgs.ksCautions);
                m_rtbDescription.AppendText(Environment.NewLine);
                m_rtbDescription.SelectionFont = currentFont;
                if (string.IsNullOrEmpty(m_redoDescription))
                {
                    m_rtbDescription.AppendText(FwCoreDlgs.ksQuestions);
                }
                else
                {
                    m_rtbDescription.AppendText(m_redoDescription);
                }
#if __MonoCS__
                // If we don't have a selection explicitly set, we will crash deep in the Mono
                // code (RichTextBox.cs:618, property SelectionFont:get) shortly.
                m_rtbDescription.Focus();
                m_rtbDescription.SelectionStart  = 0;
                m_rtbDescription.SelectionLength = 0;
                m_clbUtilities.Focus();
#endif
            }
        }
示例#17
0
        private void checkedListBox1_MouseHover(object sender, EventArgs e)
        {
            CheckedListBox cb = sender as CheckedListBox;

            cb.Focus();
        }
 /// <summary>
 /// 指定されたインデックスに該当するアイテムを選択状態にします。
 /// 非同期に実行します。
 /// </summary>
 /// <param name="checkedListBox">対象のチェックリストボックス。</param>
 /// <param name="index">インデックス。</param>
 static void EmulateChangeSelectedIndexInTarget(CheckedListBox checkedListBox, int index)
 {
     checkedListBox.Focus();
     checkedListBox.SelectedIndex = index;
 }
 /// <summary>
 /// チェック状態を設定します。
 /// 非同期で実行します。
 /// </summary>
 /// <param name="checkedListBox">対象のチェックリストボックス。</param>
 /// <param name="index">インデックス。</param>
 /// <param name="value">チェック状態。</param>
 static void EmulateCheckStateInTarget(CheckedListBox checkedListBox, int index, CheckState value)
 {
     checkedListBox.Focus();
     checkedListBox.SetItemCheckState(index, value);
 }
示例#20
0
    private void showEditParams(String[] urlParams)
    {
        paramsForm = new Form();
        paramsForm.Width = 560;
        paramsForm.Height = 440;
        paramsForm.Text = "Please select parameters to edit..";
        paramsForm.FormBorderStyle = FormBorderStyle.FixedDialog;
        paramsForm.StartPosition = FormStartPosition.CenterParent;
        paramsForm.MinimizeBox = false;
        paramsForm.MaximizeBox = false;

        // add url label
        TextBox txtUrl = new TextBox();
        txtUrl.ReadOnly = true;
        txtUrl.Location = new Point(20, 10);
        txtUrl.Width = paramsForm.Width - 40;
        txtUrl.Text = editWithSession.fullUrl;
        paramsForm.Controls.Add(txtUrl);

        // jsonp type option
        chkJsonp = new CheckBox();
        chkJsonp.Text = "Is this a JSONP request? I'll replace response body with the value you selected.";
        chkJsonp.Location = new Point(20, 40);
        chkJsonp.Width = paramsForm.Width - 40;
        chkJsonp.BackColor = Color.DarkOrange;
        paramsForm.Controls.Add(chkJsonp);

        // add params ui
        paramList = new CheckedListBox();
        paramList.Location = new Point(20, 70);
        paramList.Width = paramsForm.Width - 40;
        paramList.Height = 300;
        paramList.Items.AddRange(urlParams);
        //paramList.CheckOnClick = true;

        for (int i = 0; i < paramList.Items.Count; i++)
        {
            paramList.SetItemChecked(i, true);
        }

        paramsForm.Controls.Add(paramList);

        // add "Edit it!" button
        Button btn_go = new Button();
        btn_go.Text = "Edit it!";
        btn_go.Width = 250;
        btn_go.Height = 22;
        btn_go.Location = new Point(paramsForm.Width / 2 - btn_go.Width / 2, 370);
        btn_go.Click += new EventHandler(this.OnFeditParamsWithClick);
        paramsForm.Controls.Add(btn_go);

        paramsForm.AcceptButton = btn_go;
        paramList.Focus();

        paramsForm.ShowDialog();
    }
示例#21
0
        protected override void OnMouseDown(DataGridViewCellMouseEventArgs e)
        {
            Rectangle Rectangle1 = this.DataGridView.GetCellDisplayRectangle(this.ColumnIndex, -1, false);

            int x     = Rectangle1.Right - 40;
            int y     = 3;
            int width = Rectangle1.Height - 2 * y;

            Rectangle Rectangle2 = new Rectangle(x, y, width, width);



            if (Rectangle2.Contains(e.X + Rectangle1.Left, e.Y + Rectangle1.Top))
            {
                if (!this.DataGridView.Controls.Contains(checkedListBox))
                {
                    BindingSource BindingSource1 = this.DataGridView.DataSource as BindingSource;
                    DataTable     DataTable1     = BindingSource1.DataSource as DataTable;



                    List <string> ItemList = new List <string>();

                    for (int i = 0; i < DataTable1.Rows.Count; i++)
                    {
                        string string1 = DataTable1.Rows[i][this.ColumnIndex] + "";

                        if (!ItemList.Contains(string1))
                        {
                            ItemList.Add(string1);
                        }
                    }
                    ItemList.Sort();


                    if (!ValueListForFilter.ContainsKey(this.ColumnIndex))
                    {
                        ValueListForFilter[this.ColumnIndex] = new List <string>();
                    }

                    CurrentColumnIndex = this.ColumnIndex;

                    int ListBoxHeight = 0;

                    checkedListBox.Items.Clear();

                    foreach (string string1 in ItemList)
                    {
                        int int1 = checkedListBox.Items.Add(string1);
                        if (ValueListForFilter[this.ColumnIndex].Contains(string1))
                        {
                            checkedListBox.SetItemChecked(int1, true);
                        }
                        else
                        {
                            checkedListBox.SetItemChecked(int1, false);
                        }

                        if (ListBoxHeight < 200)
                        {
                            ListBoxHeight += 25;
                        }
                    }


                    checkedListBox.Bounds = new Rectangle(Rectangle1.X, Rectangle1.Bottom, Rectangle1.Width, ListBoxHeight);


                    checkedListBox.ItemCheck += checkedListBox_ItemCheck;
                    checkedListBox.LostFocus += checkedListBox_LostFocus;

                    this.DataGridView.Controls.Add(checkedListBox);

                    checkedListBox.Focus();
                }


                //this.DataGridView.InvalidateCell(this);

                //this.过滤ButtonClicked(this.ColumnIndex);
            }
            else
            {
                ListSortDirection direction = ListSortDirection.Ascending;
                if (this.DataGridView.SortedColumn == OwningColumn && this.DataGridView.SortOrder == SortOrder.Ascending)
                {
                    direction = ListSortDirection.Descending;
                }
                this.DataGridView.Sort(OwningColumn, direction);
            }

            base.OnMouseDown(e);
        }