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. image display on window form

image display on window form

Scheduled Pinned Locked Moved C#
comhelptutorialquestion
6 Posts 5 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.
  • M Offline
    M Offline
    Member_3259094
    wrote on last edited by
    #1

    hi every buddy i have to display a image on the page to how to do that? image is a animated image, plz help.

    Rajeev Kr. Sharma VRI Software Pvt.Ltd. New Delhi India HumOnline.com Stay Connected

    J G E 3 Replies Last reply
    0
    • M Member_3259094

      hi every buddy i have to display a image on the page to how to do that? image is a animated image, plz help.

      Rajeev Kr. Sharma VRI Software Pvt.Ltd. New Delhi India HumOnline.com Stay Connected

      J Offline
      J Offline
      J a a n s
      wrote on last edited by
      #2

      RajeevKumarSharma wrote:

      display a image on the page

      If you mean a web page, you can use Img[^] tag If you are trying to use display it in a form, use PictureBox[^] control

      *jaans

      M 1 Reply Last reply
      0
      • M Member_3259094

        hi every buddy i have to display a image on the page to how to do that? image is a animated image, plz help.

        Rajeev Kr. Sharma VRI Software Pvt.Ltd. New Delhi India HumOnline.com Stay Connected

        G Offline
        G Offline
        Gareth H
        wrote on last edited by
        #3

        RajeevKumarSharma, You have to ways. Use Graphics to do it, or use a PictureBox. I am guessing your pretty new to C# so id go with PictureBox. Regards, Gareth.

        1 Reply Last reply
        0
        • J J a a n s

          RajeevKumarSharma wrote:

          display a image on the page

          If you mean a web page, you can use Img[^] tag If you are trying to use display it in a form, use PictureBox[^] control

          *jaans

          M Offline
          M Offline
          Member_3259094
          wrote on last edited by
          #4

          private Bitmap MyImage ; public void ShowMyImage(String fileToDisplay, int xSize, int ySize) { // Sets up an image object to be displayed. if (MyImage != null) { MyImage.Dispose(); } // Stretches the image to fit the pictureBox. pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ; MyImage = new Bitmap(fileToDisplay); HOW TO GIVE HERE FILE PATH WHICH EXIST IN MY PROJECT pictureBox1.ClientSize = new Size(xSize, ySize); pictureBox1.Image = (Image) MyImage ; } please look on the bold,under line text

          Rajeev Kr. Sharma VRI Software Pvt.Ltd. New Delhi India HumOnline.com Stay Connected

          V 1 Reply Last reply
          0
          • M Member_3259094

            private Bitmap MyImage ; public void ShowMyImage(String fileToDisplay, int xSize, int ySize) { // Sets up an image object to be displayed. if (MyImage != null) { MyImage.Dispose(); } // Stretches the image to fit the pictureBox. pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ; MyImage = new Bitmap(fileToDisplay); HOW TO GIVE HERE FILE PATH WHICH EXIST IN MY PROJECT pictureBox1.ClientSize = new Size(xSize, ySize); pictureBox1.Image = (Image) MyImage ; } please look on the bold,under line text

            Rajeev Kr. Sharma VRI Software Pvt.Ltd. New Delhi India HumOnline.com Stay Connected

            V Offline
            V Offline
            Vikram A Punathambekar
            wrote on last edited by
            #5

            Just use the relative path for fileToDisplay. Example: "cool.bmp" or "..\\images\\cool.bmp".

            Cheers, Vikram.


            "I will put my new found knolage to good use" - Captain See Sharp. "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.

            1 Reply Last reply
            0
            • M Member_3259094

              hi every buddy i have to display a image on the page to how to do that? image is a animated image, plz help.

              Rajeev Kr. Sharma VRI Software Pvt.Ltd. New Delhi India HumOnline.com Stay Connected

              E Offline
              E Offline
              electriac
              wrote on last edited by
              #6

              This should do what you want Bitmap pic = new Bitmap(fname); xsize = pic.Width; ysize = pic.Height; // Adjust the position of the picture box pictureBox1.Location = new System.Drawing.Point((0, 0); // Adjust the size of the picture box pictureBox1.Size = new System.Drawing.Size(xsize, ysize); // Display the image pictureBox1.Image = pic;

              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