473,395 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Can't use LoadPicture() in VB.Net

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
Nov 20 '05 #1
5 11935
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

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

Nov 20 '05 #2
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

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2****************@TK2MSFTNGP11.phx.gbl...
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

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


Nov 20 '05 #3
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

Nov 20 '05 #4
* "Shelby" <sh****@itsupport.com.sg> scripsit:
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'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5
Hi Cor Ligthert,

no I didn't

Shelby

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:el**************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: daimler | last post by:
help!!!!!!!! i did a for i=1 to picture1.scaleheight/2 picture1.pset (i,i) next i and the pset is shown on the picture
0
by: KBrq | last post by:
I use an ActiveX control that accepts a StdPicture in some of it's properties. My question is: how do I load a bitmap from a file and get a StdPicture out of it. In VB6.0 I used LoadPicture. Is...
7
by: Christian Blackburn | last post by:
Hi Gang, I would like to remove the BackGroundImage from a PictureBox via code can somebody show me how to do that? Thank you very much, Christian Blackburn
2
by: Hartmut Schroth | last post by:
Hi, I want to develop a VB.NET application for saving video frames (e.g. from an AVI file) to a JPEG-file and want to use the MediaDet object of DirectShow Editing Services for that. The...
1
by: samadams_2006 | last post by:
Hello, I'm using "Visual Studio 2005" and VB.NET to be more exact. I have the following article which shows me how to set the mask and picture properties for Office XP Commandbars: ...
5
by: Iulian Ilea | last post by:
Hello! I've created a PDF report and trying to load a picture using LoadPicture fucntion. It works fine on my computer but it gives an error on some other computers - permision denied, or...
3
by: raghunadhs | last post by:
hi all! i have a picture box, in that picture box, there is a picture asume it as "pic1.bmp".. now i have made some changes in that picture. Now i want to load a picture to a image( my form...
6
by: Zaccy | last post by:
i am using visual basic the newest one and i need the coide to load a file from like a folder in my computer code in the old visual basic 6.0 it is like :: Randomize Select Case Int(Rnd *...
1
by: Shinkn | last post by:
Hi I am using this code in Excel to display an ID image based on the ID number. Code also checks the expiry date of the ID and diplays a message. Everything works properly except that message box...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.