當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.DataGridViewComboBoxColumn類代碼示例

本文整理匯總了C#中System.Windows.Forms.DataGridViewComboBoxColumn的典型用法代碼示例。如果您正苦於以下問題:C# DataGridViewComboBoxColumn類的具體用法?C# DataGridViewComboBoxColumn怎麽用?C# DataGridViewComboBoxColumn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataGridViewComboBoxColumn類屬於System.Windows.Forms命名空間,在下文中一共展示了DataGridViewComboBoxColumn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HienThiDataGridViewComboBoxColumn

 public void HienThiDataGridViewComboBoxColumn(DataGridViewComboBoxColumn cmbColumn)
 {
     cmbColumn.DataSource = m_KhoanChiData.LayDsKhoanChi("SELECT MaKC, TenKC FROM KhoanChi");
     cmbColumn.DisplayMember = "TenKC";
     cmbColumn.ValueMember = "MaKC";
     cmbColumn.DataPropertyName = "MaKC";
 }
開發者ID:hieu292,項目名稱:ngocminh,代碼行數:7,代碼來源:KhoanChiCtrl.cs

示例2: GetAppointmentIDsAndTests

        private void GetAppointmentIDsAndTests()
        {
            this.Clear();

            DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
            cmb.HeaderText = "Select Test";
            ComboBox cbTests = new ComboBox();
            foreach (LabTest test in testList)
            {
                cmb.Items.Add(test.TestType);
            }
            dgvAddTest.Columns.Add(cmb);

            

            //cbAppointmentID.SelectedIndexChanged -= cbAppointmentID_SelectedIndexChanged;
            //cbAppointmentID.DataSource = null;
            //cbAppointmentID.Items.Clear();
            //cbAppointmentID.SelectedIndexChanged += cbAppointmentID_SelectedIndexChanged;

            //appointmentsList = AppointmentController.GetAppointmentsWithoutDiagnosis();
            //cbAppointmentID.DataSource = appointmentsList;
            //cbAppointmentID.DisplayMember = "AppointmentID";
            //cbAppointmentID.ValueMember = "AppointmentID";

            //cbTest.SelectedIndexChanged -= cbTest_SelectedIndexChanged;
            //cbTest.DataSource = null;
            //cbTest.Items.Clear();
            //cbTest.SelectedIndexChanged += cbTest_SelectedIndexChanged;

            //testList = LabTestController.GetAllLabTests();
            //cbTest.DataSource = testList;
            //cbTest.DisplayMember = "TestType";
            //cbTest.ValueMember = "TestId";
        }
開發者ID:mwilian,項目名稱:healthcaresystem,代碼行數:35,代碼來源:frmAddTest.cs

示例3: EditDefaultFindings

        private string sql = "SELECT exam_type, findings FROM default_findings ORDER BY exam_type"; //●●●移植時要変更

        #endregion Fields

        #region Constructors

        public EditDefaultFindings()
        {
            InitializeComponent();
            //this.dgv.RowHeadersVisible = false;
            this.dgv.MultiSelect = false;
            this.dgv.Font = new Font(dgv.Font.Name, 12);
            this.dgv.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
            this.dgv.DataSource = dt;

            showList();

            //●●●移植時要変更
            dgv.Columns["exam_type"].Visible = false;
            dgv.Columns["findings"].HeaderText = Properties.Resources.Findings;
            dgv.Columns["findings"].DataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True;

            DataGridViewComboBoxColumn eTypeColumn = new DataGridViewComboBoxColumn();
            eTypeColumn.DataPropertyName = "exam_type";    //バインドされているデータを表示する
            eTypeColumn.DataSource = CLocalDB.localDB.Tables["all_exam_type"];
            eTypeColumn.ValueMember = "type_no";
            eTypeColumn.DisplayMember = "exam_name";
            eTypeColumn.HeaderText = Properties.Resources.ExamType;
            this.dgv.Columns.Add(eTypeColumn);

            this.dgv.Columns[1].DisplayIndex = 1;
            this.dgv.Columns[2].DisplayIndex = 0;
            dgv.Columns[2].ReadOnly = true;

            resizeColumns();
        }
