c# - Resource-Image usability for a Canvas background -


I will be able to program a small program, where you can click on the canvas and you will get RGB color value clicked pixels for.

The first thing I did was the graphics on my own HDD with the full path, the problem is that the program will crash on another PC;)

Then, I called "explorer" There was a folder in which the project was Explorer. All the graphics I need should be highlighted.

If I define some images in WPF and write it, then

  ... source = "/ Resourcen / color_wheel_730.png"  < / Pre> 

get the correct source of the image.

But if I want to use it for the canvas in the source, then it does not run without errors. #

P>
  canvas_colorpick.Background = new ImageBrush {ImageSource = new bitmap image (new urie (@ ".. \ .. \ Resourcen \ color_wheel_730.png", UriKind.Relative))} ;  

I tested some formatting, but nothing would work in the source code section: (After a few hours of testing, I thought I had to put a question in these forums. / P>

Hope someone can help me with my noob question above.

Congratulations to Germany! Bjoern

Ensure that you BuildAction to the image file added to your project Money is set as the . / P>

Also try to provide Yuri source:

  canvas_colorpick.Background = new ImageBrush {ImageSource = new bitmapImage (new ury (@ "pack: // application:,, / Resourcen / color_wheel_730.png"))}  

Note - Folder resourcen folded into a single project assuming the folder where XAML remains.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -