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. Web Development
  3. ASP.NET
  4. Can't find Graphics.FromImage

Can't find Graphics.FromImage

Scheduled Pinned Locked Moved ASP.NET
graphicssecurityquestion
4 Posts 2 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.
  • X Offline
    X Offline
    xiaowenjie
    wrote on last edited by
    #1

    hi, I need to use Gaphics g = new Graphics.FromImage(bmp) but i could not find the method .FromImage. I've added namespace like using System; using System.Data; using System.Text; using System.Web; using System.Drawing; using System.Drawing.Text; using System.Drawing.Imaging; using System.Security.Cryptography; using System.Drawing.Drawing2D; why is it like this?

    G 1 Reply Last reply
    0
    • X xiaowenjie

      hi, I need to use Gaphics g = new Graphics.FromImage(bmp) but i could not find the method .FromImage. I've added namespace like using System; using System.Data; using System.Text; using System.Web; using System.Drawing; using System.Drawing.Text; using System.Drawing.Imaging; using System.Security.Cryptography; using System.Drawing.Drawing2D; why is it like this?

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      That is not possible. FromImage is a method, not a constructor, so you can not use it that way. If you skip the new keyword, it will work.

      --- Year happy = new Year(2007);

      X 1 Reply Last reply
      0
      • G Guffa

        That is not possible. FromImage is a method, not a constructor, so you can not use it that way. If you skip the new keyword, it will work.

        --- Year happy = new Year(2007);

        X Offline
        X Offline
        xiaowenjie
        wrote on last edited by
        #3

        oh so i can just put it this way: Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb); Graphics gph = new Graphics(bmp)??

        G 1 Reply Last reply
        0
        • X xiaowenjie

          oh so i can just put it this way: Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb); Graphics gph = new Graphics(bmp)??

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          No, you can't. There is no public constructor for the Graphics class.

          --- Year happy = new Year(2007);

          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