L livestone Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-17 #1 我在设计一个VCL时候用到TBitmap的LoadFromResourceName,res文件中的Bitmap我也做了,可是为什么调用失败
J jsxjd Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-17 #2 procedure TForm1.Button1Click(Sender: TObject); var BitMap1 : TBitMap; begin BitMap1 := TBitMap.Create; try BitMap1.LoadFromResourceName(HInstance,'THEBITMAP'); Canvas.Draw(12,12,BitMap1); finally BitMap1.Free; end; end;
procedure TForm1.Button1Click(Sender: TObject); var BitMap1 : TBitMap; begin BitMap1 := TBitMap.Create; try BitMap1.LoadFromResourceName(HInstance,'THEBITMAP'); Canvas.Draw(12,12,BitMap1); finally BitMap1.Free; end; end;
L livestone Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-17 #3 Graphics::TBitmap* pMap = new Graphics::TBitmap; pMap->LoadFromResourceName((int)HInstance,"BITMAP_A"); 我是这样调用的,但运行提示Resource BITMAP_A找不到??可是RES文件里明明有了! Why?需要什么其他步骤?
Graphics::TBitmap* pMap = new Graphics::TBitmap; pMap->LoadFromResourceName((int)HInstance,"BITMAP_A"); 我是这样调用的,但运行提示Resource BITMAP_A找不到??可是RES文件里明明有了! Why?需要什么其他步骤?
L laohe Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-17 #4 试试 procedure TForm1.Button6Click(Sender: TObject); var Bmp: TBitmap; begin Bmp := TBitmap.Create; Bmp.Handle := LoadBitmap(HInstance,'abc'); Refresh; Canvas.Draw(width-bmp.width-30, 60, Bmp); Bmp.Free; end;
试试 procedure TForm1.Button6Click(Sender: TObject); var Bmp: TBitmap; begin Bmp := TBitmap.Create; Bmp.Handle := LoadBitmap(HInstance,'abc'); Refresh; Canvas.Draw(width-bmp.width-30, 60, Bmp); Bmp.Free; end;
卡 卡色 Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-17 #5 用LoadFromResourceName方法读的好象是与项目同名的res文件;
L livestone Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-17 #6 哈!我知道也,要在cpp文件中加一句 #pragma resource "project1.res" 不过还是谢过各位了。