Re: LoadImage API
- From: "Fella" <Nospam@xxxxxxxxxx>
- Date: Fri, 13 Jan 2006 02:18:27 GMT
Mike,
The refresh line did the trick, and now the project is working as I intended
it.
Thanks for your help,
Jim
"Mike Williams" <Mike@xxxxxxxxxxxxxxxxx> wrote in message
news:dq68n0$tp1$1@xxxxxxxxxxxxxxxxxxxxxx
> "Fella" <Nospam@xxxxxxxxxx> wrote in message
> news:r6xxf.460383$zb5.373967@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>> The .bmp never shows in the picture box. I appears that LoadBitmap
>> is supposed to create an object must associate a device context to,
>> and the object isn't being created in the first place.
>
> I presume you're talking about the LoadImage API. If so then that API
> loads a bitmap (from disk in your specific case) and resizes it according
> to the parameters you give it and assigns the result to a bmp object,
> returning the handle of the bmp object for you. The rest of the code you
> posted then creates a device context and selects that bitmap into the
> device context and then "blits" it into a picture box. I've just copied
> and pasted the code you posted into a new VB project and it works fine.
> Obviously I had to change to filename to a bmp that actually exists on my
> own machine, but when I did so it worked fine, displaying the bitmap in
> the picture box. No problems at all. Have you tried getting riud of the
> "Appt.Path" stuff and instead hard coding the filename of a bitmap in your
> main drive (for example, "c:\mypic.bmp"). Try creating such a bitmap and
> putting it in your main drive root folder and doing just that. It
> certainly works for me. By the way, does your picture box have its
> Autoredraw property set to True? If it does (and if it is not currently
> visible on the display at the time the picture is loaded) then you won't
> see the result, because it will not be persistent. So, check if your
> picture box has its Autoredraw proiperty set to True and if it does then
> add the line "Picture1.Refresh" just after the blit line of code.
>
> Basically, I can't fault the code you have posted. It works fine for me.
> When you say you have "loaded the bitmap into the picture box as I
> suggested and there is still no change", what exactly do you mean. Exactly
> how did you load the bitmap into the picture box? And what happened when
> you did so? Are you *absolutely sure* that the bitmap exists and thas has
> exactlky the name you have coded into your code and that it actually
> "lives" in your app's "App.Path" folder? Don't forget that the App.Path
> reeturns a different path whe nyour code is run in the VB IDE than it does
> when it is run as a compiled exe. Have you checked that? Ditch the
> "App.Path" stuff for a minute and enter a full "hard coded" path and
> filename into your code of a valid bitmap and see what happens.
>
> Mike
>
>
>
.
- Follow-Ups:
- Re: LoadImage API
- From: Mike Williams
- Re: LoadImage API
- References:
- LoadImage API
- From: Fella
- Re: LoadImage API
- From: Mike Williams
- Re: LoadImage API
- From: Fella
- Re: LoadImage API
- From: Mike Williams
- LoadImage API
- Prev by Date: Re: Service Pack 6?
- Next by Date: Re: Service Pack 6?
- Previous by thread: Re: LoadImage API
- Next by thread: Re: LoadImage API
- Index(es):
Relevant Pages
|
Loading