開發者ID:KoichiHirahata,項目名稱:FindingsEditor,代碼行數:36,代碼來源:EditDefaultFindings.cs

示例4: CreateColumn

 public static DataGridViewColumn CreateColumn( DataGridViewColumnType columnType, String columnName, String columnText)
 {
     DataGridViewColumn col = null;
     switch (columnType)
     {
         case DataGridViewColumnType.MULTICOMBOBOX:
             col = new DataGridViewMultiColumnComboBoxColumn();
             break;
         case DataGridViewColumnType.COMBOBOX:
             col = new DataGridViewComboBoxColumn();
             break;
         case DataGridViewColumnType.TIME:
             col = new DataGridViewTimeColumn();
             break;
         case DataGridViewColumnType.DATE:
             col = new DataGridViewDateTimeColumn();
             break;
         case DataGridViewColumnType.CHECKBOX:
             col = new DataGridViewCheckBoxColumn();
             break;
         case DataGridViewColumnType.NUMBER:
         default:
             col = new DataGridViewTextBoxColumn();
             break;
     }
     col.DataPropertyName = columnName;
     col.Name = columnName;
     col.HeaderText = columnText;
     return col;
 }
開發者ID:anthanhcong,項目名稱:atc-demand-instruction-form,代碼行數:30,代碼來源:DataGridViewHelper.cs

示例5: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            _dg1 = new DataGridView();
            _dg1.AutoSize = true;

            _bsSites = new BindingSource();
            _bsSites.DataSource = _availableWebSites;

            _bs1 = new BindingSource();
            _bs1.DataSource = _toBeUpdatedList;
            _dg1.DataSource = _bs1;
            this.Controls.Add(_dg1);
            _dg1.Columns["WebSiteName"].Visible = false;
            _dg1.Columns["VDir"].Visible = false;
            _dg1.Columns["WebSiteId"].Visible = false;

            DataGridViewComboBoxColumn columnSites = new DataGridViewComboBoxColumn();
            columnSites.DataPropertyName = "WebSiteId";
            columnSites.HeaderText = "Available Sites";
            columnSites.Width = 120;

            columnSites.DataSource = _bsSites;
            columnSites.ValueMember = "WebSiteId";
            columnSites.DisplayMember = "WebSiteName";
            _dg1.Columns.Add(columnSites);
        }
開發者ID:rodchar,項目名稱:csgen,代碼行數:26,代碼來源:Form1.cs

示例6: SetupDataGridViewColumns

      private void SetupDataGridViewColumns()
      {
         dataGridView1.AutoGenerateColumns = false;

         var queryColumn = new DataGridViewComboBoxColumn();
         var columnChoices = GetQueryFieldChoices();
         queryColumn.Name = "Name";
         queryColumn.HeaderText = "Name";
         queryColumn.DataSource = columnChoices;
         queryColumn.DisplayMember = "Display";
         queryColumn.ValueMember = "Value";
         queryColumn.DataPropertyName = "Name";
         queryColumn.Width = 150;
         dataGridView1.Columns.Add(queryColumn);

         queryColumn = new DataGridViewComboBoxColumn();
         columnChoices = GetOperatorFieldChoices();
         queryColumn.Name = "Operator";
         queryColumn.HeaderText = "Operator";
         queryColumn.DataSource = columnChoices;
         queryColumn.DisplayMember = "Display";
         queryColumn.ValueMember = "Value";
         queryColumn.DataPropertyName = "Type";
         queryColumn.Width = 175;
         dataGridView1.Columns.Add(queryColumn);

         var valueColumn = new DataGridViewQueryValueColumn();
         valueColumn.Name = "Value";
         valueColumn.HeaderText = "Value";
         valueColumn.DataPropertyName = "Value";
         valueColumn.DefaultCellStyle.DataSourceNullValue = null;
         //valueColumn.Width = 200;
         valueColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
         dataGridView1.Columns.Add(valueColumn);
      }
