如何更改单元格的组合框风格DataGridViewComboBoxColumn组合、单元格、如何更改、风格

由网友(鱼爱海的蓝却不知天的湛)分享简介:在DataGridViewComboBoxColumn细胞具有ComboBoxStyle的DropDownList。这意味着用户只能从下拉菜单中选择值。底层控制组合框,因此它可以有风格的下拉列表。我要如何改变DataGridViewComboBoxColumn基础组合框的样式。或者,更一般的,可我有一列的DataGri...

在DataGridViewComboBoxColumn细胞具有ComboBoxStyle的DropDownList。这意味着用户只能从下拉菜单中选择值。底层控制组合框,因此它可以有风格的下拉列表。我要如何改变DataGridViewComboBoxColumn基础组合框的样式。或者,更一般的,可我有一列的DataGridView与下拉,其中用户可以键入?

解决方案

 无效dataGridView1_EditingControlShowing(对象发件人,
    DataGridViewEditingControlShowingEventArgs五)
{
    如果(e.Control.GetType()== typeof运算(DataGridViewComboBoxEditingControl))
    {
        DataGridViewComboBoxEditingControl CBO =
            e.Control为DataGridViewComboBoxEditingControl;
        cbo.DropDownStyle = ComboBoxStyle.DropDown;
    }
}
 

与组合框和数据绑定的DataGridView 易语言怎么通过组合框的选择更改字体大小

Cells in DataGridViewComboBoxColumn have ComboBoxStyle DropDownList. It means the user can only select values from the dropdown. The underlying control is ComboBox, so it can have style DropDown. How do I change the style of the underlying combo box in DataGridViewComboBoxColumn. Or, more general, can I have a column in DataGridView with dropdown where user can type?

解决方案

void dataGridView1_EditingControlShowing(object sender, 
    DataGridViewEditingControlShowingEventArgs e)
{
    if (e.Control.GetType() == typeof(DataGridViewComboBoxEditingControl))
    {
        DataGridViewComboBoxEditingControl cbo = 
            e.Control as DataGridViewComboBoxEditingControl;
        cbo.DropDownStyle = ComboBoxStyle.DropDown;
    }
}

Problem with combobox and databound datagridview

阅读全文

相关推荐

最新文章