View Complete Post
I have a piece of hardware saving image data to memory which I would like to retrieve and set as the source to an Image element. I am able to ask the hardware for a DIB handle to the image -- the return value is documented as "a long, which should
be cast to a HBITMAP". How can I do this in WPF?
I'm currently reading up on BitmapSource.Create(), which takes an IntPtr to memory, but I'm not sure it is expecting a DIB or not. Also, the function asks for "stride" which I am unfamiliar with computing. This appears to be the most
promising though, since I can set it straight to an Image.Source parameter.
The hardware I have also has a function to grab a LPPICTUREDISP handle, which is documented as being compatible with the "Picture Object" of Visual Basic and C++. From my reading so far it doesn't sound like this is something that is better
suited for my needs, but I'm not sure.
Thanks for any help
I get new bitmap from some other component ( dont have any control on the other component ) every 5 seconds and i need to update my wpf image control with the new bitmap ( every 5 seconds ... ).
[ i cant save the bitmap to the disk and then load it as file ]
I cant find any way to update this wpf image control in run-time.
How can i do it ?
I am building a class library project.ÃÂ I have embedded images into this library and have several controls that use the following XAML:
What is the equivalent run time C# code to create an Image (or set the Image property of an existingÃÂ control) with myImage.png?
I am currently trying:
Is it possible to bind a xaml control's image source directly from the resource file ?
This is the WPF Window Class:
public partial class MainWindow : Window
public Bitmap image;
public CaptureModel cm = CaptureModel.Instance;
image = cm.Image;
DataContext = this.image;
CaptureModel.Instance.PropertyChanged += new PropertyChangedEventHandler(Instance_PropertyChanged);
void Instance_PropertyChanged(object sender, PropertyChangedEventArgs e)
if (e.PropertyName == "ImageChanged")
this.image = cm.Image;
And this is the .xaml for it: