如何隐藏cmbobox的边框,并为其增加下划线。如下图所示如果将cmbobox的bevelkind属性设置为bevelflag的话,可以去掉边框,但是下拉箭头也变成是平面的,不像上图那样立体。如下图
http://hi.csdn.net/attachment/201202/20/0_1329704359GGjg.gif
http://hi.csdn.net/attachment/201202/20/0_1329704359GGjg.gif
解决方案 »
- 求助:TurboDelphi带的interbase7.5无法启动
- 如何在客户机上用QuickReport打印报表时取服务器的日期?
- 用delphi语言翻译一段关于TObject的VC代码
- 我的IE 主頁被修改了
- 如何用QuickRep打印ListView 控件中的列表内容;(急)
- 备份数据库?
- 我要在拷贝文件时用进度条控件显示拷贝进度该怎么做?
- http://expert.csdn.net/Expert/topic/1737/1737791.xml?temp=.2128717
- 新手求助-关于同样的代码如何处理?
- 除了Borland老家的网站外,哪有delphi7的补丁下载啊?
- xe2 webbrowser 在xp下空白
- 这是哪个控件呢?
DEV控件确实应该有这功能,很强大
可不可以发个Dev的下载连接?
我设置DGROWSELECT为TRUE后,DGEDIT就自动变成False了,这样,就不能编辑某一单元格了,点击某一单元格后效果是整行选中,要编辑的单元格也是蓝色,而不是白色。
无论点击哪个单元格,始终是选中整行,而不能编辑点击的单元格。
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事件添加
if row = MouseCoord(Rect.Left+1, Rect.Top+1).Y then 中的row 是什么变量呢?
如上图添加一列标识栏位
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的左边黄色区域可以拉长的,倒是可以在上面画上标识,但区域太智智短
不能完全显示行标
如下图所示
修改内容如下
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列显示行号呢?
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;
效果如图所示我这边就不去调整这个了
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;
最后实现的效果如下图
http://topic.csdn.net/u/20120223/12/2b3d1f24-f0ab-43a5-bfb4-c343c92b0dc5.html?seed=1707508408&r=77701420#r_77701420