Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - External resources and forms designer

Reply
 
Old 06-18-2008   #1 (permalink)
Fred


 
 

External resources and forms designer

Hello,

I created a class library project to store my images resources.
In another project (windows app) I just want to set an image for a
toolstripbutton.
Where can I write this simple line of code :
ToolStripButton1.Image = ExternalResource.ButtonImage
So that I can see the image in design mode ? And so that Visual Studio
won't create a copy of my image in the form's resx file ?

--
Fred
foleide@xxxxxx


My System SpecsSystem Spec
Old 06-18-2008   #2 (permalink)
Frédéric Queudret


 
 

Re: External resources and forms designer

Hi,

You just need to add a Resource File to your ClassLibrary project.
Open the resources designer (just double-click on the resx file) and change
the 'Access Modifier' property in the designer (located on the top of the
designer-> you have a combo box and you can switch from private to public).

Then Add a reference to your classlibrary from your windows forms app and
you can code something like this:
pictureBox1.Image = ExternalResources.Image1;
(assuming you have declared the 'using' reference).

Frédéric Queudret
CTO Mpoware
http://www.mpoware.com/


"Fred" <foleide@xxxxxx> wrote in message
news:OcBMndU0IHA.4500@xxxxxx
Quote:

> Hello,
>
> I created a class library project to store my images resources.
> In another project (windows app) I just want to set an image for a
> toolstripbutton.
> Where can I write this simple line of code :
> ToolStripButton1.Image = ExternalResource.ButtonImage
> So that I can see the image in design mode ? And so that Visual Studio
> won't create a copy of my image in the form's resx file ?
>
> --
> Fred
> foleide@xxxxxx
My System SpecsSystem Spec
Old 06-18-2008   #3 (permalink)
Fred


 
 

Re: External resources and forms designer

Dans : news:C0130BFA-3790-4B84-BB0F-ADCE200FF9C4@xxxxxx,
Frédéric Queudret écrivait :
Quote:

> Hi,
Hello,
Quote:

> You just need to add a Resource File to your ClassLibrary project.
> Open the resources designer (just double-click on the resx file) and
> change the 'Access Modifier' property in the designer (located on the
> top of the designer-> you have a combo box and you can switch from
> private to public).
Yes, that's what I did
Quote:

> Then Add a reference to your classlibrary from your windows forms app
> and you can code something like this:
> pictureBox1.Image = ExternalResources.Image1;
> (assuming you have declared the 'using' reference).
Yes, my problem is where to write this.
I program with vb.NET
If I write in the constructor, the image won't appear in Design mode.
If I write in the generated code, it appears, but if I make a change and
the code is generated again, Visual Studio makes a copy of my image in
the form's resx file and change my code.

I will simply keep theses resources in the same assembly. I need some
external resources elsewhere but it is not so important here.

--
Fred
foleide@xxxxxx

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
designer Vista General
simulate continuous forms & subforms in a windows forms application .NET General
Expression Web Designer Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46