GetItemChecked() public method

public GetItemChecked ( int index ) : bool
index int
return bool
Ejemplo n.º 1
0
 private bool kiemtra()
 {
     if (ma.Text == "")
     {
         ma.Focus();
         return(false);
     }
     if (ten.Text == "")
     {
         ten.Focus();
         return(false);
     }
     if (computer.SelectedIndex == -1)
     {
         computer.Focus();
         return(false);
     }
     s_nhomkho = "";
     for (int i = 0; i < nhomkho.Items.Count; i++)
     {
         if (nhomkho.GetItemChecked(i))
         {
             s_nhomkho += dtnhom.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     s_makho = "";
     for (int i = 0; i < makho.Items.Count; i++)
     {
         if (makho.GetItemChecked(i))
         {
             s_makho += dtkho.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
 private void loai_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     s_loai = "";
     for (int i = 0; i < loai.Items.Count; i++)
     {
         if (loai.GetItemChecked(i))
         {
             s_loai += dtloai.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     if (s_loai != "")
     {
         s_loai = s_loai.Substring(0, s_loai.Length - 1);
         sql    = "select * from " + user + ".d_loaiphieu where loai in (" + s_loai + ")";
         if (nhom.SelectedIndex != -1)
         {
             sql += " and nhom=" + int.Parse(nhom.SelectedValue.ToString());
         }
         sql    += " order by stt";
         dtphieu = d.get_data(sql).Tables[0];
     }
     else
     {
         dtphieu = d.get_data("select * from " + user + ".d_loaiphieu where id=-1").Tables[0];
     }
     phieu.DataSource    = dtphieu;
     phieu.DisplayMember = "TEN";
     phieu.ValueMember   = "ID";
 }
Ejemplo n.º 3
0
 private void _categories_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
 {
     #region Ensure that the at least one category is selected
     if (e.NewValue == CheckState.Checked)
     {
         btnSave.Enabled = true;
     }
     else
     {
         bool enable = false;
         for (int i = 0; i < _categories.Items.Count; i++)
         {
             if (_categories.GetItemChecked(i))
             {
                 btnSave.Enabled = true;
                 enable          = true;
             }
         }
         if (!enable)
         {
             btnSave.Enabled = false;
         }
     }
     #endregion
 }
Ejemplo n.º 4
0
 private void load_grid()
 {
     s_mapt = "'";
     if (muc.SelectedItems.Count > 0)
     {
         for (int i = 0; i < muc.Items.Count; i++)
         {
             if (muc.GetItemChecked(i))
             {
                 s_mapt += dtmuc.Rows[i]["ma"].ToString() + "','";
             }
         }
     }
     sql  = "select b.ten,a.mapt,a.mapttt,a.noi_dung,nullif(a.dacbiet,' ') as dacbiet,nullif(a.loai1,' ') as loai1,nullif(a.loai2,' ') as loai2,nullif(a.loai3,' ') as loai3,a.loaipt,a.id_pttt,a.id_muc from " + user + ".dmpttt a," + user + ".muc b";
     sql += " where substr(a.mapt,1,3)=b.ma ";
     if (s_mapt.Length > 1)
     {
         sql += "and substr(a.mapt,1,3) in (" + s_mapt.Substring(0, s_mapt.Length - 2) + ")";
     }
     sql               += " order by a.id_muc,a.mapt";
     ds                 = m.get_data(sql);
     pttt.DataSource    = ds.Tables[0];
     pttt.DisplayMember = "NOI_DUNG";
     pttt.ValueMember   = "MAPT";
 }
Ejemplo n.º 5
0
 private void butOk_Click(object sender, System.EventArgs e)
 {
     mmyy = mm.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
     if (!ttb.bMmyy(mmyy))
     {
         MessageBox.Show("Số liệu tháng " + mmyy.Substring(0, 2) + " năm 20" + mmyy.Substring(2) + " chưa tạo !", ttb.Msg);
         mm.Focus();
         return;
     }
     xxx = user;//+ mmyy;
     if (ttb.bKhoaso(i_nhom, mmyy))
     {
         MessageBox.Show("Số liệu tháng " + mmyy.Substring(0, 2) + " năm " + mmyy.Substring(2, 2) + "\nĐã khóa không có phép thay đổi !", ttb.Msg);
         return;
     }
     if (makho.CheckedItems.Count == 0)
     {
         for (int i = 0; i < makho.Items.Count; i++)
         {
             makho.SetItemCheckState(i, CheckState.Checked);
         }
     }
     s_tenkho = "";
     for (int i = 0; i < makho.Items.Count; i++)
     {
         if (makho.GetItemChecked(i))
         {
             s_tenkho += dtkho.Rows[i]["ten"].ToString() + "\n";
         }
     }
     if (MessageBox.Show("Bạn có đồng ý kiểm tra lại tồn đầu \n" + s_tenkho + "Tháng " + mmyy.Substring(0, 2) + " năm " + mmyy.Substring(2, 2), ttb.Msg, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         Cursor = Cursors.WaitCursor;
         string mmyyt = ttb.Mmyy_truoc(mmyy);
         if (!ttb.bKhoaso(i_nhom, mmyyt))
         {
             ttb.upd_tonkho(mmyyt, i_nhom, 1);
         }
         for (int i = 0; i < makho.Items.Count; i++)
         {
             if (makho.GetItemChecked(i))
             {
                 ttb.upd_kiemtratondau(mmyy, int.Parse(dtkho.Rows[i]["id"].ToString()), i_userid);
             }
         }
         ttb.upd_tonkho(mmyy, i_nhom, 1);
         ttb.execute_data("delete from " + xxx + ".ttb_tonkhoct where tondau=0 and slnhap=0 and slxuat=0 and mmyy='" + mmyy + "'");
         ttb.execute_data("delete from " + xxx + ".ttb_tonkhoth where tondau=0 and slnhap=0 and slxuat=0 and mmyy='" + mmyy + "'");
         Cursor = Cursors.Default;
         MessageBox.Show("Đã kiểm tra lại tồn đầu \n" + s_tenkho, ttb.Msg);
     }
 }
Ejemplo n.º 6
0
        private void btUp_Click(object sender, System.EventArgs e)
        {
            int n = clsOrder.SelectedIndex;

            if (n > 0)
            {
                object s = clsOrder.Items[n];
                bool   b = clsOrder.GetItemChecked(n);
                clsOrder.Items.RemoveAt(n);
                clsOrder.Items.Insert(n - 1, s);
                clsOrder.SetItemChecked(n - 1, b);
                clsOrder.SelectedIndex = n - 1;
            }
        }
Ejemplo n.º 7
0
        private void get_data()
        {
            s_kho = "";
            for (int i = 0; i < makho.Items.Count; i++)
            {
                if (makho.GetItemChecked(i))
                {
                    s_kho += dtdmkho.Rows[i]["id"].ToString().Trim() + ",";
                }
            }
            tao_table();
            s_mmyy = tu.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
            if (d.bMmyy(s_mmyy))
            {
                items_tondau(s_mmyy);
            }
            int itu = Convert.ToInt16(tu.Value), iden = Convert.ToInt16(den.Value);

            for (int i = itu; i <= iden; i++)
            {
                s_mmyy = i.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
                if (d.bMmyy(s_mmyy))
                {
                    items_nhap(s_mmyy);
                    items_xuat(s_mmyy);
                }
            }
            if (ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show(lan.Change_language_MessageText("Không có số liệu !"), d.Msg);
                return;
            }
            get_sort();
            exp_excel(false);
        }
Ejemplo n.º 8
0
 public void Config_Save(System.IO.StreamWriter sw)
 {
     sw.Write("txtExcelTemp={0}\r\n", txtExcelTemp.Text);
     //save excel file(template) list
     for (int i = 0; i < lstExcelTemp.Items.Count; i++)
     {
         if (lstExcelTemp.GetItemChecked(i))
         {
             sw.Write("ExcelTemplateList={0}={1}\r\n", lstExcelTemp.Items[i].ToString(), "on");
         }
         else
         {
             sw.Write("ExcelTemplateList={0}={1}\r\n", lstExcelTemp.Items[i].ToString(), "off");
         }
     }
     sw.Write("txtExcel={0}\r\n", lstExcel.Tag);
     //save excel file(table) list
     for (int i = 0; i < lstExcel.Items.Count; i++)
     {
         if (lstExcel.GetItemChecked(i))
         {
             sw.Write("ExcelTableList={0}={1}\r\n", lstExcel.Items[i].ToString(), "on");
         }
         else
         {
             sw.Write("ExcelTableList={0}={1}\r\n", lstExcel.Items[i].ToString(), "off");
         }
     }
 }
Ejemplo n.º 9
0
        private void butIn_Click(object sender, System.EventArgs e)
        {
            string s_makp = "";

            if (makp.SelectedItems.Count > 0)
            {
                for (int i = 0; i < makp.Items.Count; i++)
                {
                    if (makp.GetItemChecked(i))
                    {
                        s_makp += dtkp.Rows[i]["makp"].ToString() + ",";
                    }
                }
            }
            s_makp = (s_makp != "")?s_makp.Substring(0, s_makp.Length - 1):"";
            ds     = exp.get_bctiepbenh(mm.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString(), s_makp);
            if (ds.Tables[0].Rows.Count > 0)
            {
                dllReportM.frmReport f = new dllReportM.frmReport(m, ds,
                                                                  lan.Change_language_MessageText("Tháng") + " " + mm.Value.ToString().PadLeft(2, '0') + " " +
                                                                  lan.Change_language_MessageText("năm") + " " + yyyy.Value.ToString(), "rptBctiepbenh.rpt");
                f.ShowDialog();
            }
            else
            {
                MessageBox.Show(lan.Change_language_MessageText("Không có số liệu !"), AccessData.Msg);
            }
        }
Ejemplo n.º 10
0
        private void kiemtra_toa()
        {
            string s_tenkho = "", s_title = "Từ ngày " + tu.Text + " đến ngày " + den.Text;

            if (tu.Text == den.Text)
            {
                s_title = "Ngày " + tu.Text;
            }
            s_kho = "";
            if (kho.CheckedItems.Count > 0)
            {
                for (int i = 0; i < kho.Items.Count; i++)
                {
                    if (kho.GetItemChecked(i))
                    {
                        s_kho    += dtkho.Rows[i]["id"].ToString() + ",";
                        s_tenkho += dtkho.Rows[i]["ten"].ToString() + ",";
                    }
                }
            }
            get_data();
            if (ds.Tables[0].Rows.Count <= 0)
            {
                MessageBox.Show(
                    lan.Change_language_MessageText("Không có số liệu."), d.Msg, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                dsxml.Clear();
                dsxml.Merge(ds.Tables[0].Select("true", "tennhom"));
                frmReport f = new frmReport(d, dsxml.Tables[0], i_userid, "d_laigop.rpt", "", s_title, s_tenkho, "", "", "", s_tenkho, "", "", "");
                f.ShowDialog();
            }
        }
Ejemplo n.º 11
0
 private bool kiemtra()
 {
     if (ten.Text == "")
     {
         ten.Focus();
         return(false);
     }
     if (loai.SelectedIndex == -1)
     {
         loai.Focus();
         return(false);
     }
     s_nguon = "";
     for (int i = 0; i < nguon.Items.Count; i++)
     {
         if (nguon.GetItemChecked(i))
         {
             s_nguon += dtnguon.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     s_nhom = "";
     for (int i = 0; i < manhom.Items.Count; i++)
     {
         if (manhom.GetItemChecked(i))
         {
             s_nhom += dtnhom.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     return(true);
 }
Ejemplo n.º 12
0
 private void taotable()
 {
     ds    = new DataSet();
     cont  = " where a.makp='" + makp.SelectedValue.ToString() + "' and a.done<>0";
     cont += " and a.ngay between to_date('" + tu.Text + "'," + stime + ") and to_date('" + den.Text + "'," + stime + ")";
     if (madoituong.SelectedIndex != -1)
     {
         cont += " and b.madoituong=" + int.Parse(madoituong.SelectedValue.ToString());
     }
     if (manv.Text != "")
     {
         cont += " and b.yta='" + manv.Text + "'";
     }
     s_phieu = ""; s_tenphieu = "";
     for (int i = 0; i < phieu.Items.Count; i++)
     {
         if (phieu.GetItemChecked(i))
         {
             s_phieu    += dtphieu.Rows[i]["id"].ToString().Trim() + ",";
             s_tenphieu += dtphieu.Rows[i]["ten"].ToString().Trim() + ",";
         }
     }
     if (s_phieu != "")
     {
         cont += " and a.phieu in (" + s_phieu.Substring(0, s_phieu.Length - 1) + ")";
     }
     if (s_tenphieu != "")
     {
         s_tenphieu = s_tenphieu.Substring(0, s_tenphieu.Length - 1);
     }
     ds = m.getinbaoan(tu.Text, den.Text, cont, true);
 }
Ejemplo n.º 13
0
 private void butChon_Click(object sender, System.EventArgs e)
 {
     if (makp.SelectedIndex == -1)
     {
         makp.Focus(); return;
     }
     if (phieu.SelectedIndex == -1)
     {
         phieu.Focus(); return;
     }
     s_phieu = "";
     if (phieudutru.CheckedItems.Count > 0)
     {
         for (int i = 0; i < phieudutru.Items.Count; i++)
         {
             if (phieudutru.GetItemChecked(i))
             {
                 s_phieu += dtph.Rows[i]["id"].ToString().Trim() + ",";
             }
         }
     }
     s_tu    = tu.Text; s_den = den.Text; i_phieu = int.Parse(phieu.SelectedValue.ToString()); i_makp = int.Parse(makp.SelectedValue.ToString());
     s_tenkp = makp.Text;
     if (ttb.get_duyet(s_mmyy, i_makp, i_nhom, i_loai, i_phieu, s_ngay, s_makho))
     {
         MessageBox.Show("Ngày " + s_ngay + "\nKhoa " + makp.Text + "\nPhiếu " + phieu.Text + "\nĐã duyệt !", ttb.Msg);
         return;
     }
     this.Close();
 }
        /// <summary>
        ///   Moves selected item up or down.
        /// </summary>
        /// <param name="direction"></param>
        private void MoveSelectedItem(MoveDirection direction)
        {
            Debug.Assert(m_checkedListBoxVersions.SelectedItems.Count == 1);
            int  index              = m_checkedListBoxVersions.SelectedIndex;
            bool isChecked          = m_checkedListBoxVersions.GetItemChecked(index);
            AssemblyVersionType avt = (AssemblyVersionType)m_checkedListBoxVersions.Items[index];

            m_checkedListBoxVersions.Items.RemoveAt(index);
            int newIndex = index;

            switch (direction)
            {
            case MoveDirection.Down:
                newIndex++;
                break;

            case MoveDirection.Up:
                newIndex--;
                break;

            default:
                Debug.Assert(false, "Not supported MoveDirection");
                break;
            }
            m_checkedListBoxVersions.Items.Insert(newIndex, avt);
            m_checkedListBoxVersions.SetItemChecked(newIndex, isChecked);
            m_checkedListBoxVersions.SelectedIndex = newIndex;
        }
Ejemplo n.º 15
0
 private void butFtp_Click(object sender, System.EventArgs e)
 {
     try
     {
         ftp.setDebug(true);
         ftp.setRemoteHost(m.Host);
         ftp.setRemoteUser(m.User);
         ftp.setRemotePass(m.Pass);
         ftp.login();
         ftp.chdir(m.Dir);
         ftp.setBinaryMode(true);
         for (int i = 0; i < checkedListBox1.Items.Count; i++)
         {
             if (checkedListBox1.GetItemChecked(i))
             {
                 ftp.upload(checkedListBox1.Items[i].ToString());
             }
         }
         ftp.close();
         MessageBox.Show(lan.Change_language_MessageText("Đã hoàn thành !"), LibMedi.AccessData.Msg);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, LibMedi.AccessData.Msg);
     }
 }
Ejemplo n.º 16
0
        private void btGoUp_Click(object sender, System.EventArgs e)
        {
            int index = checkedListBox1.SelectedIndex;

            if (index > 0)
            {
                Layer layer = checkedListBox1.SelectedItem as Layer;

                bool flag = checkedListBox1.GetItemChecked(index);
                layer.GoUp();
                checkedListBox1.Items.Remove(layer);
                checkedListBox1.Items.Insert(index - 1, layer);
                checkedListBox1.SetItemChecked(index - 1, flag);
                checkedListBox1.SelectedItem = layer;
            }
        }
Ejemplo n.º 17
0
        private void butIn_Click(object sender, System.EventArgs e)
        {
            s_mmyy = mm.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
            ds.Clear();
            s_kho = ""; s_tenkho = "";
            if (kho.SelectedItems.Count > 0)
            {
                for (int i = 0; i < kho.Items.Count; i++)
                {
                    if (kho.GetItemChecked(i))
                    {
                        s_kho    += dtkho.Rows[i]["id"].ToString().Trim() + ",";
                        s_tenkho += dtkho.Rows[i]["ten"].ToString().Trim() + ",";
                    }
                }
            }
            get_tonkhoct();
            if (ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show(lan.Change_language_MessageText("Không có số liệu !"), d.Msg);
                return;
            }
            get_sort();
            tenfile = (chkAB.Checked)?"d_bctonkho_abc.rpt":(chkChitiet.Checked)?"d_bctonkho_ct.rpt":"d_bctonkho.rpt";
            frmReport f = new frmReport(d, dsxml.Tables[0], i_userid, tenfile, "Tháng " + mm.Value.ToString().PadLeft(2, '0') + " năm " + yyyy.Value.ToString(), s_tenkho, nguon.Text, "", "", "", "", "", "", "");

            f.ShowDialog();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Edits a value based on some user input which is collected from a character control.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            _dialogProvider = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            List<int> layerList = new List<int>();
            LayoutLegend legend = context.Instance as LayoutLegend;
            LayoutMap map = null;
            if (legend != null)
                map = legend.Map;
            if (map == null)
                return layerList;

            CheckedListBox lb = new CheckedListBox();
            
            List<int> originalList = value as List<int>;
            if (originalList != null)
            {
                for (int i = map.MapControl.Layers.Count - 1; i >= 0 ; i--)
                    lb.Items.Add(map.MapControl.Layers[i].LegendText, originalList.Contains(i));
            }
            
            _dialogProvider.DropDownControl(lb);

            for (int i = 0; i < lb.Items.Count; i ++)
            {
                if (lb.GetItemChecked(i))
                    layerList.Add(lb.Items.Count - 1 -i);
            }

            return layerList;
        }
Ejemplo n.º 19
0
 private bool kiemtra()
 {
     if (ma.Text == "")
     {
         ma.Focus();
         return(false);
     }
     if (ten.Text == "")
     {
         ten.Focus();
         return(false);
     }
     s_makp = "";
     if (makp.SelectedItems.Count > 0)
     {
         for (int i = 0; i < makp.Items.Count; i++)
         {
             if (makp.GetItemChecked(i))
             {
                 s_makp += dtkp.Rows[i]["makp"].ToString() + ",";
             }
         }
     }
     return(true);
 }
Ejemplo n.º 20
0
        private void butIn_Click(object sender, System.EventArgs e)
        {
            s_tu  = tu.Value.ToString().PadLeft(2, '0');
            s_den = den.Value.ToString().PadLeft(2, '0');
            s_yy  = yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
            //
            s_kho = "";
            for (int i = 0; i < kho.Items.Count; i++)
            {
                if (kho.GetItemChecked(i))
                {
                    s_kho += dtdmkho.Rows[i]["id"].ToString() + ",";
                }
            }
            s_kho = (s_kho != "")?s_kho.Substring(0, s_kho.Length - 1):s_makho;
            //
            load_ctughiso(No.Text, Co.Text, s_kho);
            string s_mg = "Từ tháng " + tu.Value.ToString().PadLeft(2, '0') + " đến tháng " + den.Value.ToString().PadLeft(2, '0') + " năm " + yyyy.Value.ToString();

            if (tu.Value == den.Value)
            {
                s_mg = "Tháng " + tu.Value.ToString().PadLeft(2, '0') + " năm " + yyyy.Value.ToString();
            }
            frmReport f = new frmReport(ttb, ds.Tables[0], "d_ctghiso.rpt", s_mg, "", "", "", "", "", "", "", "", "");

            f.ShowDialog();
        }
Ejemplo n.º 21
0
        private void bieu_04(bool prn)
        {
            s_makp = ""; s_tenkp = "";
            if (makp.CheckedItems.Count > 0)
            {
                for (int i = 0; i < makp.Items.Count; i++)
                {
                    if (makp.GetItemChecked(i))
                    {
                        s_makp  += dtkp.Rows[i]["makp"].ToString().Trim() + ",";
                        s_tenkp += dtkp.Rows[i]["tenkp"].ToString().Trim() + ";";
                    }
                }
            }
            s_tenkp = (s_tenkp != "")?s_tenkp.Substring(0, s_tenkp.Length - 1):"";
            string tit = (s_tenkp != "")?title + " " + s_tenkp:title;

            ds = e.bieu_04_khoa(s_makp, s_tu, s_den, s_table);
            if (m.getrowbyid(ds.Tables[0], "c01+c02+c03+c04+c05+c06+c07+c08+c09+c10>0") == null)
            {
                MessageBox.Show("Không có số liệu !", LibMedi.AccessData.Msg);
            }
            else
            {
                if (prn)
                {
                    p.Printer(m, ds, "bieu_04.rpt", tit.ToUpper(), 2);
                }
                else
                {
                    frmReport f = new frmReport(m, ds, tit.ToUpper(), "bieu_04.rpt");
                    f.ShowDialog(this);
                }
            }
        }
        private void btnDeleteSelected_Click(object sender, System.EventArgs e)
        {
            int nCount = deleteCourseList.Items.Count;

            for (int i = 0; i < nCount; i++)
            {
                if (deleteCourseList.GetItemChecked(i))
                {
                    string courseGuid = courseGuids[i];
                    if (courseGuid != null && courseGuid != String.Empty)
                    {
                        FacultyTools fac = new FacultyTools(m_applicationObject);
                        fac.UnregisterAssignmentManagerCourse(courseGuid);

                        try
                        {
                            //Get AM Server
                            XmlNode xmlCourse  = xmlDoc.SelectSingleNode("/managedcourses/course/assnmgr[guid='" + courseGuid + "']");
                            XmlNode xmlServer  = xmlCourse.SelectSingleNode("amurl");
                            string  deletePath = xmlServer.InnerText;
                            if (deletePath != String.Empty)
                            {
                                deletePath += "/Faculty/DeleteCourse.aspx?CourseID=" + courseGuid;
                                m_applicationObject.ItemOperations.Navigate(deletePath, vsNavigateOptions.vsNavigateOptionsNewWindow);
                            }
                        }
                        catch
                        {
                            //ignore the error.  If something fails then we can't delete from the server but still removed from local machine.
                        }
                    }
                }
            }
            this.Close();
        }
Ejemplo n.º 23
0
        private void DeleteRoutes(Gui.CheckedListBox listView, Worksheet routeSheet, bool isPreset)
        {
            int count = 2;

            for (int i = listView.Items.Count - 1; i >= 0; i--)
            {
                if (listView.GetItemChecked(i))
                {
                    routes[i].deleteRoute(routeSheet, routeBook, isPreset, reader);
                    routes.RemoveAt(i);
                    listView.Items.Remove(listView.Items[i]);

                    if (!isPreset)
                    {
                        foreach (Route route in routes)
                        {
                            route.Row--;
                        }
                    }
                }
            }

            if (isPreset)
            {
                foreach (Route preset in routes)
                {
                    dataSheet.Cells[count, preset.Column].Value = preset.grade;
                    count++;
                }
            }
            routeBook.Save();
        }
Ejemplo n.º 24
0
        private void butIn_Click(object sender, System.EventArgs e)
        {
            string s_makp = "";

            if (makp.SelectedItems.Count > 0)
            {
                for (int i = 0; i < makp.Items.Count; i++)
                {
                    if (makp.GetItemChecked(i))
                    {
                        s_makp += dtkp.Rows[i]["makp"].ToString() + ",";
                    }
                }
            }
            s_makp = (s_makp != "")?s_makp.Substring(0, s_makp.Length - 1):"";
            ds     = exp.get_btngtru(tu.Text, den.Text, s_makp, time.Checked);
            if (ds.Tables[0].Rows.Count > 0)
            {
                dllReportM.frmReport f = new dllReportM.frmReport(m, ds, (tu.Text == den.Text)?
                                                                  lan.Change_language_MessageText("Ngày") + " " + tu.Text:
                                                                  lan.Change_language_MessageText("Từ ngày") + " " + tu.Text + " " +
                                                                  lan.Change_language_MessageText("đến") + " " + den.Text, "rptbtngtr.rpt", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                f.ShowDialog();
            }
            else
            {
                MessageBox.Show(lan.Change_language_MessageText("Không có số liệu !"), AccessData.Msg);
            }
        }
Ejemplo n.º 25
0
 private void butIn_Click(object sender, System.EventArgs e)
 {
     s_makp = "'";
     if (makp.CheckedItems.Count == 0)
     {
         for (int i = 0; i < makp.Items.Count; i++)
         {
             makp.SetItemCheckState(i, CheckState.Checked);
         }
     }
     for (int i = 0; i < makp.Items.Count; i++)
     {
         if (makp.GetItemChecked(i))
         {
             s_makp += dtkp.Rows[i]["makp"].ToString() + "','";
         }
     }
     s_makp = (s_makp != "")?s_makp.Substring(0, s_makp.Length - 2):"";
     ds     = exp.get_thngtru(tu.Text, den.Text, s_makp, time.Checked);
     if (ds.Tables[0].Rows.Count > 0)
     {
         frmReport f = new frmReport(m, ds, (tu.Text == den.Text)?"Ngày " + tu.Text:"Từ ngày " + tu.Text + " đến " + den.Text, "rptthngtr.rpt", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
         f.ShowDialog();
     }
     else
     {
         MessageBox.Show(lan.Change_language_MessageText("Không có số liệu !"), LibMedi.AccessData.Msg);
     }
 }
Ejemplo n.º 26
0
 private bool kiemtra()
 {
     if (ma.Text == "")
     {
         ma.Focus();
         return(false);
     }
     if (ten.Text == "")
     {
         ten.Focus();
         return(false);
     }
     s_nhomkho = "";
     for (int i = 0; i < nhomkho.Items.Count; i++)
     {
         if (nhomkho.GetItemChecked(i))
         {
             s_nhomkho += dtnhom.Rows[i]["id"].ToString().Trim().PadLeft(2, '0') + ",";
         }
     }
     s_makp = "";
     for (int i = 0; i < makp.Items.Count; i++)
     {
         if (makp.GetItemChecked(i))
         {
             s_makp += dtkp.Rows[i]["id"].ToString().Trim().PadLeft(3, '0') + ",";
         }
     }
     return(true);
 }
Ejemplo n.º 27
0
        private bool kiemtra()
        {
            s_kho = "";
            if (kho.CheckedItems.Count == 0)
            {
                for (int i = 0; i < kho.Items.Count; i++)
                {
                    kho.SetItemCheckState(i, CheckState.Checked);
                }
            }
            for (int i = 0; i < kho.Items.Count; i++)
            {
                if (kho.GetItemChecked(i))
                {
                    s_kho += dtdmkho.Rows[i]["id"].ToString() + ",";
                }
            }
            sql = "select * from ttb_dmkho where nhom=" + i_nhom;
            if (s_kho != "")
            {
                sql += " and id in (" + s_kho.Substring(0, s_kho.Length - 1) + ")";
            }
            if (s_makho != "")
            {
                sql += " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ")";
            }
            sql  += " order by stt";
            dtkho = ttb.get_data(sql).Tables[0];
            Tao_dataset();
            //
            //
            DateTime dt1 = ttb.StringToDate(tu.Text).AddDays(-ttb.iNgaykiemke);
            DateTime dt2 = ttb.StringToDate(den.Text).AddDays(ttb.iNgaykiemke);
            int      y1 = dt1.Year, m1 = dt1.Month;
            int      y2 = dt2.Year, m2 = dt2.Month;
            int      itu, iden;
            string   mmyy = "";

            for (int i = y1; i <= y2; i++)
            {
                itu  = (i == y1)?m1:1;
                iden = (i == y2)?m2:12;
                for (int j = itu; j <= iden; j++)
                {
                    mmyy = j.ToString().PadLeft(2, '0') + i.ToString().Substring(2, 2);
                    if (ttb.bMmyy(mmyy))
                    {
                        get_xuat(mmyy);
                        get_hoantra(mmyy);
                    }
                }
            }
            if (ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("Không có số liệu !", ttb.Msg);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 28
0
        private void butXem_Click(object sender, System.EventArgs e)
        {
            s_mmyy = tu.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
            s_tu   = yy.Value.ToString().PadLeft(4, '0').Substring(2) + tu.Value.ToString().PadLeft(2, '0');
            s_den  = yyyy.Value.ToString().PadLeft(4, '0').Substring(2) + den.Value.ToString().PadLeft(2, '0');
            s_yy   = yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
            s_kho  = "";
            for (int i = 0; i < kho.Items.Count; i++)
            {
                if (kho.GetItemChecked(i))
                {
                    s_kho += dtdmkho.Rows[i]["id"].ToString() + ",";
                }
            }
            if (s_kho == "")
            {
                s_kho = s_makho + ",";
            }
            s_nhombd = "";
            for (int i = 0; i < nhombd.Items.Count; i++)
            {
                if (nhombd.GetItemChecked(i))
                {
                    s_nhombd += dtnhombd.Rows[i]["id"].ToString() + ",";
                }
            }
            ds = new DataSet();
            if (opt1.Checked == true || opt2.Checked == true)
            {
                ds.Tables.Add(get_dmbd());
            }
            else if (opt5.Checked)
            {
                get_gia();
                exp_excel(false, true);
                return;
            }
            else
            {
                get_biendonggia();
                exp_excel(false, false);
                return;
            }
            string s_tenkho  = "";
            string s_tennhom = "";
            string s_rpt     = (opt1.Checked)?"d_dmbd_nt.rpt":"d_dmbd_nt1.rpt";

            s_rpt = (opt3.Checked)?"d_dmbd_gia.rpt":s_rpt;          //report the doi gia
            if (s_rpt != "")
            {
                frmReport f = new frmReport(d, ds.Tables[0], i_userid, s_rpt, s_tenkho, s_tennhom, "", "", "", "", "", "", "", "");
                f.ShowDialog();
            }
            else
            {
                MessageBox.Show(
                    lan.Change_language_MessageText("Đề nghị chọn lại!"));
            }
        }
Ejemplo n.º 29
0
        private bool kiemtra()
        {
            if (tu.Value > den.Value)
            {
                MessageBox.Show(
                    lan.Change_language_MessageText("Tháng không hợp lệ !"), d.Msg);
                tu.Focus();
                return(false);
            }
            s_makho = "";
            if (kho.CheckedItems.Count == 0)
            {
                for (int i = 0; i < kho.Items.Count; i++)
                {
                    kho.SetItemCheckState(i, CheckState.Checked);
                }
            }
            for (int i = 0; i < kho.Items.Count; i++)
            {
                if (kho.GetItemChecked(i))
                {
                    s_makho += dtkho.Rows[i]["id"].ToString() + ",";
                }
            }
            dtdmkho = d.get_data("select * from " + user + ".d_dmkho where hide=0 and nhom=" + i_nhom + " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ") order by stt").Tables[0];

            Tao_dataset();
            s_mmyy = tu.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
            s_tu   = tu.Value.ToString().PadLeft(2, '0');
            s_den  = den.Value.ToString().PadLeft(2, '0');
            s_yy   = yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2);
            //
            int    y1 = int.Parse(yyyy.Value.ToString()), m1 = int.Parse(tu.Value.ToString());
            int    y2 = int.Parse(yyyy.Value.ToString()), m2 = int.Parse(den.Value.ToString());
            int    itu, iden;
            string mmyy = "";

            for (int i = y1; i <= y2; i++)
            {
                itu  = (i == y1)?m1:1;
                iden = (i == y2)?m2:12;
                for (int j = itu; j <= iden; j++)
                {
                    mmyy = j.ToString().PadLeft(2, '0') + i.ToString().Substring(2, 2);
                    if (d.bMmyy(mmyy))
                    {
                        get_nhap(mmyy);
                    }
                }
            }
            //
            if (ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show(
                    lan.Change_language_MessageText("Không có số liệu !"), d.Msg);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 30
0
            public virtual int IndexOf(object item)
            {
                int result = -1;

                for (int i = 0; i < owner.Items.Count; i++)
                {
                    if (owner.GetItemChecked(i))
                    {
                        result++;
                        if (owner.Items[i] == item)
                        {
                            return(result);
                        }
                    }
                }
                return(-1);
            }
Ejemplo n.º 31
0
 private void clbTaste_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     txtTaste.Text = "";
     for (int i = 0; i <= clbTaste.Items.Count - 1; i++)
     {
         if (clbTaste.GetItemChecked(i))
         {
             if (txtTaste.Text.Trim() == "")
             {
                 txtTaste.Text = clbTaste.Items[i].ToString();
             }
             else
             {
                 txtTaste.Text = txtTaste.Text + "," + (clbTaste.Items[i]);
             }
         }
     }
 }
Ejemplo n.º 32
0
 private void GetMaterials(ref EDPlanet obj, CheckedListBox box)
 {
     for (int i = 0; i < box.Items.Count; i++)
     {
         string item = (string)box.Items[i];
         MaterialEnum mat = obj.MaterialFromString(item);
         obj.materials[mat] =  box.GetItemChecked(i);
     }
 }
Ejemplo n.º 33
0
        public static Boolean checkBoxListEmpty(CheckedListBox cbl)
        {
            for (int i = 0; i < cbl.Items.Count; i++)
            {
                if (cbl.GetItemChecked(i) == true) return false;
            }
            return true;

        }
Ejemplo n.º 34
0
 private bool CheckedListBoxItemsAreAllUnchecked(CheckedListBox listbox)
 {
     for (int i = 0; i < listbox.Items.Count; i++)
     {
         if (listbox.GetItemChecked(i))
             return false;
     }
     return true;
 }
Ejemplo n.º 35
0
 public void UpdateActiveSitesInSetup(CheckedListBox sitesList)
 {
     ActiveSites.Clear();
     for (var index = 0; index < sitesList.Items.Count; index++)
     {
         var active = sitesList.GetItemChecked(index);
         if (active)
         {
             ActiveSites.Add((string) (sitesList.Items[index]));
         }
     }
 }
Ejemplo n.º 36
0
 public static string GetCheckedItems(CheckedListBox cblItems)
 {
     string resultList = "";
     for (int i = 0; i < cblItems.CheckedItems.Count; i++)
     {
         if (cblItems.GetItemChecked(i))
         {
             resultList += string.Format("{0},", cblItems.GetItemText(cblItems.Items[i]));
         }
     }
     return resultList.Trim(',');
 }
Ejemplo n.º 37
0
 public static String get_CheckListBox(CheckedListBox chk)
 {
     string tmp = "";
     for (int r = 0; r < chk.Items.Count; r++)
     {
         if (chk.GetItemChecked(r))
         {
             string ID = ((ListItem)chk.Items[r]).ID;
             tmp += " " + ID;
         }
     }
     return tmp.Trim();
 }
Ejemplo n.º 38
0
        private void getStrings(CheckedListBox listBox, ref StringList strings)
        {
            int i;

            for (i = 0; i < listBox.Items.Count; i++)
            {
                if (listBox.GetItemChecked(i))
                {
                    String itemText = listBox.Items[i].ToString();
                    strings.Add(itemText);
                }
            }
        }
Ejemplo n.º 39
0
 /// <summary>
 /// Left mouse click: check/uncheck the item.
 /// Middle mouse click: remove item.
 /// Right mouse click: send item from chList1 to chList2.
 /// </summary>
 /// <param name="chList1"> The handled checkedListBox. </param>
 /// <param name="chList2"> The dual checkedListBox. </param>
 /// <param name="e"> The mouse click event. </param>
 public static void DualChListMouseEvent(CheckedListBox chList1, CheckedListBox chList2, MouseEventArgs e, Point mousePosition, bool useDual = true)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (i != 0 || useDual)
             {
                 if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
                 {
                     chList2.AddOrderedFromBottom(chList1.GetText(i), chList1.GetItemChecked(i));
                     chList1.Items.RemoveAt(i);
                 }
             }
         }
     }
     else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (i != 0 || useDual)
             {
                 if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
                 {
                     chList1.Items.RemoveAt(i);
                 }
             }
         }
     }
     else if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
             {
                 switch (chList1.GetItemCheckState(i))
                 {
                     case CheckState.Checked:
                         chList1.SetItemCheckState(i, CheckState.Unchecked);
                         break;
                     case CheckState.Indeterminate:
                     case CheckState.Unchecked:
                         chList1.SetItemCheckState(i, CheckState.Checked);
                         break;
                 }
             }
         }
     }
 }
Ejemplo n.º 40
0
        /// <summary>
        /// Save the excludes to the UserFilters
        /// </summary>
        /// <param name="listbox"></param>
        /// <param name="userExcludeTypes"></param>
        private void SetExcludes(CheckedListBox listbox, List<Type> userExcludeTypes)
        {
            for (int i = 0; i < listbox.Items.Count; i++)
            {
                Type typeObj = (Type)listbox.Items[i];

                if (listbox.GetItemChecked(i))
                {
                    if (!userExcludeTypes.Contains(typeObj))
                        userExcludeTypes.Add(typeObj);
                }
                else
                    userExcludeTypes.Remove(typeObj);
            }
        }
Ejemplo n.º 41
0
        public static bool CheckedListValidator(CheckedListBox ch)
        {
            var hasChecked = false;
            for (int i = 0; i < ch.Items.Count; i++)
            {
                if (ch.GetItemChecked(i))
                {
                    hasChecked = true;
                    break;
                }
            }
            if (hasChecked==false)
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 42
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="list"></param>
		/// <param name="moveDown"></param>
		/// ------------------------------------------------------------------------------------
		protected void MoveListItem(CheckedListBox list, bool moveDown)
		{
			Debug.Assert(list != null);

			int index = list.SelectedIndex;
			bool isChecked = list.GetItemChecked(index);

			// Don't allow moving if there is no current item or moving down when the current
			// item is the last item in the list or moving up when the current item is the first
			// item in the list.
			if (index < 0 || (moveDown && index == list.Items.Count - 1) ||
				(!moveDown && index == 0))
				return;

			// Store the selected writing system and remove it.
			var ws = (ILgWritingSystem)list.SelectedItem;
			list.Items.RemoveAt(index);

			// Determine the new place in the list for the stored writing system. Then
			// insert it in its new location in the list.
			index += (moveDown ? 1 : -1);
			list.Items.Insert(index, ws);

			// Now restore the writing system's checked state and select it.
			list.SetItemChecked(index, isChecked);
			list.SelectedIndex = index;
		}
Ejemplo n.º 43
0
 public static void InverseSelection(CheckedListBox tab)
 {
     for (int x = 0; x <= tab.Items.Count - 1; x++)
     {
         if (tab.GetItemChecked(x))
         {
             tab.SetItemChecked(x, false);
         }
         else
         {
             tab.SetItemChecked(x, true);
         }
     }
 }
Ejemplo n.º 44
0
        /// <summary>
        /// Overrides the method used to provide basic behaviour for selecting editor.
        /// Shows our custom control for editing the value.
        /// </summary>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null || context.Instance == null || provider == null)
                return value;

            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null)
            {
                // Create a CheckedListBox and populate it with all the enum values
                clb = new CheckedListBox();
                clb.BorderStyle = BorderStyle.FixedSingle;
                clb.CheckOnClick = true;
                clb.MouseDown += new MouseEventHandler(this.OnMouseDown);

                wxFlags ht = (wxFlags)value;
                foreach (wxFlagsItem d in ht)
                {
                    clb.Items.Add(new wxFlagsItem(d.Name, d.Value, d.Checked), d.Checked);
                }

                // Show our CheckedListbox as a DropDownControl.
                // This methods returns only when the dropdowncontrol is closed
                edSvc.DropDownControl(clb);

                wxFlags retflags = new wxFlags();
                int i = 0;
                retflags.ToLong = 0;
                foreach(wxFlagsItem item in clb.Items)
                {
                    bool b;
                    if (clb.GetItemChecked(i))
                    {
                        b = true;
                        retflags.ToLong |= item.Value;
                    }  else
                    {
                        b = false;
                        // retflags.ToLong = retflags.ToLong & (~item.Value);
                    }
                    retflags.AddItem(item.Name, item.Value, b);
                    i++;
                }
                return retflags;
            }
            return value;
        }
Ejemplo n.º 45
0
 private void checkAnswer(CheckedListBox clb, int ind)
 {
     if (clb.SelectedIndex != -1)
     {
         for (int i = 0; i < 4; i++)
         {
             if (i != clb.SelectedIndex && clb.GetItemChecked(i))
                 clb.SetItemChecked(i, false);
         }
         clb.ClearSelected();
     }
 }
Ejemplo n.º 46
0
		public void GetItemCheckedTest ()
		{
			Form f = new Form ();
			f.ShowInTaskbar = false;
			f.Visible = true;
			CheckedListBox mychklistbox = new CheckedListBox ();
			mychklistbox.Items.Add ("test1",true);
			mychklistbox.Items.Add ("test2",CheckState.Indeterminate);
			mychklistbox.Items.Add ("test3");
			mychklistbox.Visible = true;
			f.Controls.Add (mychklistbox);
			Assert.AreEqual (true, mychklistbox.GetItemChecked (0), "#10");
			Assert.AreEqual (true, mychklistbox.GetItemChecked (1), "#11");
			Assert.AreEqual (false, mychklistbox.GetItemChecked (2), "#12");
			f.Dispose ();
		}	
Ejemplo n.º 47
0
 private void uncheckAll(CheckedListBox checkedListBox)
 {
     for (int i = 0; i < checkedListBox.Items.Count; i++)
     {
         if (checkedListBox.GetItemChecked(i))
         {
             checkedListBox.SetItemChecked(i, false);
         }
     }
 }
Ejemplo n.º 48
0
    private void listDown(CheckedListBox listBox)
    {
      if (listBox.SelectedIndex == -1 || listBox.SelectedIndex == listBox.Items.Count - 1)
        return;

      object selected;
      object next;
      object temp;

      bool selectedChecked;
      bool nextChecked;
      bool tempChecked;

      selected = listBox.Items[listBox.SelectedIndex];
      selectedChecked = listBox.GetItemChecked(listBox.SelectedIndex);
      next = listBox.Items[listBox.SelectedIndex + 1];
      nextChecked = listBox.GetItemChecked(listBox.SelectedIndex + 1);

      temp = selected;
      tempChecked = selectedChecked;
      selected = next;
      selectedChecked = nextChecked;
      next = temp;
      nextChecked = tempChecked;

      listBox.Items[listBox.SelectedIndex] = selected;
      listBox.SetItemChecked(listBox.SelectedIndex, selectedChecked);
      listBox.Items[listBox.SelectedIndex + 1] = next;
      listBox.SetItemChecked(listBox.SelectedIndex + 1, nextChecked);

      listBox.SelectedIndex++;
    }
Ejemplo n.º 49
0
		public void GetItemCheckedExceptionTest ()
		{
			CheckedListBox mychklistbox = new CheckedListBox ();
			mychklistbox.Items.Add ("test1",true);
			Assert.AreEqual (true, mychklistbox.GetItemChecked (1), "#13");
		}
Ejemplo n.º 50
0
 private void CheckSelectedListItem(CheckedListBox clb)
 {
     if (clb.SelectedIndex < 0)
         return;
     clb.SetItemChecked(clb.SelectedIndex, !clb.GetItemChecked(clb.SelectedIndex));
 }
Ejemplo n.º 51
0
 public static void topSelection(CheckedListBox tab)
 {
     if (tab.SelectedIndex.ToString() != "-1")
     {
         bool etatItem = tab.GetItemChecked(tab.SelectedIndex);
         int index;
         string valeur;
         while (tab.SelectedIndex > 0)
         {
             valeur = tab.SelectedItem.ToString();
             index = tab.SelectedIndex;
             tab.Items.RemoveAt(index);
             tab.Items.Insert(index - 1, valeur);
             tab.SetSelected(index - 1, true);
         }
         tab.SetItemChecked(tab.SelectedIndex, etatItem);
     }
 }
Ejemplo n.º 52
0
        public static int selectItemIndex(CheckedListBox clb)
        {
            for (int i = 0; i < clb.Items.Count; i++)
            {
                if (clb.GetItemChecked(i)) return i;

            }
            return 0;
        }
Ejemplo n.º 53
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="clb"></param>
        /// <returns></returns>
        private static IEnumerable<int> GetSelectedNamespaces(CheckedListBox clb)
        {
            List<int> ret = new List<int>();
            for (int i = 0; i < clb.Items.Count; i++)
            {
                if (clb.GetItemChecked(i))
                    ret.Add(((NSItem) clb.Items[i]).Key);
            }

            return ret;
        }
Ejemplo n.º 54
0
        public static void ApplyTags(string key, CheckedListBox box, ItemCheckEventArgs e)
        {
            if (Resetting > 0) return;

            object[] vals = new object[box.CheckedItems.Count + (e.NewValue == CheckState.Checked ? 1 : -1)];
            int d = 0;
            for (int c = 0; c < box.Items.Count; c++)
            {
                if (box.GetItemChecked(c))
                {
                    if (c != e.Index || e.NewValue != CheckState.Unchecked)
                    {
                        vals[d] = box.Items[c].ToString();
                        d++;
                    }
                }
            }
            if (e.NewValue == CheckState.Checked)
                vals[d] = box.Items[e.Index].ToString();

            if (key.Equals("material") && vals.Length == 1)
                ApplyValue(key, vals[0], ((JsonFormTag)box.Tag).mandatory);
            else
                ApplyValue(key, vals, ((JsonFormTag)box.Tag).mandatory);
        }
Ejemplo n.º 55
0
 private static List<string> ExtractionListeModsValides(CheckedListBox ListBox,string cheminModsFSF)
 {
     List<string> listeModsValide= new List<string>();
     int compteur=0;
     foreach (string lignes in ListBox.Items)
     {
         if (ListBox.GetItemChecked(compteur)) { listeModsValide.Add(cheminModsFSF + lignes); }
         compteur++;
     }
     return listeModsValide;
 }
Ejemplo n.º 56
0
 public static void diminueSelection(CheckedListBox tab)
 {
     if (tab.SelectedIndex.ToString() != "-1")
     {
         if (tab.SelectedIndex < tab.Items.Count - 1)
         {
             bool etatItem = tab.GetItemChecked(tab.SelectedIndex);
             string valeur = tab.SelectedItem.ToString();
             int index = tab.SelectedIndex;
             tab.Items.RemoveAt(index);
             tab.Items.Insert(index + 1, valeur);
             tab.SetItemChecked(index + 1, etatItem);
             tab.SetSelected(index + 1, true);
         }
     }
 }
Ejemplo n.º 57
0
    private void listUp(CheckedListBox listBox)
    {
      if (listBox.SelectedIndex == -1 || listBox.SelectedIndex == 0)
        return;

      object selected;
      object previous;
      object temp;

      bool selectedChecked;
      bool previousChecked;
      bool tempChecked;

      selected = listBox.Items[listBox.SelectedIndex];
      selectedChecked = listBox.GetItemChecked(listBox.SelectedIndex);
      previous = listBox.Items[listBox.SelectedIndex - 1];
      previousChecked = listBox.GetItemChecked(listBox.SelectedIndex - 1);

      temp = selected;
      tempChecked = selectedChecked;
      selected = previous;
      selectedChecked = previousChecked;
      previous = temp;
      previousChecked = tempChecked;

      listBox.Items[listBox.SelectedIndex] = selected;
      listBox.SetItemChecked(listBox.SelectedIndex, selectedChecked);
      listBox.Items[listBox.SelectedIndex - 1] = previous;
      listBox.SetItemChecked(listBox.SelectedIndex - 1, previousChecked);

      listBox.SelectedIndex--;
    }
Ejemplo n.º 58
0
 private void UpdateShape(CheckedListBox chkLst, Shape shape)
 {
     int intCount = shape.GDIPropertyCount;
     for (short i = 0; i < intCount; i++)
     {
        shape.SetGDIValue(i, chkLst.GetItemChecked(i));
     }
 }
Ejemplo n.º 59
0
 private void checkFormaciones(CheckedListBox clb)
 {
     if (clb.GetItemChecked(clb.SelectedIndex))
     {
         clb.SetItemChecked(clb.SelectedIndex, false);
     }
     else
     {
         clb.SetItemChecked(clb.SelectedIndex, true);
     }
 }
Ejemplo n.º 60
0
		/// <override></override>
		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) {
			if (context != null && context.Instance != null && provider != null) {
				IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
				if (edSvc != null && context.Instance is Shape) {
					Shape shape = (Shape)context.Instance;
					using (CheckedListBox listBox = new CheckedListBox()) {
						listBox.BorderStyle = BorderStyle.None;
						listBox.IntegralHeight = false;
						listBox.Items.Clear();

						// Add existing layers and check shape's layers
						foreach (Layer l in shape.Diagram.Layers) {
							int idx = listBox.Items.Count;
							listBox.Items.Insert(idx, l);
							listBox.SetItemChecked(idx, ((shape.Layers & l.Id) != 0));
						}

						edSvc.DropDownControl(listBox);
						LayerIds shapeLayers = LayerIds.None;
						for (int i = listBox.Items.Count - 1; i >= 0; --i) {
							if (listBox.GetItemChecked(i))
								shapeLayers |= ((Layer)listBox.Items[i]).Id;
						}
						shape.Diagram.RemoveShapeFromLayers(shape, LayerIds.All);
						shape.Diagram.AddShapeToLayers(shape, shapeLayers);

						value = shapeLayers;
					}
				}
			}
			return value;
		}