高手帮我看一下下面的代码。下面的代码多执行即次就出现内存不足。(100分)

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

wgy081

Unregistered / Unconfirmed
GUEST, unregistred user!
pic:=Tbitmap.Create;
pic.LoadFromResourceName(Hinstance,'backside');
selectobject(tempdc,pic.Handle);
Num:=player4num.Tag;
if num>0 then
begin
Addpos:=(self.ClientHeight -top.Height -330) div 27; //间距
Draw_poker_north.Left :=self.ClientWidth -right.Width -spl.Width - 95;
Draw_poker_north.Top :=((self.ClientHeight-top.Height-100 -(Num-1)*Addpos) div 2);
Draw_Poker_north.Right :=Draw_poker_north.Left+71;
Therect.Left :=Draw_poker_north.Left;
Therect.Right:=Therect.Left + 71;
for j:=1 to num do
begin
if j=1 then
Therect.Top:=Draw_poker_north.Top
else
Therect.Top :=therect.Top +addpos;
//selectobject(tempdc,pic.Handle);
bitblt(MemDc,Draw_poker_north.Left,therect.Top,71,96,tempdc,0,0,srccopy);
end;
end;
pic.free;
selectobject(tempdc,tempbit);
deletedc(tempdc);
 
是不是应该?
tempbit : =selectobject(tempdc,pic.Handle);
还有有无realeaseDC(TempDC);
 
是不是应该
pic.Destroy;
而不是
pic.free;
 
pic:=Tbitmap.Create;
pic.LoadFromResourceName(Hinstance,'backside');
tempbit := selectobject(tempdc,pic.Handle);
Num:=player4num.Tag;
if num>0 then
begin
Addpos:=(self.ClientHeight -top.Height -330) div 27; //间距
Draw_poker_north.Left :=self.ClientWidth -right.Width -spl.Width - 95;
Draw_poker_north.Top :=((self.ClientHeight-top.Height-100 -(Num-1)*Addpos) div 2);
Draw_Poker_north.Right :=Draw_poker_north.Left+71;
Therect.Left :=Draw_poker_north.Left;
Therect.Right:=Therect.Left + 71;
for j:=1 to num do
begin
if j=1 then
Therect.Top:=Draw_poker_north.Top
else
Therect.Top :=therect.Top +addpos;
//selectobject(tempdc,pic.Handle);
bitblt(MemDc,Draw_poker_north.Left,therect.Top,71,96,tempdc,0,0,srccopy);
end;
end;
selectobject(tempdc,tempbit);
deletedc(tempdc);
pic.free;
 
pic:=TBitmap.Create
try
.......
finally
pic.free;
//
 
to:ZhouSL,
应该是 Free

用ndKeler, 的方法试试
 
后退
顶部