FillRect(Canvas.Handle, LTextRect, Clblue);为什么 无效?大侠指点下,该如何解决
FillRect(Canvas.Handle, LTextRect, Clblue);为什么 无效?大侠指点下
var
LTextRect:Trect;
begin
LTextRect.Left:=0;
LTextRect.top:=0;
LTextRect.Right:=100;
LTextRect.Bottom:=100;
canvas.Brush.Color:=clblue;
self.Canvas.FillRect(LTextRect);
// FillRect(Canvas.Handle, LTextRect, Clblue);
请问 为什么 FillRect(Canvas.Handle, LTextRect, Clblue); 无效
FillRect 不是API函数吗 ?
不知道哪里出问题了。
------解决方案--------------------
var
LTextRect:Trect;
begin
LTextRect.Left:=0;
LTextRect.top:=0;
LTextRect.Right:=100;
LTextRect.Bottom:=100;
canvas.Brush.Color:=clblue;
self.Canvas.FillRect(LTextRect);
// FillRect(Canvas.Handle, LTextRect, Clblue);
请问 为什么 FillRect(Canvas.Handle, LTextRect, Clblue); 无效
FillRect 不是API函数吗 ?
不知道哪里出问题了。
------解决方案--------------------
- Delphi(Pascal) code
FillRect(GetDC(Self.Handle), LTextRect, Clblue);
------解决方案--------------------
Canvas的句柄并不是你要操作的控件的句柄,是TControlCanvas内部的一个句柄,不要搞混了。
楼上正解