请问用纯的API方法把一个BMP文件画到FORM上去应该怎么做?(100分)

  • 主题发起人 主题发起人 大唐电信
  • 开始时间 开始时间

大唐电信

Unregistered / Unconfirmed
GUEST, unregistred user!
请问用纯的API方法把一个BMP文件画到FORM上去应该怎么做?<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 谢谢!!!
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=2045335
 
xiexie &nbsp;啊啊啊啊啊<br><br>procedure TForm1.FormPaint(Sender: TObject);<br>var<br> &nbsp;DC : HDC;<br> &nbsp;HBMP : HBITMAP;<br> &nbsp;BITDC : HDC;<br> &nbsp;Pal: tagLOGPALETTE;<br> &nbsp;Palette : HPALETTE;<br>begin<br> &nbsp;DC := Form1.Canvas.Handle ;<br> &nbsp;HBMP := LoadBitmap(0,PChar(OBM_CHECKBOXES));<br> &nbsp;BITDC := CreateCompatibleDC(0);<br> &nbsp;SelectObject(BITDC,HBMP);<br> &nbsp;BitBlt(DC, 10, 10, 100, 100, BITDC, 0, 0, SRCCOPY);<br> &nbsp;DeleteObject(HBMP);<br> &nbsp;DeleteDC(BITDC);<br>end; &nbsp;<br>这段代码可以实现画图的功能,可还有一个问题LoadBitmap(0,PChar(OBM_CHECKBOXES));<br>是从资源文件里取出一个BMP文件来画在FORM1上,但我想从文件夹里随意取出一个BMP文件来画在FORM1上,这应该怎么做乃? &nbsp; &nbsp;谢谢!!!
 
LPTSTR MAKEINTRESOURCE(<br><br> &nbsp; &nbsp;WORD wInteger // integer to convert <br> &nbsp; );
 
MAKEINTRESOURCE这个函数应该不行吧?
 
NT下LoadBitmap已经推荐不用了!使用LoadImage<br>HANDLE LoadImage(<br><br> &nbsp; &nbsp;HINSTANCE hinst, // handle of the instance that contains the image<br> &nbsp; &nbsp;LPCTSTR lpszName, // name or identifier of image<br> &nbsp; &nbsp;UINT uType, // type of image<br> &nbsp; &nbsp;int cxDesired, // desired width<br> &nbsp; &nbsp;int cyDesired, // desired height<br> &nbsp; &nbsp;UINT fuLoad // load flags<br> &nbsp; );
 

Similar threads

后退
顶部