我想合并好多个IMAGE为一个BMP,,为什么我下面的方法合并时,合并后的图片:小图片没有全部显示出来,,只显示了原来一个小IMAGE的一部分???(20分)

  • 主题发起人 主题发起人 qd.pd
  • 开始时间 开始时间
Q

qd.pd

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TFMain.ToolButton20Click(Sender: TObject);
var ARECT1,ARECT2: TRECT;
bitmap:TBitmap;
i :integer;
ix,iy,iwidth,iheight :integer;
kk: array of timage;
begin
qryPicPos.close;
qryPicPos.SQL.Clear;
qryPicPos.SQL.Add('select * from tDepartInfo');
qryPicPos.Open;
SetLength(kk , qryPicPos.RecordCount);

i := 0;
while not qryPicPos.Eof do
begin
kk := timage.Create(PlMain);
kk.Parent := PlMain;
ix := qryPicPos.fieldbyname('PicX').AsInteger;
iy := qryPicPos.fieldbyname('PicY').AsInteger;
ImgMain.Canvas.CopyRect(RECT(ix,iy,ix+kk.width,iy+kk.Height),imgs.Canvas,RECT(0,0,kk.width,kk.Height));
qryPicPos.Next;
i := i + 1;
end;
ImgMain.Picture.SaveToFile('d:/qiye/eight.bmp')
end;
 
kk 没有赋值
PlMain是什么变量?
imgs是什么变量
 
这是我程序 里面的一段代码,,,,
plmain 是一个panel
imgs: imgs: array of timage;
kk := timage.Create(PlMain);已经赋值了嘛
 
如我下面的这段代码,,保存后的图片,我看了一下,,也是没有以前的那么大了,,为什么??????
要先设置Bitmap的一个什么属性吗???请高手明示,,刚宴请的帐号,没多少分,呵呵

procedure TForm2.Button3Click(Sender: TObject);
var Bitmap : TBitmap;
begin
Bitmap := TBitmap.Create;
try
Bitmap.Width := image1.Width;
bitmap.Height := 200;
bitmap.Canvas.CopyRect(RECT(0,0,image1.Width,200),image1.Canvas,RECT(0,0,20,200));
bitmap.SaveToFile('d:/www.bmp');
finally
bitmap.Free;
end;
end;
 
kk := timage.Create(PlMain);只是创建,不是赋值
imgs: 在哪里赋值的?
 
procedure TFMain.FormCreate(Sender: TObject);
var a, b :integer;
i :integer;
sspath: string;
begin
_PicPath := AppPath +'/Pict/eight.bmp' ;
imgMain.Picture.LoadFromFile(_PicPath) ;
ImgShow.Picture.LoadFromFile(AppPath+'/Pict/eight.bmp');
imgMain.AutoSize := true ;
ImgMainWidth := imgMain.Width ;
ImgMainHeight := imgMain.Height ;
//showmessage(inttostr(ImgMainWidth)+','+inttostr(ImgMainHeight));
imgMain.AutoSize := false ;
///////////////////////////

iRegionID := 999 ;
//SetRegion(num) ; 放到下面地7行了

//-------------------{设置各个小Image}--------------------------------//
qryPicPos.close;
qryPicPos.SQL.Clear;
qryPicPos.SQL.Add('select * from tDepartInfo');
qryPicPos.Open;
SetLength(imgs , qryPicPos.RecordCount);
SetLength(imglong , qryPicPos.RecordCount,2);
qryPicPos.First;
for i:= 0 to qryPicPos.RecordCount-1 do
begin
imgs := timage.Create(PlMain);
imgs.Parent := PlMain;
imgs.autosize := true;
imgs.Tag := qryPicPos.fieldbyname('ID').AsInteger;
imgs.OnClick := MinImageclick;
//imgs.OnMouseDown := MinImageclick;
imgs.PopupMenu := pmRegionPos;
sspath := AppPath +'/Pict/bmp/'+qryPicPos.fieldbyname('PicName').AsString +'.bmp';
imgs.Picture.LoadFromFile(sspath);
imgs.Top := round(round(qryPicPos.fieldbyname('Picy').AsInteger*num*1000)/1000);
imgs.Left := round(round(qryPicPos.fieldbyname('PicX').AsInteger*num*1000)/1000);
imglong[0] := imgs.width;
imglong[1] := imgs.height;
imgs.autosize := false;
imgs.stretch := true;
//showmessage(inttostr(imglong[0])+','+inttostr(imglong[1]));
a := round(imgs.width*num);
b := round(imgs.height*num);
imgs.width := round(a);
imgs.height := round(b);
qryPicPos.Next;
end;
 
谢谢,不问了,送分
 
后退
顶部