我这笨办法特多, 要处理选中的特殊显示用下面的笨办法:
假设您已经把您选中的controls保存到了一个tlist--MyControlList中:
var
dc: HDC;
bmp: TBitmap;
i, j: Integer;
b: PByte;
p: TPoint;
begin
bmp := tbitmap.create;
bmp.pixelformat := pf24bit;
dc := createdc('DISPLAY', nil, nil, nil);
for i := 0 to mycontrollist.count - 1do
begin
with TControl(MyControlList.items)do
begin
p := clienttoscreen(point(0,0));
bmp.width := width;
bmp.height := height;
end;
bitblt(bmp.canvas.handle, 0, 0, bmp.width, bmp.height, dc, p.left, p.top, SRCCOPY);
// 取得原来图象
for i := 0 to bmp.height - 1do
// 处理图象, 反色显示
begin
b := bmp.scanline;
for j := 0 to (bmp.width - 1)*3do
begin
b^ := b^ xor 255;
b := pointer(integer(b)+1);
end;
end;
bitblt(dc, p.left, p.top, bmp.width, bmp.height, bmp.canvas.handle, 0, 0, SRCCOPY);
end;
deletedc(dc);
bmp.free;
end;
要恢复原色只要redrawwindow(form.handle, nil, 0, RDW_ERASE or RDW_ERASENOW or RDW_ALLCHILDREN)即可