Adding bitmaps to project | | |
Hi there, I have a couple of bitmaps that are called in my project that I
need to use. They were added to my solution as existing objects and are
located in the same folder as the rest of the vb files.
I set their Build Action to Embedded Resource and compiled without any
errors, however, when calling them, like this inside Initialize Components:
myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))
I get this error:
An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'close.bmp' could not be found in class
'InnerView.InnerView.main'.
Help!???
Thanks,
Derek | | | | re: Adding bitmaps to project
Derek:
off the top of my head, I'm not sure. I think you need to reference the
project though. Here's the style I use regularly to get the info (not
saying this is better, but it definitely works)
case ImageName.RecordDisabled:
return new
Bitmap(System.Reflection.Assembly.GetExecutingAsse mbly().GetManifestResource
Stream("Project.Resource.jpg"));
"Derek Martin" <dmj2195@DONTSPAMMEokstate.edu> wrote in message
news:urUaS6DNEHA.2844@tk2msftngp13.phx.gbl...[color=blue]
> Hi there, I have a couple of bitmaps that are called in my project that I
> need to use. They were added to my solution as existing objects and are
> located in the same folder as the rest of the vb files.
>
> I set their Build Action to Embedded Resource and compiled without any
> errors, however, when calling them, like this inside Initialize[/color]
Components:[color=blue]
>
> myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
> Color.FromArgb(255, 0, 255), New Point(127, 8))
>
> I get this error:
>
> An unhandled exception of type 'System.ArgumentException' occurred in
> system.drawing.dll
> Additional information: Resource 'close.bmp' could not be found in class
> 'InnerView.InnerView.main'.
>
> Help!???
> Thanks,
> Derek
>
>[/color] | | | | re: Adding bitmaps to project
Hmmm...well, I tried something similar to that and also went and found some
examples on the internet, nothing seems to be different in my setup than the
examples.
My startup object isn't the form that these are in, could that be the
trouble?
Thanks!
Derek
"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:ODQ2V%23DNEHA.2876@TK2MSFTNGP09.phx.gbl...[color=blue]
> Derek:
>
> off the top of my head, I'm not sure. I think you need to reference the
> project though. Here's the style I use regularly to get the info (not
> saying this is better, but it definitely works)
> case ImageName.RecordDisabled:
> return new
>[/color]
Bitmap(System.Reflection.Assembly.GetExecutingAsse mbly().GetManifestResource[color=blue]
> Stream("Project.Resource.jpg"));
> "Derek Martin" <dmj2195@DONTSPAMMEokstate.edu> wrote in message
> news:urUaS6DNEHA.2844@tk2msftngp13.phx.gbl...[color=green]
> > Hi there, I have a couple of bitmaps that are called in my project that[/color][/color]
I[color=blue][color=green]
> > need to use. They were added to my solution as existing objects and are
> > located in the same folder as the rest of the vb files.
> >
> > I set their Build Action to Embedded Resource and compiled without any
> > errors, however, when calling them, like this inside Initialize[/color]
> Components:[color=green]
> >
> > myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
> > Color.FromArgb(255, 0, 255), New Point(127, 8))
> >
> > I get this error:
> >
> > An unhandled exception of type 'System.ArgumentException' occurred in
> > system.drawing.dll
> > Additional information: Resource 'close.bmp' could not be found in class
> > 'InnerView.InnerView.main'.
> >
> > Help!???
> > Thanks,
> > Derek
> >
> >[/color]
>
>[/color] | | | | re: Adding bitmaps to project
I decided after fighting with it for quite some time to create a bitmap
right from within VS. Did an Add New Item, Bitmap File and saved it to the
solution. Properties set to Embedded Resource and changed the line to look
like this:
taskbarNotifier1.SetCloseBitmap(New Bitmap(MyClass.GetType(),
"Bitmap1.bmp"), Color.FromArgb(255, 0, 255), New Point(127, 8))
Same error - I MUST be doing something very small and wrong
consistently...anyone???
Thanks!
Derek
"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:ODQ2V%23DNEHA.2876@TK2MSFTNGP09.phx.gbl...[color=blue]
> Derek:
>
> off the top of my head, I'm not sure. I think you need to reference the
> project though. Here's the style I use regularly to get the info (not
> saying this is better, but it definitely works)
> case ImageName.RecordDisabled:
> return new
>[/color]
Bitmap(System.Reflection.Assembly.GetExecutingAsse mbly().GetManifestResource[color=blue]
> Stream("Project.Resource.jpg"));
> "Derek Martin" <dmj2195@DONTSPAMMEokstate.edu> wrote in message
> news:urUaS6DNEHA.2844@tk2msftngp13.phx.gbl...[color=green]
> > Hi there, I have a couple of bitmaps that are called in my project that[/color][/color]
I[color=blue][color=green]
> > need to use. They were added to my solution as existing objects and are
> > located in the same folder as the rest of the vb files.
> >
> > I set their Build Action to Embedded Resource and compiled without any
> > errors, however, when calling them, like this inside Initialize[/color]
> Components:[color=green]
> >
> > myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
> > Color.FromArgb(255, 0, 255), New Point(127, 8))
> >
> > I get this error:
> >
> > An unhandled exception of type 'System.ArgumentException' occurred in
> > system.drawing.dll
> > Additional information: Resource 'close.bmp' could not be found in class
> > 'InnerView.InnerView.main'.
> >
> > Help!???
> > Thanks,
> > Derek
> >
> >[/color]
>
>[/color] | | | | re: Adding bitmaps to project
Derek: I just used your bitmap name and stuck it in a project called
WindowsApplication10. I added a bitmap I had and called it Close.bmp to
match your situation. Worked without a glitch..you may want to use this
syntax:
Dim testBitmap As New
Bitmap(Reflection.Assembly.GetExecutingAssembly.Ge tManifestResourceStream("W
indowsApplication10.Close.bmp"))
Me.Button1.Image = testBitmap
"Derek Martin" <dmj2195@DONTSPAMMEokstate.edu> wrote in message
news:urUaS6DNEHA.2844@tk2msftngp13.phx.gbl...[color=blue]
> Hi there, I have a couple of bitmaps that are called in my project that I
> need to use. They were added to my solution as existing objects and are
> located in the same folder as the rest of the vb files.
>
> I set their Build Action to Embedded Resource and compiled without any
> errors, however, when calling them, like this inside Initialize[/color]
Components:[color=blue]
>
> myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
> Color.FromArgb(255, 0, 255), New Point(127, 8))
>
> I get this error:
>
> An unhandled exception of type 'System.ArgumentException' occurred in
> system.drawing.dll
> Additional information: Resource 'close.bmp' could not be found in class
> 'InnerView.InnerView.main'.
>
> Help!???
> Thanks,
> Derek
>
>[/color] | | | | re: Adding bitmaps to project
Okay, I got that working and that led me down a few more paths...I am
running the method that is calling my bitmap popup (see the toaster posts
below in NG if interested) in a thread which is not allowing it to push it
out correctly - jumps right over it.
SO - thanks so much for you help!!!! Now I just have to figure out how to
make that thing work in a thread and I am in business!
:-)
Derek
"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:OQisY0FNEHA.2716@tk2msftngp13.phx.gbl...[color=blue]
> Derek: I just used your bitmap name and stuck it in a project called
> WindowsApplication10. I added a bitmap I had and called it Close.bmp to
> match your situation. Worked without a glitch..you may want to use this
> syntax:
>
> Dim testBitmap As New
>[/color]
Bitmap(Reflection.Assembly.GetExecutingAssembly.Ge tManifestResourceStream("W[color=blue]
> indowsApplication10.Close.bmp"))
>
> Me.Button1.Image = testBitmap
>
> "Derek Martin" <dmj2195@DONTSPAMMEokstate.edu> wrote in message
> news:urUaS6DNEHA.2844@tk2msftngp13.phx.gbl...[color=green]
> > Hi there, I have a couple of bitmaps that are called in my project that[/color][/color]
I[color=blue][color=green]
> > need to use. They were added to my solution as existing objects and are
> > located in the same folder as the rest of the vb files.
> >
> > I set their Build Action to Embedded Resource and compiled without any
> > errors, however, when calling them, like this inside Initialize[/color]
> Components:[color=green]
> >
> > myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
> > Color.FromArgb(255, 0, 255), New Point(127, 8))
> >
> > I get this error:
> >
> > An unhandled exception of type 'System.ArgumentException' occurred in
> > system.drawing.dll
> > Additional information: Resource 'close.bmp' could not be found in class
> > 'InnerView.InnerView.main'.
> >
> > Help!???
> > Thanks,
> > Derek
> >
> >[/color]
>
>[/color] | | | | re: Adding bitmaps to project
By the way, to get it to work, I had to put the bmp in the exe directory of
the project and make this line:
taskbarNotifier1.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))
Say this instead:
taskbarNotifier1.SetCloseBitmap("close.bmp", Color.FromArgb(255, 0, 255),
New Point(127, 8))
It works, but the downside is, obviously, the bmp isn't included in the exe
file which would allow someone to change it and that's bad, but I cannot for
the life of me get that first line example to work.
Any ideas?
Thanks,
Derek
"Derek Martin" <dmj2195@DONTSPAMMEokstate.edu> wrote in message
news:Oz2%23qDGNEHA.644@tk2msftngp13.phx.gbl...[color=blue]
> Okay, I got that working and that led me down a few more paths...I am
> running the method that is calling my bitmap popup (see the toaster posts
> below in NG if interested) in a thread which is not allowing it to push it
> out correctly - jumps right over it.
>
> SO - thanks so much for you help!!!! Now I just have to figure out how to
> make that thing work in a thread and I am in business!
>
> :-)
>
> Derek
>
>
> "William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
> news:OQisY0FNEHA.2716@tk2msftngp13.phx.gbl...[color=green]
> > Derek: I just used your bitmap name and stuck it in a project called
> > WindowsApplication10. I added a bitmap I had and called it Close.bmp to
> > match your situation. Worked without a glitch..you may want to use[/color][/color]
this[color=blue][color=green]
> > syntax:
> >
> > Dim testBitmap As New
> >[/color]
>[/color]
Bitmap(Reflection.Assembly.GetExecutingAssembly.Ge tManifestResourceStream("W[color=blue][color=green]
> > indowsApplication10.Close.bmp"))
> >
> > Me.Button1.Image = testBitmap
> >
> > "Derek Martin" <dmj2195@DONTSPAMMEokstate.edu> wrote in message
> > news:urUaS6DNEHA.2844@tk2msftngp13.phx.gbl...[color=darkred]
> > > Hi there, I have a couple of bitmaps that are called in my project[/color][/color][/color]
that[color=blue]
> I[color=green][color=darkred]
> > > need to use. They were added to my solution as existing objects and[/color][/color][/color]
are[color=blue][color=green][color=darkred]
> > > located in the same folder as the rest of the vb files.
> > >
> > > I set their Build Action to Embedded Resource and compiled without any
> > > errors, however, when calling them, like this inside Initialize[/color]
> > Components:[color=darkred]
> > >
> > > myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(),[/color][/color][/color]
"close.bmp"),[color=blue][color=green][color=darkred]
> > > Color.FromArgb(255, 0, 255), New Point(127, 8))
> > >
> > > I get this error:
> > >
> > > An unhandled exception of type 'System.ArgumentException' occurred in
> > > system.drawing.dll
> > > Additional information: Resource 'close.bmp' could not be found in[/color][/color][/color]
class[color=blue][color=green][color=darkred]
> > > 'InnerView.InnerView.main'.
> > >
> > > Help!???
> > > Thanks,
> > > Derek
> > >
> > >[/color]
> >
> >[/color]
>
>[/color] |  | Similar Visual Basic .NET bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,467 network members.
|