关于消息处理WMPaint的,请求帮助!!! 我用用这种方法把它继承下来的,怎么不会响应呢? TcxlStringGrid = class(TStringGrid)
public
procedure WMPaint(var Message: TWMPaint); message wm_Paint;
end;
procedure TcxlStringGrid.WMPaint(var Message: TWMPaint);
var
rt: TRect;
tmpc: DWORD;
begin
PaintHandler(Message);
if not (focused) then
begin
tmpc := Canvas.font.Color;
rt := CellRect(selection.Left, selection.Top);
canvas.Lock;
canvas.FillRect(rt);
Canvas.font.Color := font.Color;
Canvas.TextRect(rt, rt.Left + 2, rt.top + 2, Cells[selection.Left, selection.Top]);
//canvas.TextOut(rt.Left+2,rt.top+2,Cells[selection.Left,selection.Top]);
Canvas.font.Color := tmpc;
canvas.UnLock;
end;
end;
public
procedure WMPaint(var Message: TWMPaint); message wm_Paint;
end;
procedure TcxlStringGrid.WMPaint(var Message: TWMPaint);
var
rt: TRect;
tmpc: DWORD;
begin
PaintHandler(Message);
if not (focused) then
begin
tmpc := Canvas.font.Color;
rt := CellRect(selection.Left, selection.Top);
canvas.Lock;
canvas.FillRect(rt);
Canvas.font.Color := font.Color;
Canvas.TextRect(rt, rt.Left + 2, rt.top + 2, Cells[selection.Left, selection.Top]);
//canvas.TextOut(rt.Left+2,rt.top+2,Cells[selection.Left,selection.Top]);
Canvas.font.Color := tmpc;
canvas.UnLock;
end;
end;
解决方案 »
- scrollbox上放一个timage不能设置属性,这是一个规矩吗?
- 如何在系统内核级截获并修改键盘按键
- 向高手求救!Dbexpress连接控件。
- 问一菜鸟问题--什么是VTM?
- 放分100!!!!!@@@@@刚好,100,强烈要反对--小小不要离开csdn !!!!!!强烈反对!!!
- 为什么这样不可以??(在线等)
- 关于发短信的问题??拜托各位
- 小问题
- 有关Delphi中如何编写发信的程序。
- 各位在客户处开发程序时,用什么方法保证源程序不外流的?gz者有分
- 使用ADO连接和ADOQuery时怎么更新数据库
- TListView上动态创建的edit不能随着listview中的滚动事件位置随着变动
TcxlStringGrid = class(TStringGrid)
public
procedure Paint; override;
end;
procedure TcxlStringGrid.Paint;
var
rt: TRect;
tmpc: DWORD;
begin
inherited Paint;
if not (Focused) then
begin
tmpc := Canvas.font.Color;
rt := CellRect(selection.Left, selection.Top);
canvas.Lock;
canvas.FillRect(rt);
Canvas.font.Color := font.Color;
Canvas.TextRect(rt, rt.Left + 2, rt.top + 2, Cells[selection.Left, selection.Top]);
//canvas.TextOut(rt.Left+2,rt.top+2,Cells[selection.Left,selection.Top]);
Canvas.font.Color := tmpc;
canvas.UnLock;
end;
end;
在一个StringGrid1中,当点击某一个单元格时,要求这个单元格的颜色变成红色,字体变成蓝色,也就是改变背景和字体的颜色,而StringGrid没有提供单个单元格的重画方法,请问用这个可以吗?有没有更好的方法?
TcxlStringGrid = class(TStringGrid)
public
procedure Paint; override;
end;
...
procedure TcxlStringGrid.Paint;
var
rt: TRect;
begin
inherited Paint;
if (Focused) then
begin
rt := CellRect(selection.Left, selection.Top);
canvas.Lock;
Canvas.Brush.Color:=clRed;
canvas.FillRect(rt);
Canvas.font.Color := clBlue;
Canvas.TextRect(rt, rt.Left + 2, rt.top + 2, Cells[selection.Left, selection.Top]);
canvas.UnLock;
end;
end;
按你这个复制过去后,CxlStringGrid的Code Complete中根本就没有Paint这个过程名,强制用这个过程后(CxlStringGrid.paint;)系统老提示undeclared indentifier:'Paint'!不知怎么回事?
在一个StringGrid1中,当点击某一个单元格时,要求这个单元格的颜色变成红色,字体变成蓝色,也就是改变背景和字体的颜色,而StringGrid没有提供单个单元格的重画方法,请问用ownerdraw怎么做呢?