Click here to Skip to main content
15,886,772 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,I'm trying to loade a bitmap image into inkcanvas using open file dialog , not by determine the path like this code how can do this ?
C#
ImageBrush ib = new ImageBrush();
           ib.ImageSource = new BitmapImage(new Uri(@"E:\ss.jpg", UriKind.Relative));
           myInkCanvas.Background = ib;
Posted

1 solution

Well it was always available on MSDN[^]. Didn't you look on MSDN to find an answer to the problem?

Look into the documentation and check how can you get the user to be able to get a file selected from the File System using the OpenFileDialog.

Example code for this would like as below,

C#
// create instance
OpenFileDialog fileOpener = new OpenFileDialog();

// set properties..
// select only one file
fileOpener.MultiSelect = false;

// show the dialog, returns nullable bool value
bool? result = openFileDialog1.ShowDialog();
if(result == true) {
   // file selected, check for the file and use it 
   // in your application.
}
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 10-Nov-14 16:48pm    
I voted 5. Now, about our discussion in the Abuse Watch forum...

Please don't think that I tried to "counter-voted" against the vote of 1 you complained about in the Abuse Watch forum. Some people to that, but I don't.
I voted because I find it appropriate considering the quality of the answer and its usefulness for OP, nothing else. In some other cases, I down-vote, also motivated by quality of the answer, something I find wrong...

And... yes, I think there is such thing, something I call "emotional vote". It you look at the timing of voted, it looks like someone was irritated by one or more of your posts, and decided to down-voted several posts in a raw, maybe without thorough reading. It just happens; in some cases, I experienced some 10+ down-votes like that. I think reporting "the war" in Abuse Watch is just useless... See also my comment to the comment by Chris Maunder...

—SA
Afzaal Ahmad Zeeshan 10-Nov-14 16:54pm    
First of all, thanks for your +5. :-)

Secondly, I get your point and feel a little safer and encouraged now by having to know this thing happens usually here. I have posted that discussion since I believed it was an abusive behaviour, and the timing of the down-votes started right after the warning so I thought there might be a connection in between the two things.

Since I've got enough positive approach by good fellows on CodeProject, I don't feel bad for those down-votes and rep.

I have seen your comment and I'm thank full to you for coming up for me and I have also posted a reply there.

Thanks Sergey.
Sergey Alexandrovich Kryukov 10-Nov-14 17:14pm    
Great. Some patience always pays off, on average and with time.
Cheers,
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900