不准确的别乱说哦~
A.picture.bitmap.assign(B.picture.bitmap)
它们是共用的一个指针地址吗?
A.picture.bitmap.assign(B.picture.bitmap)
它们是共用的一个指针地址吗?
解决方案 »
- 编译过不了,请大家帮帮忙
- 大家帮忙看看,function TObject.GetInterface(const IID: TGUID; out Obj): Boolean;中的out obj怎么解释?(在线)
- 俺真晕了,advStringGrid是不是用编码也无法实现ctrl多选?非连续的多选。捣鼓了一晚上也没有整出来。
- 用CxGrid 的先别急着用,先看看它的巨大BUG,在用不迟,以免浪费时间
- 两表组合问题.很急!
- 请问下面的语句是什么意思 干什么用的??
- 帮我看一看错误
- 在internet 上如何用不dcom连结远程机算机??
- 有谁在Delphi中实现过IDocHostUIHandler接口,高分求教
- 从数据库中提取数据到treeview 多个疑惑
- 字符长度?
- 有关SQL SERVER连接,救急呀!!!
In general, the statement "Destination := Source" is not the same as the statement "Destination.Assign(Source)" The statement "Destination := Source" makes Destination reference the same object as Source, whereas "Destination.Assign(Source)" copies the contents of the object referenced by Source into the object referenced by Destination.
Delphi的帮助,够权威吧?
assign后相当于完全复制到另一个里面,这是基本原理,看看TPersistent的该方法
不过基本上每个类自己都会重写(override)该方法,看看里面代码就知道
procedure TBitmap.Assign(Source: TPersistent);
var
DIB: TDIBSection;
begin
if (Source = nil) or (Source is TBitmap) then
begin
EnterCriticalSection(BitmapImageLock);
try
if Source <> nil then
begin
TBitmap(Source).FImage.Reference;
FImage.Release;
FImage := TBitmap(Source).FImage;
FTransparent := TBitmap(Source).FTransparent;
FTransparentColor := TBitmap(Source).FTransparentColor;
FTransparentMode := TBitmap(Source).FTransparentMode;
end
else
begin
FillChar(DIB, Sizeof(DIB), 0);
NewImage(0, 0, DIB, False);
end;
finally
LeaveCriticalSection(BitmapImageLock);
end;
PaletteModified := Palette <> 0;
Changed(Self);
end
else inherited Assign(Source);
end;procedure TPersistent.Assign(Source: TPersistent);
begin
if Source <> nil then Source.AssignTo(Self) else AssignError(nil);
end;procedure TPersistent.AssignTo(Dest: TPersistent);
begin
Dest.AssignError(Self);
end;procedure TPersistent.AssignError(Source: TPersistent);
var
SourceName: string;
begin
if Source <> nil then
SourceName := Source.ClassName else
SourceName := 'nil';
raise EConvertError.CreateResFmt(@SAssignError, [SourceName, ClassName]);
end;