Can't use LoadPicture() in VB.Net

  • Thread starter Thread starter Shelby
  • Start date Start date
S

Shelby

Hi,

when I try to use LoadPicture(myFilePath) in my vb.net project, it says
"LoadPicture" is not declared.

Dim pic as stdole.IPictureDisp
pic = LoadPicture(myFilePath)

Do I need to add any reference or import any namespace?

Thanks
 
Hi Shelby,

That is true, in vbnet you can use a bitmap for a Winform and an url for a
Webform and not your LoadPicture (It will be not impossible however it is
not clever to use).

In a winform you can first make a bitmap and than something like this
samples given in short past in this newsgroup
\\\Herfried
Dim b As New Bitmap(50,50)
Dim g As Graphics = Graphics.FromImage(b)
g.DrawImage(...)
g.Dispose()
Me.PictureBox1.Image = b
///
\\\Armin
dim img as image
dim bmp as bitmap
dim g as graphics
img = image.fromfile("file.bmp")
bmp = new bitmap(50, 50)
g = graphics.fromimage(bmp)
g.drawimage(img, 0, 0, new rectangle(20, 20, 50, 50))
g.dispose
///
For an webform it is
\\\Cor
image1.ImageUrl = "Your pic url"
///
I hope this helps?

Cor
 
Hi Cor Ligthert,

if I use system.drawing, can I convert the type to stdole.IPictureDisp

I am trying to make a custom icon for outlook CommandBarButton.
And it's property "Picture" is of type stdole.IPictureDisp.

So I need to convert to stdole.IPictureDisp if I use
system.drawing.graphics.

Thanks
Shelby
 
Hi Shelby,

I think I was to much fixed on that loadPicture

Did you ask this already in the newsgroup

microsoft.public.dotnet.framework.drawing?

Cor
 
* "Shelby said:
when I try to use LoadPicture(myFilePath) in my vb.net project, it says
"LoadPicture" is not declared.

Dim pic as stdole.IPictureDisp
pic = LoadPicture(myFilePath)

Do I need to add any reference or import any namespace?

'Image.FromFile'.
 
Back
Top