Search the web
Sign In
New User? Sign Up
AIL_Development · AIL Developer's Forum
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
IpicturetoImage   Message List  
Reply | Forward Message #101 of 125 |
Re: IpicturetoImage

--- "bluescreenweasel" <peteraddington@...> wrote:
>
> what I needed was a "convert stdpicture to native dotnet image". The
> class you provided worked perfectly when i put it into my project. the
> thumbnail was returning a vague _com.obejct type, i needed to cast
> this into a stdole.stdpicture first.
>
> but i cant see if that's possible in the dotnet AIL? however, I would
> be converting stdpicture to AIL image then to dotnet image? is your
> included class better since im not performing any AIL functions? i am
> just returning the com.object thumbnail, converting to image and then
> putting it on a button.


If all you need to do is convert an StdPicture object to a
System.Drawing.Image object, then don't bother with AIL. It's not
designed to do that, nor does it have any functionality to do that...
though now that I think about it, it would be nice to include some
conversion functions like that in the .NET version.

1) Download this class and include it in your .NET project:

http://net.thevbzone.com/cStdOle.vb

2) Right click on your project in the "Solution Explorer" window and
select "Add Reference". When the dialog comes up, select "OLE
Automation" (C:\Windows\System32\stdole2.tlb) from the list and click
OK.

3) Double-click on your project's default form and put the following
code in the "Form1_Load" event handler:


Dim objImg As System.Drawing.Image
Dim objStdPic As stdole.StdPicture

' Load image from file as an Image
objImg = System.Drawing.Image.FromFile("C:\TEST.BMP")

' Convert the Image to an StdPicture
objStdPic = cStdOle.ConvertTo_StdPicture(objImg)

' Clean up the Image object
objImg = Nothing

' Convert the StdPicture object back to an Image
objImg = cStdOle.ConvertFrom_StdPicture(objStdPic,
cStdOle.ReturnTypes.rt_Image)

' Clean up the StdPicture object
objStdPic = Nothing

' Set the form's picture property to the image
Me.BackgroundImageLayout = ImageLayout.None
Me.BackgroundImage = objImg

========

Because you are explicitly typing the return as "stdole.StdPicture", it
should work for you.

- Kevin





Thu Oct 9, 2008 5:56 pm

kwilson1997
Offline Offline
Send Email Send Email

Forward
Message #101 of 125 |
Expand Messages Author Sort by Date

And another one! I am using a com object interop (DSOfile) in a VB.net project, and in order to extract the thumbnail property of a file, I am using another ...
bluescreenweasel
bluescreenwe...
Offline Send Email
Oct 8, 2008
10:31 pm

... The "Convert_PictureToBitmap" function takes an StdPicture object in VB5/VB6, and takes a System.Drawing.Image object in .NET... then converts it to a...
Kevin Wilson
kwilson1997
Offline Send Email
Oct 8, 2008
10:49 pm

what I needed was a "convert stdpicture to native dotnet image". The class you provided worked perfectly when i put it into my project. the thumbnail was...
bluescreenweasel
bluescreenwe...
Offline Send Email
Oct 9, 2008
5:36 pm

... If all you need to do is convert an StdPicture object to a System.Drawing.Image object, then don't bother with AIL. It's not designed to do that, nor does...
Kevin Wilson
kwilson1997
Offline Send Email
Oct 9, 2008
5:56 pm

hi kevin, i got that class from the previous post, and it works perfectly in a .net 2 project. I already had a reference to stdole.dll, however it's from...
bluescreenweasel
bluescreenwe...
Offline Send Email
Oct 10, 2008
8:51 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help