如何在panel上使用brush?
采用以下代码可以在form上用brush画出一个红色的范围。但加上panel后就不能显示了,估计红色区域被panel遮住了,怎样才能在panel上使用brush,请高手指点。var
lb : LOGBRUSH;
hNewBrush : HBRUSH;
hWndDC : HDC;
R : TRect;
i:integer;
a,b,c,d:integer;
begin
for i:=0 to 1000 do
begin
lb.lbStyle := BS_SOLID;
lb.lbColor := clRed;
lb.lbHatch := HS_VERTICAL;
hNewBrush := CreateBrushIndirect(lb);
HWndDC := GetDC(Handle);
a:=trunc(264+0.096*i);
b:=trunc(96+0.12*i);
c:=trunc(279+0.096*i);
d:=trunc(113+0.12*i);
R := Rect(a, b, c, d);
FillRect(hWndDC, R, hNewBrush);
DeleteObject(hNewBrush);
ReleaseDC(Handle, hWndDC);
end;