继承TGraphicControl类的控件如何清除内容恢复透明
我继承了tgraphiccontrol类做了一个控件,要把内容擦除,恢复透明状态,我已经参照了tshape的做法,可是还是不行,不知为何,请指点,代码如下:
pen.style := psclear;
pen.width := 1;
pen.mode := pmcopy;
brush.style := bsclear;
rectangle(rect);
推荐阅读
type
ttempgraphic = class(tgraphiccontrol)
protected
procedure paint; override;
end;
{ ttempgraphic }
procedure ttempgraphic.paint;
begin
inherited;
// canvas.pen.style := psclear;//如果有这条就是全部透明了~~
canvas.brush.style := bsclear;
canvas.rectangle(rect(0, 0, width, height));
end;
{ tform1 }
procedure tform1.formcreate(sender: tobject);
begin
with ttempgraphic.create(self) do begin
parent := self;
width := 100;
height := 100;
end;
end;
//不明白你的意思,随便灌灌~~


讨论区