在DataGridView的CellEnter的事件中添加如下代码即可:

if (e.ColumnIndex == dataGridView1.Columns["仓库名"].Index) {
dataGridView1.BeginEdit(false);
System.Windows.Forms.ComboBox c = dataGridView1.EditingControl as System.Windows.Forms.ComboBox;
if (c != null) {
c.DroppedDown = true;
} }

思路参考来源:https://social.msdn.microsoft.com/Forums/windows/en-US/27b08305-e7ce-4d4d-b608-c544e2748a81/datagridviewcomboboxcell-making-it-drop-down-automatically?forum=winformsdatacontrols

        private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) {
if (dataGridView1.CurrentCell.OwningColumn is DataGridViewComboBoxColumn)
{
System.Windows.Forms.ComboBox combo = (System.Windows.Forms.ComboBox)e.Control;
combo.KeyDown += new KeyEventHandler(combo_KeyDown);
}
} void combo_KeyDown(object sender, KeyEventArgs e) {
System.Windows.Forms.ComboBox c = sender as System.Windows.Forms.ComboBox;
if (c != null) {
c.DroppedDown = true;
}
}

DataGridView的DataGridViewComboBoxColumn列在编辑时自动弹出下拉列表的更多相关文章

  1. DataGridView的DataGridViewComboBoxColumn列点击一次,自动处于编辑状态

    本文转载:http://www.cnblogs.com/Johnny_Z/archive/2012/02/12/2348235.html Winform中的DataGridView数据绑定控件有时会用 ...

  2. Android打开某个activity时自动弹出输入法键盘

    最近在做一个可以让用户修改自己账户资料的activity,具体是打开后有一个EditText,然后用户可以在这里输入相关信息,但是做好后发现,进入这个activity时系统并没有自动弹出输入法键盘,于 ...

  3. 屏蔽按CapsLock键切换到大写时,编辑框自动弹出的提示(UnregisterClass(TOOLTIPS_CLASS)后,重新设置WndProc并注意返回值)

    WNDPROC OldProc; LPCTSTR lpStr = TEXT("保持大写锁定打开可能会使您错误输入密码"); LRESULT CALLBACK WindowProc( ...

  4. PL/SQL Developer去掉启动时自动弹出的Logon弹出框方法

    以前用PL/SQL Developer 7.0版本,最近升级到PL/SQL Developer 11.0版本,但每次启动PL/SQL Developer都会自动弹出Logon窗口,并且选中其中的登录历 ...

  5. jquery UI autocomplete当输入框焦点聚焦时自动弹出跟随下拉框

    $("#search").autocomplete({ minLength: 0, source: function(request,response){ // request对象 ...

  6. [Winform] DataGridView 中 DataGridViewComboBox 的可编辑

    在 DataGridView 中设置的 DataGridViewComboBox,默认是不可编辑的,即使将其列属性 DisplayStyle 设置成 ComboBox 或其他,也无法编辑: 故作如下处 ...

  7. DataGridView中DataGridViewComboBoxColumn的一些相关应用(一)让其值改变时触发事件-转

    转自  https://maodaili.de/mao.php?u=a%2FMrbEvUE8PnCuc7FrhJi0Rqd3kmOBHPZUbcJ1c2hbJUK0RYWpAf4lhIOddItP%2 ...

  8. Winform 中DataGridView的checkbox列,当修改checkbox状态时实时获得其状态值

    不知道大家有没有这样的经验,当点击或者取消datagridview的checkbox列时,比较难获得其状态是选中还是未选中,进而不好进行其它操作,下面就列出它的解决办法: 主要用到了DataGridV ...

  9. jqgrid 让隐藏的列在编辑状态时出现且可编辑

    有时,我们需要隐藏一个列数据,但在启动编辑时又能够被编辑. 1.设置列为编辑:editable: true 2.设置 editrules属性值为: edithidden: true colModel: ...

随机推荐

  1. 【转】编译quickfast解析库(沪深level2行情转码库)

     转自http://blog.csdn.net/hacode/article/details/7065889 编译quickfast解析库(沪深level2行情转码库) 目录(?)[-] 1 下载源代 ...

  2. js零散总结

    字符串的查找 index of 指定查找位置 可以查所有,不支持正则   找不到返回-1 var i=-1; while((i=str.indexOf("关键词",i+1))!=- ...

  3. springboot教程

    http://www.cnblogs.com/java-zhao/tag/spring-boot/ http://blog.csdn.net/liaokailin/article/category/5 ...

  4. 透明(颜色)渐变背景(颜色透明背景),兼容IE8

    filter: progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#00000000, endColo ...

  5. 关于Unity中Camera的Aspect

    一直以来对Camera的Aspect和Game窗口的Aspect都是一知半解,某天从一本书中看到了对Camera的API讲解,但是总觉得对Aspect讲解的有问题.于是就认真的思考起了这个问题,还发现 ...

  6. 14. Reverse Linked List II

    Reverse Linked List II Reverse a linked list from position m to n. Do it in-place and in one-pass. F ...

  7. Server 2003序列号

    windows2003 64位注册码 Windows 2003 R2 64bit Enterprise VOL Edition 企业版 MR78C-GF2CY-KC864-DTG74-VMT73 VP ...

  8. 在c中保存状态

    1. 注册表 注册表是一个普通的table,我们可以将c函数中需要保存的状态都存储在注册表中,注册表是可以被多个c模块共享的. 由于注册表是一个普通table,我们同样可以在栈中对其进行操作,只是这个 ...

  9. javaweb学习第一天 debug

    debug 断点: f5:step into f6:step over f7:step return drop to frame:跳到当前方法的的第一行 resume:跳到下一个断点 watch:观察 ...

  10. mysql批量执行sql文件

    1.待执行的sql文件为1.sql.2.sql.3.sql.4.sql等 2.写一个batch.sql文件: source .sql; source .sql; source .sql; source ...