Windows Vista Forums

programatically set the content of a label to be a bitmap?
  1. #1


    CosminB [BRT] Guest

    programatically set the content of a label to be a bitmap?

    Hi,



    I have two pictures taken periodically from a webcam. I diff the two,
    and the result is a Bitmap. I want this Bitmap to be displayed as a
    label's Content. How do I do this programatically?

    Something like:

    label.Content = new System.Windows.Controls.Image(bmp);

    (Of course, that's not real code, but you get my point)

    Anyone knows how to do this?

    Thanks in advance,
    Cosmin.


      My System SpecsSystem Spec

  2. #2


    Vipin [MVP] Guest

    Re: programatically set the content of a label to be a bitmap?

    like this:-
    public Window1()
    {
    InitializeComponent();

    BitmapImage myBitmapImage = new BitmapImage();
    Image myImage = new Image();
    myImage.Width = 200;

    myBitmapImage.BeginInit();
    myBitmapImage.UriSource = new
    Uri(@"C:\\windows\\system32\\setup.bmp");
    myBitmapImage.EndInit();
    myImage.Source = myBitmapImage;

    lbl.Content = myImage;
    }

    --
    Vipin Aravind
    http://www.explorewindows.com
    http://forums.techedindia.com


    "CosminB [BRT]" <cosminb@gmail.com> wrote in message
    news:1149679327.542328.139320@i39g2000cwa.googlegroups.com...
    > Hi,
    >
    > I have two pictures taken periodically from a webcam. I diff the two,
    > and the result is a Bitmap. I want this Bitmap to be displayed as a
    > label's Content. How do I do this programatically?
    >
    > Something like:
    >
    > label.Content = new System.Windows.Controls.Image(bmp);
    >
    > (Of course, that's not real code, but you get my point)
    >
    > Anyone knows how to do this?
    >
    > Thanks in advance,
    > Cosmin.
    >




      My System SpecsSystem Spec

programatically set the content of a label to be a bitmap? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help regarding programatically generating CSR Usman Jamil .NET General 0 15 Dec 2009
Programatically register OCX in Vista Rose B Vista General 0 11 Sep 2009
Implement DeepZoom Programatically ShaunO .NET General 0 21 Oct 2008
Set-Content not updating file after get-content and forEach-Object Tolli PowerShell 1 14 Jun 2007
Weirdness with get-content | replace | set-content - file content is deleted!! Andrew Watt [MVP] PowerShell 4 23 May 2006