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. How to draw over a image and it be save?

How to draw over a image and it be save?

Scheduled Pinned Locked Moved C#
csharpgraphicstutorialquestion
6 Posts 2 Posters 2 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.
  • S Offline
    S Offline
    sathishtl007
    wrote on last edited by
    #1

    please ans: i do a graphics project ,i want to known can i draw over a image using pen or brush.in c# please response.......

    C 1 Reply Last reply
    0
    • S sathishtl007

      please ans: i do a graphics project ,i want to known can i draw over a image using pen or brush.in c# please response.......

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      using (Graphics gr = Graphics.FromImage(image)) { // Draw on the bitmap using the graphics object }

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      S 1 Reply Last reply
      0
      • C Christian Graus

        using (Graphics gr = Graphics.FromImage(image)) { // Draw on the bitmap using the graphics object }

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        S Offline
        S Offline
        sathishtl007
        wrote on last edited by
        #3

        i am using like this. img = (Bitmap)Bitmap.FromFile(ofd.FileName); Graphics gr = Graphics.FromImage(img); gr.DrawEllipse(new Pen(Color.Black), new Rectangle(300, 300, 10, 50)); doc[1].inkPicture1.Image = and i am using a ink picture box how to add his graphics object to this picture box

        C 1 Reply Last reply
        0
        • S sathishtl007

          i am using like this. img = (Bitmap)Bitmap.FromFile(ofd.FileName); Graphics gr = Graphics.FromImage(img); gr.DrawEllipse(new Pen(Color.Black), new Rectangle(300, 300, 10, 50)); doc[1].inkPicture1.Image = and i am using a ink picture box how to add his graphics object to this picture box

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          sathishtl007 wrote:

          how to add his graphics object to this picture box

          You don't. You add a bitmap to a picture box, and you use a graphics object to change a bitmap. doc[1].inkPicture1.Image = img; should show your ellipse, assuming it's not on a bitmap that's all black anyhow. ( and that the bitmap is larger than 300 x 300, otherwise, you drew it off the bitmap )

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

          S 1 Reply Last reply
          0
          • C Christian Graus

            sathishtl007 wrote:

            how to add his graphics object to this picture box

            You don't. You add a bitmap to a picture box, and you use a graphics object to change a bitmap. doc[1].inkPicture1.Image = img; should show your ellipse, assuming it's not on a bitmap that's all black anyhow. ( and that the bitmap is larger than 300 x 300, otherwise, you drew it off the bitmap )

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

            S Offline
            S Offline
            sathishtl007
            wrote on last edited by
            #5

            one more Question ? how to place a image over an image? and how can i save this grouped images?

            C 1 Reply Last reply
            0
            • S sathishtl007

              one more Question ? how to place a image over an image? and how can i save this grouped images?

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              sathishtl007 wrote:

              how to place a image over an image?

              gr.DrawImage will draw an image into a graphics object. If that graphics object is made from another Image, they get drawn onto each other

              sathishtl007 wrote:

              and how can i save this grouped images?

              That's two questions :-) Just to be clear - you have only one bitmap, the bitmap you draw over it is not a grouping of images, it's a bitmap where a block of pixels has been changed to look like the source bitmap. The Bitmap class has a Save method.

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

              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