我用D6,当我执行:
bmp :=TBitmap.Create;
bmp.Assign(Image1.Picture.Bitmap);
时,Image1的图像没了.换用
image2.Picture.Bitmap.Canvas.CopyRect(rectd,image1.Picture.Bitmap.Canvas,rects);
时也一样.可是以前在BCB5用得好好的呀.
bmp :=TBitmap.Create;
bmp.Assign(Image1.Picture.Bitmap);
时,Image1的图像没了.换用
image2.Picture.Bitmap.Canvas.CopyRect(rectd,image1.Picture.Bitmap.Canvas,rects);
时也一样.可是以前在BCB5用得好好的呀.
解决方案 »
- delphi多线程操作同一个listview,怎么办?
- [Fatal Error] Could not create output file 'D:\Borland Delphi 7 Studio Enterprise\Borland Delphi 7 Studio Enterprise\Projects\学生
- 我现在要做个窗体设计器,就是类似Delphi设计窗体一样.要在程序运行时能用鼠标移动控件的位置,改变控件的大小
- 可注册的那种DLL,在运行里面执行卸载后,还是删不掉,要注销一下或重启一下才可以删掉,如何做到不注销或重启。
- treeview的节点赋值给DBEDIT
- 请教speedbutton按钮一个问题!
- 有谁知道在bmp中夹带txt的算法
- 在fastreport中如何做本页小计
- 一个函数
- 如何从可执行文件中读取图标?
- delphi中关于FromClose,FormCreate,ButtonClick的问题
- 学delphi时的作品!!给点意见先!
bmp.width := 100;
bmp.Height := 1000;
mBitmap:Tbitmap;
begin
mBitmap:=Tbitmap.create;
mBitmap.loadfromfile('bmpfile.bmp');
self.brush.bitmap:=Tbitmap;
end;
将IMAGE1的一部分COPY到IMAGE2,奇怪我以前用BCB5怎么就好好的?
int x,y,w,h;
TRect rect; try {
x = Form1->ResoxEdit->Text.ToInt();
}
catch (Exception &exception){
x = 128;
};
try
{
y = Form1->ResoyEdit->Text.ToInt(); }
catch (Exception &exception){
y = 120;
};
TRect rdes(0,0,x,y);
Image2->Width = x;
Image2->Height = y;
Image2->Canvas->Brush->Color = clWhite;
Image2->Canvas->FillRect(rdes); // clear to white
w = Image1->Picture->Width;
h = Image1->Picture->Height;
if (mouse.x==0 && mouse.y==0) {
rect.Left = ((w-x)/2 >=0) ? ((w-x)/2) : 0;
rect.Top = ((h-y)/2 >=0) ? ((h-y)/2) : 0;
}
else {
rect.Left = (mouse.x*w/Image1->Width-x/2 >=0) ? (mouse.x*w/Image1->Width-x/2) : 0;
rect.Top = (mouse.y*h/Image1->Height-y/2 >=0) ? (mouse.y*h/Image1->Height-y/2) : 0;
}
rect.Right = rect.Left + x;
rect.Bottom = rect.Top + y;
Image2->Canvas->CopyRect(rdes,Image1->Canvas,rect);
Form1->PreviewImage->Width = x;
Form1->PreviewImage->Height = y;
Form1->PreviewImage->Canvas->CopyRect(rdes,Image2->Canvas,rdes);
bmp:tbitmap;
begin
bmp:=Image1.Picture.Bitmap;
end;
这也奇怪.
jpeg.Assign(Image1.Picture.Graphic);或者这样bmp:=TBitmap.Create;
bmp.Assign(Image1.Picture.Graphic);后者进行了格式转换直接用Image1.Picture.Bitmap,会因为调用GetBitmap破坏图像数据指针!