首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

stringgrid某个单元格可不可以实现fiexedrows那样的3D突出显示和具有不可编辑性

2012-08-03 
stringgrid某个单元格能否实现fiexedrows那样的3D突出显示和具有不可编辑性?stringgrid某个单元格能否实现

stringgrid某个单元格能否实现fiexedrows那样的3D突出显示和具有不可编辑性?
stringgrid某个单元格能否实现fiexedrows那样的3D突出显示和具有不可编辑性?

[解决办法]

Delphi(Pascal) code
......implementation{$R *.dfm}procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;  Rect: TRect; State: TGridDrawState);begin  if (ACol=2)and(ARow=2) then begin    StringGrid1.Canvas.Brush.Color:=clBtnFace;    StringGrid1.Canvas.FillRect(Rect);    StringGrid1.Canvas.Pen.Color:=clblack;    StringGrid1.Canvas.Pen.Width:=2;    StringGrid1.Canvas.MoveTo(Rect.Left,Rect.Bottom);    StringGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);    StringGrid1.Canvas.LineTo(Rect.Right,Rect.Top);  end  else if (ACol>1)and(ARow>1) then begin    StringGrid1.Canvas.Brush.Color:=clWindow;    StringGrid1.Canvas.FillRect(Rect);  end;end;procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,  ARow: Integer; var CanSelect: Boolean);begin  if (ACol=2)and(ARow=2) then CanSelect:=false;end;end. 

热点排行