Board index » delphi » Help with displaying bitmap images in widows

Help with displaying bitmap images in widows

 I wish to display a bitmap image that I have created in PhotoShop, as the
background on the main window of my application. This background will be
drawn by various procedures, and this part I have no problems. Now I know
that you should implement redraws in the TWindow.Paint method, and I have
done this, and as far as I can tell I can load the bitmap, and delete it
from memory, yet I can't seem to display it.
 This is an abridged version of my override of the Paint method.

procedure TMainWindow.Paint(PaintDC: HDC; var PaintInfo: TPaintStruct);
var MyBit: HBitmap;
begin
   MyBit := LoadBitmap(HInstance, MakeIntResource(255));
        {I use this load the bitmap, 255 being the id code of the bitmap          in my
resource file, which a load with the $R resource.res     directive}
     {This is where I want the code to go to display the bitmap}
   DeleteObject(MyBit);
        {This is how I delete the bitmap from memory, both this line,   and the
LoadBitmap line come from examples in the       ObjectWindows manual, on how to
load and delete bitmaps in      memory}
        {other overlay graphics or done here
end;

If anyone could please help me or give any advise could you please do so,
as soon as possible.

 (Note: I'm using Windows 95, Borland Pascal 7.0 with Objects, and
ObjectWindows. And I have read the manuals, but I might have been head
butting a brick wall for all the good it did me. All the references
directed me to Chapter 17 in the ObjectWindows manual, which devotes a sum
total of two paragraphs to the subject, basically telling you it can be
done.)

 

Re:Help with displaying bitmap images in widows


In article <01bca0df$465d44c0$f959868b@curly>, Alex Dess writes

Quote

> I wish to display a bitmap image that I have created in PhotoShop, as
>the background on the main window of my application.

>[snipped some (pseudo)code]

>If anyone could please help me or give any advise could you please do
>so, as soon as possible.

There is an excellent example in SWAG. The snippet can be found in the
Windows/OS2 section. If I remember correctly the snippet's called
'Loading BitMaps in Windows' written by Brian ? (don't remember his
last name),which contains a unit to do exactly what you want (loading and
displaying a bitmap from a resource file).

If you can't find the snippet or want a small example program send me an
e-mail.

Hope this helps.
--
       __ ___    __  __ ______
      / //   |  / / / // ____/          Jaap van Heemst
 __  / // /| | / /_/ // __/        j...@dutlbcz.lr.tudelft.nl
/ /_/ // ___ |/ __  // /___        
\____//_/  |_|_/ /_//_____/    

Other Threads