在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. Apache Shiro系列教程之三:Shiro的结构

    Shiro的设计目标是简化应用的安全管理工作.软件通常是以用户为基础设计的.也就是说,我们经常是根据用户是怎样和我们的软件交互的来设计相关的用户接口.比如,你可能会说"如果是已经登录的用户与 ...

  2. SpringMVC访问静态资源

    SpringMVC访问静态资源 在SpringMVC中常用的就是Controller与View.但是我们常常会需要访问静态资源,如html,js,css,image等. 默认的访问的URL都会被Dis ...

  3. Silverlight管理系统源代码(SilverlightOAFlame开发框架主要提供二次开发)

    Silverlight OA系统简介 系统功能简介 l 程序界面介绍: 左侧为主菜单,主菜单可以展开和收起,主菜单下面的所有模块都可以在数据库中扩展增加,模块的权限和用户角色挂钩,可以在数据库中创建多 ...

  4. centos中rabbitmq的安装及php支持

    转自:http://www.phpac.com/741.html 1.安装rabbitmq-c库和codegen配件 wget https://github.com/alanxz/rabbitmq-c ...

  5. mysql数据库优化小结

    一.常见数据库的优化操作 1.表的设计要符合三范式. 2.添加适当的索引,索引对查询速度影响很大,必须添加索引.主键索引,唯一索引,普通索引,全文索引 3.添加适当存储过程,触发器,事务等. 4.读写 ...

  6. html5 canvas simple drawing

    var c = canvas.getContext("2d");//get canvas 2d context canvas including a proposed 3D con ...

  7. mybatis oracle insert 返回新增的主键值

    <insert id="insertVmsTemplatePlayItem" parameterType="VmsTemplatePlayItem"> ...

  8. org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported

    1:先上控制台报错信息 org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not ...

  9. HTTP 权威指南

    第一章 http概述 1.3.1 媒体类型 - http为每种web传输的数据格式加上MIME类型数据标签(multipurpose internet mail 1.4 事务 一个请求 + 一个响应 ...

  10. Linux操作系统奥秘01-系统引导(MBR - 硬盘的0磁道)

    Boot:1.系统PowerOn 2.BIOS在完成硬件初始化以及POST 3.BIOS加载MBR 4.GRUB->GRUB or kernal MBR MBR即主引导记录,是在BIOS中选择的 ...