ClipRect不起作用(大富翁论坛,一个没有高手的地方) 好心的人那,您快来瞧瞧吧!!! Help me please!!!!能不能帮我测试一下???卷起千堆

  • 主题发起人 主题发起人 wlmmlw
  • 开始时间 开始时间
W

wlmmlw

Unregistered / Unconfirmed
GUEST, unregistred user!
ClipRect不起作用(大富翁论坛,一个没有高手的地方) 好心的人那,您快来瞧瞧吧!!! Help me please!!!!能不能帮我测试一下???卷起千堆雪tyn 跑掉罗!! (50分)<br /> procedure drawit;
begin
canvas.brush.color := clbtnface;
DrawText(.....);
end;
var
rgn : HRGN; I : integer; ARect: TRect;
begin
ARect := Rect(100,100,200,200);
rgn := CreateRectRgn(ARect.left,ARect.Top,ARect.right,ARect.Bottom);
selectClipRgn(Canvas.handle,Rgn);
for I := 1 to 10 do begin
drawit;
end;
selectClipRgn(Canvas.handle,0)
DeleteObject(rng);
end;


//ClipRect 为什么不起作用

 
he SelectClipRgn function selects a region as the current clipping region for the specified device context.

int SelectClipRgn(

HDC hdc, // handle of device context
HRGN hrgn // handle of region to be selected
);


Parameters

hdc

Identifies the device context.

hrgn

Identifies the region to be selected.



Return Values

If the function succeeds, the return value specifies the region's complexity and can be any one of the following values:

Value Meaning
NULLREGION Region is empty.
SIMPLEREGION Region is a single rectangle.
COMPLEXREGION Region is more than one rectangle.
ERROR An error occurred. (The previous clipping region is unaffected.)


Remarks

Only a copy of the selected region is used. The region itself can be selected for any number of other device contexts or it can be deleted.
The SelectClipRgn function assumes that the coordinates for a region are specified in device units.
To remove a device-context's clipping region, specify a NULL region handle.

See Also

ExtSelectClipRgn
 
我看了很多遍了,可是我笨,看不懂,能不能请你解析一下,谢谢!
 
你再做滚动显示吗?
 
应该没什么问题,将下面这句加在合适的地方看看API调用是否出错
SysErrorMessage( GetLastError );
还不行的话...
 
给点提示:
procedure drawit;
begin
canvas.brush.color := clbtnface;
DrawText(.....);
end;
var
rgn : HRGN; I : integer; ARect: TRect;
begin
ARect := Rect(100,100,200,200);
for I := 1 to 10 do begin
rgn := CreateRectRgn(ARect.left,ARect.Top,ARect.right,ARect.Bottom);
selectClipRgn(Canvas.handle,Rgn);
drawit;
selectClipRgn(Canvas.handle,0)
DeleteObject(rng);
end;
end;
实现的效果是正确的,但我不知道位什么????


 
canvas.brush.color := clbtnface
??????????????????????
 
你第一次的程序 :

ARect := Rect(100,100,200,200);
rgn := CreateRectRgn(ARect.left,ARect.Top,ARect.right,ARect.Bottom);
selectClipRgn(Canvas.handle,Rgn); //你创建了剪切区域,不停的在这个区域动作,只能看见i=10时东东效果是么?
//后来的程序,可以看见每次的效果。
for I := 1 to 10 do begin
drawit;
end;
selectClipRgn(Canvas.handle,0)
DeleteObject(rng);
 
第一个程序,设置了ClipRect就象没有设置一样!!!!
 
搞不懂了!
你只要解决了就好!
偶闪了!
 
世界从此又多了一个流浪汉!!
 
多人接受答案了。
 
后退
顶部