示例#1
0
 public FrmSetOrdEditTable(int id)
 {
     InitializeComponent();
     _id = id;
     for (int i = 0; i < AllowTypeAry.Length; i++)
     {
         CCBoxItem item = new CCBoxItem(AllowTypeAry[i], i);
         chkAllowType.Items.Add(item);
     }
     chkAllowType.MaxDropDownItems = 5;
     chkAllowType.DisplayMember    = "Name";
     chkAllowType.ValueSeparator   = ",";
 }
示例#2
0
 /// <summary>绑定自定义控件CheckedComboBox
 ///
 /// </summary>
 /// <param name="cbkCheckedComboBox">控件</param>
 /// <param name="dtSource">DataTable数据源</param>
 /// <param name="strDisplayMember">显示字段</param>
 /// <param name="strValueMember">值字段</param>
 /// <param name="intCheckedIndex">默认勾选项数组,从0开始</param>
 /// <param name="intMaxDropDownItems">最大项数</param>
 /// <param name="strValueSeparator">分隔符</param>
 public static void BindCheckedComboBox(CheckedComboBox cbkCheckedComboBox, DataTable dtSource, string strDisplayMember, string strValueMember, int[] intCheckedIndex = null, int intMaxDropDownItems = 5, string strValueSeparator = ",")
 {
     foreach (DataRow drRow in dtSource.Rows)
     {
         CCBoxItem item = new CCBoxItem(drRow[strDisplayMember].ToString(), drRow[strValueMember].ToString());
         cbkCheckedComboBox.Items.Add(item);
     }
     cbkCheckedComboBox.MaxDropDownItems = intMaxDropDownItems;
     cbkCheckedComboBox.DisplayMember    = strDisplayMember;
     cbkCheckedComboBox.ValueMember      = strValueMember;
     cbkCheckedComboBox.ValueSeparator   = strValueSeparator;
     if (intCheckedIndex != null)
     {
         for (int i = 0; i < intCheckedIndex.Length; i++)
         {
             cbkCheckedComboBox.SetItemChecked(i, true);
         }
     }
 }
示例#3
0
        private void frmDictionaryLogin_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < LoadTypeAry.Length; i++)
            {
                CCBoxItem item = new CCBoxItem(LoadTypeAry[i], i);
                chkAllowType.Items.Add(item);
            }
            chkAllowType.MaxDropDownItems = 3;
            chkAllowType.DisplayMember    = @"Name";
            chkAllowType.ValueSeparator   = @",";
            chkAllowType.SetItemChecked(0, true);
            m_dt      = new DataTable();
            m_dalConn = new DbConnectDAL();
            if (this.dbType == SqlType.MySql)
            {
                label2.Text = @"端口号:";
                cboLogin.Items.Clear();
                cboLogin.Text = @"3306";
            }
            else if (this.dbType == SqlType.SqlServer)
            {
                cboLogin.SelectedIndex = 0;
            }
            BindComboBox();
            this.cboServer.SelectedIndexChanged += cboServer_SelectedIndexChanged;

            if (cboServer.Items.Count > 0)
            {
                cboServer_SelectedIndexChanged(null, null);
            }
            else
            {
                this.cboServer.Select();
            }

#if DEBUG
            btnOK_Click(null, null);
#endif
        }
示例#4
0
        private void FrmSqlSerach_Load(object sender, EventArgs e)
        {
            #region 绑定服务器,已加载数据库
            if (GlobalHelp.DicSqlServerDatabaseSchema.Count > 0)
            {
                chkDB.DisplayMember  = "Name";
                chkDB.ValueSeparator = ",";
                foreach (KeyValuePair <string, Dictionary <string, DatabaseSchema> > item in GlobalHelp.DicSqlServerDatabaseSchema)
                {
                    cboServer.Items.Add(item.Key);
                    foreach (KeyValuePair <string, DatabaseSchema> itemDB in item.Value)
                    {
                        CCBoxItem itemInfo = new CCBoxItem(itemDB.Key, itemDB.Key);
                        chkDB.Items.Add(itemInfo);
                    }
                }
                chkDB.MaxDropDownItems = chkDB.Items.Count;
                for (int i = 0; i < chkDB.Items.Count; i++)
                {
                    chkDB.SetItemChecked(i, true);
                }
                cboServer.SelectedIndex = 0;
            }
            #endregion


            #region 绑定类型
            chkType.MaxDropDownItems = 4;
            chkType.DisplayMember    = "Name";
            chkType.ValueSeparator   = ",";
            for (int i = 0; i < LoadTypeAry.Length; i++)
            {
                CCBoxItem item = new CCBoxItem(LoadTypeAry[i], i);
                chkType.Items.Add(item);
                chkType.SetItemChecked(i, true);
            }
            #endregion
        }