3 Replies - 2106 Views - Last Post: 29 April 2012 - 05:57 AM Rate Topic: -----

#1 TheFreeman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 31-December 11

BitmapImage URL need to set for multiple machines

Posted 26 April 2012 - 06:50 AM

Hey guys is there a way I can set the URL ... the one below

System.Windows.Controls.Image ch = new System.Windows.Controls.Image();
ch.Source = new BitmapImage(new Uri(@"C:\Users\Shadow\Desktop\crosshare.png"));

For multiple machines, because as it is it just works on my pc.

Is there a way I can do it to get it from the Resources Folder?

For ex. Properties.Resources.Pic1.png

Thanks,
TheFreeman

Is This A Good Question/Topic? 0
  • +

Replies To: BitmapImage URL need to set for multiple machines

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: BitmapImage URL need to set for multiple machines

Posted 26 April 2012 - 08:35 AM

Of course it only works on your PC....you are mapping directly to your desktop. Your desktop doesn't exist on other PCs.

Yes, you can do this. Simply add the image to the project, then use code like this..

// image was added to an Images folder in the project
BitmapImage image = new BitmapImage(new Uri("/Images/crosshare.png", UriKind.Relative));



Untested, but it should work.
Was This Post Helpful? 1
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5432
  • View blog
  • Posts: 11,643
  • Joined: 02-June 10

Re: BitmapImage URL need to set for multiple machines

Posted 26 April 2012 - 11:42 AM

Quote

crosshare.png


Is that a pic of an angry rabbit??
Was This Post Helpful? 0
  • +
  • -

#4 TheFreeman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 31-December 11

Re: BitmapImage URL need to set for multiple machines

Posted 29 April 2012 - 05:57 AM

Hey guys sorry for the late reply :)

Thanks for the help m8 appreciated =)

Thanks,
TheFreeman
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1