Form1.cs
上传用户:cpw91211
上传日期:2021-01-18
资源大小:46k
文件大小:1k
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace CustomComboDemo
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- // Dynamically created controls.
- // Create grid view control.
- DataGridView gridView = new DataGridView();
- gridView.BorderStyle = BorderStyle.None;
- gridView.Columns.Add("Column1", "Column 1");
- gridView.Columns.Add("Column2", "Column 2");
- gridView.Columns.Add("Column3", "Column 3");
- gridView.Columns.Add("Column4", "Column 4");
- gridView.Columns.Add("Column5", "Column 5");
- this.customComboBox1.DropDownControl = gridView;
- // Create user control.
- UserControl1 userControl = new UserControl1();
- userControl.BorderStyle = BorderStyle.None;
- this.customComboBox2.DropDownControl = userControl;
- // Create rich textbox control.
- RichTextBox richTextBox = new RichTextBox();
- richTextBox.BorderStyle = BorderStyle.None;
- this.customComboBox3.DropDownControl = richTextBox;
- }
- }
- }