Click here to Skip to main content
13,053,891 members (59,716 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to get the control inside image in wpf
Posted 10-Feb-13 0:14am
Updated 10-Feb-13 1:05am
What is that supposed to mean?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The source of the image can be used like:
ImageSource imageSource = new BitmapImage(new Uri("C:\\FileName.gif"));
image1.Source = imageSource;

The following example shows how to render an image 200 pixels wide using code:
// Create Image Element
Image myImage = new Image();
myImage.Width = 200;
// Create source
BitmapImage myBitmapImage = new BitmapImage();
// BitmapImage.UriSource must be in a BeginInit/EndInit block
myBitmapImage.UriSource = new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water Lilies.jpg");
// To save significant application memory, set the DecodePixelWidth or  
// DecodePixelHeight of the BitmapImage value of the image source to the desired 
// height or width of the rendered image. If you don't do this, the application will 
// cache the image as though it were rendered as its normal size rather then just 
// the size that is displayed.
// Note: In order to preserve aspect ratio, set DecodePixelWidth
// or DecodePixelHeight but not both.
myBitmapImage.DecodePixelWidth = 200;
//set image source
myImage.Source = myBitmapImage;

I'm afraid this is not an answer, and I don't think this question needs answer as it sounds like a gibberish to me; what is "control inside image"?!
(I did not vote this time.)
Edo Tzumer 10-Feb-13 9:37am
Well, you're right of course.
The guy definitely has SOMETHING in mind.
Either you ditch him by saying that this kind of "question" is unaccepted, or try to help him out with expressing what he wants\needs\misses etc
I guess you are more of an A type than a B.
[perhaps everyone is a B type until they realize its impossible to solve the world's undefined problems...]
I'm none of the types you described...
But without "expressing" the answer can only confuse.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 10 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100