如何隐藏cmbobox的边框,并为其增加下划线。如下图所示如果将cmbobox的bevelkind属性设置为bevelflag的话,可以去掉边框,但是下拉箭头也变成是平面的,不像上图那样立体。如下图
http://hi.csdn.net/attachment/201202/20/0_1329704359GGjg.gif

解决方案 »

  1.   


    DEV控件确实应该有这功能,很强大
      

  2.   


    可不可以发个Dev的下载连接?
      

  3.   

    http://download.csdn.net/detail/chenxh/131137
      

  4.   

    设置GRID的OPTION属性:DGROWSELECT设置为true当你编辑这个GRID时就是这个效果
      

  5.   


    我设置DGROWSELECT为TRUE后,DGEDIT就自动变成False了,这样,就不能编辑某一单元格了,点击某一单元格后效果是整行选中,要编辑的单元格也是蓝色,而不是白色。
      

  6.   

    我设置DGROWSELECT属性为TRUE后的效果如下图
    无论点击哪个单元格,始终是选中整行,而不能编辑点击的单元格。
      

  7.   

    这个。因为我一般都是在另一个EDITFORM中增改值的,所以没怎么注意……看看……
      

  8.   

    procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
    begin
     with TStringGrid(DBGrid1) do begin
          if row = MouseCoord(Rect.Left+1, Rect.Top+1).Y then
          begin
             Canvas.Brush.Color := clblue;
             Canvas.Font.Color := clWhite;
          end;
       end;
       TDBGrid(Sender).DefaultDrawColumnCell(Rect,DataCol,Column,State);end;
    找了这段代码,测试可靠,,OnDrawColumnCell事件添加
      

  9.   

    如果是DBGRIDEH的话设置OPTIONS属性下的dgrowheightlight为true就好了上面是标准控件里的效果
      

  10.   


    if row = MouseCoord(Rect.Left+1, Rect.Top+1).Y then   中的row 是什么变量呢?
      

  11.   

    TStringGrid(DBGrid1).Row不是变量,是属性
      

  12.   

    如果是DBGRIDEH的话设置OPTIONS属性下的dgrowheightlight为true就好了
      

  13.   

    如果是DBGRIDEH的话设置OPTIONS属性下的dgrowheightlight为true就好了
      

  14.   


    如上图添加一列标识栏位
    procedure TForm1.DBGridEh1DrawColumnCell(Sender: TObject;
      const Rect: TRect; DataCol: Integer; Column: TColumnEh;
      State: TGridDrawState);
    begin
    if   Column.Index   =   0   then
    with   DBGrideh1.Canvas   do
    begin
      FillRect(Rect);
      TextOut(Rect.Left+2,   Rect.Top+2,   IntToStr(DBGrideh1.DataSource.DataSet.RecNo));
    end;
    效果如下图
    没见过DBGRID的左边黄色区域可以拉长的,倒是可以在上面画上标识,但区域太智智短
    不能完全显示行标
      

  15.   

    我是通过修改Grid.pas和DBGrid.pas两个单元文件,来实现加大Indicator列的宽度并显示序号的功能的,但是只能在当前行显示行号,而不能在所有行显示行号。
    如下图所示
    修改内容如下
    Grid.pas  中修改内容procedure TCustomGrid.SetColWidths(Index: Longint; Value: Integer);
    begin
      if FColWidths = nil then
        UpdateExtents(FColWidths, ColCount, DefaultColWidth);
      if Index >= ColCount then InvalidOp(SIndexOutOfRange);
      if Value <> PIntArray(FColWidths)^[Index + 1] then
      begin
        if Value < 12 then Value := 30;   //新增
        ResizeCol(Index, PIntArray(FColWidths)^[Index + 1], Value);
        PIntArray(FColWidths)^[Index + 1] := Value;
        ColWidthsChanged;
      end;
    end;
    DBGrids.pas中修改内容if ACol <0 then  //新增
    begin
      Canvas.TextRect(ARect,0,(ARect.Top + ARect.Bottom - FIndicators.Height) shr 1//新增
              ,inttostr(self.DataSource.DataSet.RecNo));
    end; //新增
    FIndicators.Draw(Canvas, ALeft,
              (ARect.Top + ARect.Bottom - FIndicators.Height) shr 1, Indicator, True);
    如何才能在所行的Indicator列显示行号呢?
      

  16.   

    如何才能在所有的行的Indicator列显示行号呢?
      

  17.   

    procedure TForm1.DBGridEh1DrawColumnCell(Sender: TObject;
      const Rect: TRect; DataCol: Integer; Column: TColumnEh;
      State: TGridDrawState);
    begin
        if DataCol=0 then
      begin DBGridEh1.Canvas.Brush.Color:=clBtnFace;
        DBGridEh1.Canvas.Font.Color:=clBlack;
        DBGridEh1.Canvas.TextOut(Rect.Left-10,Rect.Top+3,IntToStr(DBGridEh1.DataSource.DataSet.RecNo));
      end;
    end;
    效果如图所示我这边就不去调整这个了
      

  18.   

    感谢case5166的关注,在你的帮助下,问题得到解决。解决方法如下:1.修改gridEh.pas文件,达到加宽indicator列款的目的。procedure TCustomGridEh.SetColWidths(Index: Longint; Value: Integer);
    begin
      if Length(FColWidths) = 0 then
        UpdateExtents(FColWidths, FullColCount, DefaultColWidth);
      if Index >= FullColCount then InvalidOp(SIndexOutOfRange);
      if Value <> FColWidths[Index + 1] then
      begin
        if Value < 12 then Value := 30;   //新增
        ResizeCol(Index, FColWidths[Index + 1], Value);
        FColWidths[Index + 1] := Value;
        ColWidthsChanged;
      end;
    end;
    2.在dbGridEh的DrawColumnCell事件中填写如下代码procedure TForm1.DBGridEh1DrawColumnCell(Sender: TObject;
      const Rect: TRect; DataCol: Integer; Column: TColumnEh;
      State: TGridDrawState);
    begin
      if DataCol=0 then
      begin DBGridEh1.Canvas.Brush.Color:=clBtnFace;
      DBGridEh1.Canvas.Font.Color:=clBlack;
      DBGridEh1.Canvas.TextOut(Rect.Left-10,Rect.Top+3,IntToStr(DBGridEh1.DataSource.DataSet.RecNo));
      end;
    end;
    最后实现的效果如下图
      

  19.   

    感谢楼上朋友们的关注总结结贴,具体内容见帖子
    http://topic.csdn.net/u/20120223/12/2b3d1f24-f0ab-43a5-bfb4-c343c92b0dc5.html?seed=1707508408&r=77701420#r_77701420