Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Set Image to Button

Set Image to Button

Scheduled Pinned Locked Moved C#
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KIDYA
    wrote on last edited by
    #1

    Hello Experts, I am using System.Windows.Controls.Button and want to set image to button or background as a image.However i didn't find image property to button.I use following code but still not working.My main aim is setting up an image. Thanks.

    OriginalGriffO R M 3 Replies Last reply
    0
    • K KIDYA

      Hello Experts, I am using System.Windows.Controls.Button and want to set image to button or background as a image.However i didn't find image property to button.I use following code but still not working.My main aim is setting up an image. Thanks.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Um. I did:

      Button myButton = new Button();
      myButton.Image = Image.FromFile(@"D:\Temp\MyPic.jpg");

      I don't know where you are looking, but it isn't in the Button properties... :laugh:

      Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      K 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Um. I did:

        Button myButton = new Button();
        myButton.Image = Image.FromFile(@"D:\Temp\MyPic.jpg");

        I don't know where you are looking, but it isn't in the Button properties... :laugh:

        Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

        K Offline
        K Offline
        KIDYA
        wrote on last edited by
        #3

        I am not able to find Image property of Button. I searched on google too but i didn't get anything. I am working with WPF and C#.

        OriginalGriffO 1 Reply Last reply
        0
        • K KIDYA

          I am not able to find Image property of Button. I searched on google too but i didn't get anything. I am working with WPF and C#.

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          If you are using WPF, then please make it clear in the question! :laugh: I'm surprised you couldn't find anything with Google: I did. Google[^] http://blogs.msdn.com/b/knom/archive/2007/10/31/wpf-control-development-3-ways-to-build-an-imagebutton.aspx[^]

          Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          1 Reply Last reply
          0
          • K KIDYA

            Hello Experts, I am using System.Windows.Controls.Button and want to set image to button or background as a image.However i didn't find image property to button.I use following code but still not working.My main aim is setting up an image. Thanks.

            R Offline
            R Offline
            RaviRanjanKr
            wrote on last edited by
            #5

            Try WPF Button with Image[^]

            1 Reply Last reply
            0
            • K KIDYA

              Hello Experts, I am using System.Windows.Controls.Button and want to set image to button or background as a image.However i didn't find image property to button.I use following code but still not working.My main aim is setting up an image. Thanks.

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              And just FYI there's a Silverlight/WPF board[^] for Silverlight/WPF questions. :)

              Mark Salsbery :java:

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups