在delphi7中怎么使dbgrid中的某一字段以checkbox的格式显示?????
高手请指点,十万火急!!!!

解决方案 »

  1.   

    1):双击dbgrid加入全部字段,选中某一字段,它有一属性picklist属性中输入你要选择的内容
    2):画:
       在dbgrid的drawdatacell事件中
      if (gdfocused in state)then
      begin
     if(field.fieldname=dbcombobox1.datafield)then
    begin
    dbcombobox1.left:=rect.left+dbgrid1.left;
    dbcombobox1.top:=rect.top+dbgrid1.top;
    dbcombobox1.width:=rect.right-rect.left;
    dbcombobox1.height:=rect.bottom-rect.top;
    dbcombobox1.visible:=true;
    end;
    end;
    在dbgrid的colExit事件中写
    if dbgrid1.selectedfield.fieldname=dbcombobox1.datafield then
    begin
    dbcombobox1.visible:=false;
    end;
    在dbgrid的keypress事件中写
    if(key<>chr(9)) then
    begin
    if(dbgrid1.selectedfield.fieldname=dbcombobox1.datafield)then
    begin
    dbcombobox1.setfocus;
    sendmessage(dbcombobox1.handle,wm_char,word(key),0);
    end;
    end;
      

  2.   

    这是dbcombobox的,如果你一定要用combobox只要改一下就可以了
      

  3.   

    用Info Power控件。世界上公认的第一名第三方数据库控件