開發者ID:harlam357,項目名稱:hfm-net,代碼行數:35,代碼來源:QueryDialog.cs

示例7: ListColumn_Load

		private void ListColumn_Load(object sender, EventArgs e)
		{
			DataSet ds = Program.StoreDB.GetCategoriesAndProducts();
			dataGridView1.DataSource = ds.Tables["Products"];

			// Remove the auto-generated CategoryID column.
			dataGridView1.Columns.Remove("CategoryID");

			// Create a list column for the CategoryID.
			DataGridViewComboBoxColumn listCol = new DataGridViewComboBoxColumn();
			listCol.DisplayIndex = 0;
			listCol.HeaderText = "Category";

			// This column is bound to the Products.CategoryID field.
			listCol.DataPropertyName = "CategoryID";

			// The list is filled from the Categories table.
			listCol.DataSource = ds.Tables["Categories"];
			listCol.DisplayMember = "CategoryName";
			listCol.ValueMember = "CategoryID";

			// Add the column.
			dataGridView1.Columns.Add(listCol);

		}
開發者ID:ehershey,項目名稱:development,代碼行數:25,代碼來源:ListColumn.cs

示例8: fillTrainingBags

        private void fillTrainingBags()
        {
            DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
            {
                dgvIndex.HeaderText = "Slot";
                dgvIndex.DisplayIndex = 0;
                dgvIndex.Width = 25;
                dgvIndex.ReadOnly = true;
                dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            }
            DataGridViewComboBoxColumn dgvBag = new DataGridViewComboBoxColumn
            {
                DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing
            };
            {
                foreach (string t in trba)
                    if (t.Length > 0)
                        dgvBag.Items.Add(t);

                dgvBag.DisplayIndex = 1;
                dgvBag.Width = 135;
                dgvBag.FlatStyle = FlatStyle.Flat;
            }
            dataGridView1.Columns.Add(dgvIndex);
            dataGridView1.Columns.Add(dgvBag);

            dataGridView1.Rows.Add(12);
            int offset = Main.SAV.SuperTrain + 0x308;
            for (int i = 0; i < 12; i++)
            {
                dataGridView1.Rows[i].Cells[0].Value = (i + 1).ToString();
                dataGridView1.Rows[i].Cells[1].Value = trba[sav[offset + i]];
            }
        }        
開發者ID:Bluestar012,項目名稱:PKHeX,代碼行數:34,代碼來源:SAV_SuperTrain.cs

