|
-
Apr 12th, 2003, 06:23 PM
#1
*resolved* HELPPPPPP How can I add images to my program?
any way to do this besides using an image list? I have about 200 SMALL pictures that I need to add to my program and the stupid image list doesnt let me to select them all at once.... it would take a year to add them all 
How could I add those images? (I want them to be included in the exe file, or possibly in a single resource file that can be used by my app, but I have no idea how to do this)(
Last edited by MrPolite; Apr 13th, 2003 at 09:11 PM.
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Apr 12th, 2003, 06:47 PM
#2
Frenzied Member
Yes use a resource file. Cant give you an an example now, since my workstation is fried. I lost all my work that I've been working on for the last year and a half. I'm just starting to recover
Dont gain the world and lose your soul
-
Apr 12th, 2003, 07:05 PM
#3
Damn that sucks DevGrp! You have to build the ResourceMaker application from the samples so you have a Resource Editor. Then you just add things to it and save as a file. Then include that file in your project. You can retrieve objects from it via the ResourceManager object.
http://www.vbforums.com/showthread.p...hreadid=169258
http://www.vbcity.com/forums/topic.asp?tid=7503
http://www.vbcity.com/forums/topic.asp?tid=17412
If you are still stuck then let me know and I'll do up a sample.
Last edited by Edneeis; Apr 12th, 2003 at 07:10 PM.
-
Apr 12th, 2003, 10:53 PM
#4
hmm I dont get it, what's that "ResourceMaker" that you're talking about? sounds like those posts will tell me how to read a resource, but can you tell me how to make one first?
DevGrp, sorry to hear about that, loosing data really sucks. Was it your programs that you lost?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Apr 12th, 2003, 10:54 PM
#5
Frenzied Member
Yeah it does suck. Now I'm on a strict backup schedule.
Dont gain the world and lose your soul
-
Apr 12th, 2003, 11:30 PM
#6
Last edited by MrPolite; Apr 12th, 2003 at 11:38 PM.
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Apr 13th, 2003, 02:30 AM
#7
umm I made a resx file and then converted it to a resource file. I still dont know how I cant load the images without knowing the field names
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Apr 13th, 2003, 03:36 AM
#8
Why don't you know the fieldnames?
-
Apr 13th, 2003, 07:44 AM
#9
yay gay
well..create a folder called pictures(just to not mess up all your project) then drag and drop ALL pictures to that folder and there is somewhere a option that will embedded them in the .EXE..hope this helps
edit: omg i suck, now i see that this already had been talked about..i have somewhere a function in VB.NET which gets a resource ill look up for it wait some min plz
edit2: hope this helps,
VB Code:
Private Function GetResource(ByVal filename As String) As System.IO.Stream
Dim oAssembly As Reflection.Assembly = MyClass.GetType.Assembly
Dim sFiles() As String
Dim sFile As String
' prefix filename with namespace
filename = oAssembly.GetName.Name & "." & filename
' get a list of all embeded files
sFiles = oAssembly.GetManifestResourceNames()
' loop through each file
For Each sFile In sFiles
' found the file? return the stream
If sFile = filename Then
Return oAssembly.GetManifestResourceStream(sFile)
End If
Next
End Function
Last edited by PT Exorcist; Apr 13th, 2003 at 07:48 AM.
\m/  \m/
-
Apr 13th, 2003, 02:00 PM
#10
hmm I couldnt do much with yuor code pt exorcist, but thanks anyways.
now lets say I force myself to know the field names now what? how can I get the resources?because I tried it and it didnt work. The resource that I have is called tmp.resources and here's what I did:
VB Code:
Dim rm As New ResourceManager("tmp", System.Reflection.Assembly.GetExecutingAssembly())
Dim bmp As Bitmap = CType(rm.GetObject("what", Globalization.CultureInfo.CurrentCulture), Bitmap)
picturebox1.image = bmp
it stops on the second line ,and here's the error:
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "tmp.resources" was correctly embedded or linked into assembly "WindowsApplication36".
baseName: tmp locationInfo: <null> resource file name: tmp.resources assembly: WindowsApplication36, Version=1.0.1198.19709, Culture=neutral, PublicKeyToken=null
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Apr 13th, 2003, 06:20 PM
#11
The basename of the resource should be the namespace plus the filename of the resource. Also it seems to work more with .resources files instead of .resx.
VB Code:
Dim rm As New ResourceManager("MyNamespace.MyEbeddedFilename", System.Reflection.Assembly.GetExecutingAssembly())
Dim bmp As Bitmap = CType(rm.GetObject("what", Globalization.CultureInfo.CurrentCulture), Bitmap)
picturebox1.image = bmp
I have attached an example.
-
Apr 13th, 2003, 06:40 PM
#12
-
Apr 13th, 2003, 08:05 PM
#13
Sleep mode
Originally posted by DevGrp
Yes use a resource file. Cant give you an an example now, since my workstation is fried. I lost all my work that I've been working on for the last year and a half. I'm just starting to recover
Sorry to hear that DevGrp . I know how you feel now .Use DataFinal 2.0 (I think I have the final version) to recover all of your lost data . If you need it just let me know .
-
Apr 13th, 2003, 09:11 PM
#14
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|