示例9: BindGrid

 private void BindGrid()
 {
     try
     {
         Dictionary<string, ServiceControllerStatus> availableService = proxy.GetAvailableServices(sessionID);
         dataGridView_Services.Rows.Clear();
         DataGridViewRow row = null;
         DataGridViewComboBoxColumn comboboxColumn = new DataGridViewComboBoxColumn();
         //int rowCount;
         if (availableService != null)
         {
             foreach (string service in availableService.Keys)
             {
                 row = dataGridView_Services.Rows[dataGridView_Services.Rows.Add()];
                 row.Cells["serviceName"].Value = service;
                 row.Cells["serviceStatus"].Value = availableService[service].ToString();
                 row.Cells["serviceAction"].Value = "START";
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
開發者ID:TheProjecter,項目名稱:processmemoryanalyzer,代碼行數:25,代碼來源:PanelServicesHandler.cs

示例10: AddStateColoumn

        private void AddStateColoumn()
        {
            //originalTable.Columns.Add("State");

            stateComboBox = new DataGridViewComboBoxColumn();
            stateComboBox.HeaderText = "وضعیت";
            stateComboBox.Name = "StateComboBox";
            stateComboBox.MaxDropDownItems = 4;
            stateComboBox.Items.Add("در حال پرواز");
            stateComboBox.Items.Add("با تاخیر");
            stateComboBox.Items.Add("طبق قرار");
            stateComboBox.Items.Add("رسیده");

            FlightGridView.Columns.Add(stateComboBox);
            FlightGridView.Columns["OriginCountry"].HeaderText = "کشور مبدا";
            FlightGridView.Columns["OriginCity"].HeaderText = "شهر مبدا";
            FlightGridView.Columns["OriginAirport"].HeaderText = "فرودگاه مبدا";
            FlightGridView.Columns["DestinationCountry"].HeaderText = "کشور مقصد";
            FlightGridView.Columns["DestinationCity"].HeaderText = "شهر مقصد";
            FlightGridView.Columns["DestinationAirport"].HeaderText = "مقصد";
            FlightGridView.Columns["DepartureDate"].HeaderText = "زمان پرواز";
            FlightGridView.Columns["ArrivalDate"].HeaderText = "زمان فرود";
            FlightGridView.Columns["ActualDepartureDate"].HeaderText = "زمان پرواز واقعی";
            FlightGridView.Columns["ActualArrivalDate"].HeaderText = "زمان فرود واقعی";
            FlightGridView.Columns["Plane"].HeaderText = "هواپیما";
            FlightGridView.Columns["Cost"].HeaderText = "هزینه";

            UpdateStateColumn();
        }
開發者ID:jahandideh-iman,項目名稱:Airport-Reservation-System,代碼行數:29,代碼來源:DisplayFlightsPage.cs

示例11: ProcsSelect

        public ProcsSelect()
        {
            InitializeComponent();

            DataTable data = db.FetchAllSql("SELECT MAX(uin) FROM data");

            try
            {
                uin = Convert.ToInt32(data.Rows[0][0]) + 1;
            }
            catch (Exception) { }

            data = db.FetchAllSql("SELECT id,title,time_h,time_m,time_s FROM proc");

            int i = 0;
            foreach (DataRow dr in data.Rows)
            {
                this.comboB.Items.Add("(" + toTim(dr[2].ToString()) + ":" + toTim(dr[3].ToString()) + ":" + toTim(dr[4].ToString()) + ") " + dr[1]);
                dataUIN.Add(Convert.ToString(dr[0]));
                i++;
            }

            DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
            cmb.HeaderText = "Поряд.";
            cmb.Name = "cmb";
            cmb.Width = 50;

            for (int j = 1; j < 20; j++)
                cmb.Items.Add(j.ToString());

            dataG.Columns.Add(cmb);

            dataG.ReadOnly = true;
            dataG.DefaultCellStyle.ForeColor = Color.Gray;
        }
開發者ID:tatar1nro,項目名稱:KKM_Trash,代碼行數:35,代碼來源:ProcsSelect.cs

示例12: SetupDataGridViewColumns

 private void SetupDataGridViewColumns()
 {
     using (var col = new DataGridViewTextBoxColumn())
     {
         col.DataPropertyName = "Name";
         col.HeaderText = "Name";
         dgvNameEntries.Columns.Add(col);
         col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
     }
     using (var col = new DataGridViewComboBoxColumn())
     {
         col.DataPropertyName = "NamePosition";
         col.HeaderText = "Name Position";
         col.DataSource = Enum.GetValues(typeof(NamePosition));
         col.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
         dgvNameEntries.Columns.Add(col);
     }
     using (var col = new DataGridViewCheckBoxColumn())
     {
         col.DataPropertyName = "IsFemale";
         col.HeaderText = "Is Female";
         col.FalseValue = false;
         col.TrueValue = true;
         col.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
         dgvNameEntries.Columns.Add(col);
     }
 }
開發者ID:EterniaLogic,項目名稱:Pulsar4x,代碼行數:27,代碼來源:CommanderNameThemesDialog.cs

示例13: InitTodoMarkersGridView

        private void InitTodoMarkersGridView(IList<ToDoMarker> markers)
        {
            TodoMarkersGridView.AutoGenerateColumns = false;
            TodoMarkersGridView.Columns.Clear();
            TodoMarkersGridView.DataSource = new BindingList<ToDoMarker>(markers);
            TodoMarkersGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.Lavender;
            TodoMarkersGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            TodoMarkersGridView.CellValueChanged += SelectedPriorityChanged;
            TodoMarkersGridView.ColumnHeaderMouseClick += SortColumn;

            var markerTextColumn = new DataGridViewTextBoxColumn
            {
                Name = "Text",
                DataPropertyName = "Text",
                HeaderText = RubberduckUI.TodoSettings_Text,
                ReadOnly = true
            };

            var markerPriorityColumn = new DataGridViewComboBoxColumn
            {
                Name = "Priority",
                DataSource = TodoLabels(),
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
                HeaderText = RubberduckUI.TodoSettings_Priority,
                DataPropertyName = "PriorityLabel",
            };

            TodoMarkersGridView.Columns.AddRange(markerTextColumn, markerPriorityColumn);
        }
開發者ID:ThunderFrame,項目名稱:Rubberduck,代碼行數:29,代碼來源:TodoListSettingsUserControl.cs

示例14: btnLoad_Click

        private void btnLoad_Click(object sender, EventArgs e)
        {
            grdTickets.DataSource = manager.GetTicketsDataSet();
            grdTickets.DataMember = "tblTickets";

            DataGridViewTextBoxColumn clmId = new DataGridViewTextBoxColumn();
            clmId.Name = "IdColumn";
            clmId.DataPropertyName = "Id";

            DataGridViewTextBoxColumn clmAccountId = new DataGridViewTextBoxColumn();
            clmAccountId.Name = "AccountIdColumn";
            clmAccountId.DataPropertyName = "AccountId";

            DataGridViewTextBoxColumn clmDateOpened = new DataGridViewTextBoxColumn();
            clmDateOpened.Name = "DateOpenedColumn";
            clmDateOpened.DataPropertyName = "DateOpened";

            DataGridViewComboBoxColumn clmState = new DataGridViewComboBoxColumn();
            clmState.Name = "StateColumn";
            clmState.DataPropertyName = "State";

            clmState.DataSource = GetStates() ;
            clmState.DisplayMember ="Name" ;
            clmState.ValueMember="Value";

            grdTickets.Columns.Clear();
            grdTickets.Columns.Add(clmId);
            grdTickets.Columns.Add(clmAccountId);
            grdTickets.Columns.Add(clmDateOpened);
            grdTickets.Columns.Add(clmState);
        }
開發者ID:AdriVanHoudt,項目名稱:School,代碼行數:31,代碼來源:Form1.cs

示例15: InitUI

        private void InitUI()
        {
            this.passwordAttributesDGV.RowHeadersVisible = true;
            this.passwordAttributesDGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            this.passwordAttributesDGV.MultiSelect = false;
            this.passwordAttributesDGV.AllowUserToAddRows = true;

            this.passwordAttributesDGV.Columns.Add(new DataGridViewTextBoxColumn()
            {
                Name = "Attribute Name",
                DataPropertyName = "Name",
                HeaderText = "Attribute Name",
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
                ReadOnly = false
            });
            DataGridViewComboBoxColumn combCol = new DataGridViewComboBoxColumn()
            {
                Name = "Hash Method",
                DataPropertyName = "HashMethod",
                HeaderText = "Hash Method",
                AutoSizeMode = DataGridViewAutoSizeColumnMode.None,
                Width = 250,
                DisplayMember = "Name",
                ValueMember = "Method",
            };
            this.passwordAttributesDGV.DefaultValuesNeeded += passwordAttributesDGV_DefaultValuesNeeded;
            combCol.Items.AddRange(PasswordHashMethod.methods.Values.ToArray());
            this.passwordAttributesDGV.Columns.Add(combCol);

            m_encryptionMethodCb.Items.Add("No Encryption");    // Settings.EncryptionMethod.NO_ENCRYPTION
            m_encryptionMethodCb.Items.Add("SSL (ldaps://)");   // Settings.EncryptionMethod.TLS_SSL
            m_encryptionMethodCb.Items.Add("StartTLS");         // Settings.EncryptionMethod.START_TLS
        }
開發者ID:rafu1,項目名稱:pgina,代碼行數:33,代碼來源:Configuration.cs


注:本文中的System.Windows.Forms.DataGridViewComboBoxColumn類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。