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. problem with drawing a polygon

problem with drawing a polygon

Scheduled Pinned Locked Moved ASP.NET
graphicscsharphtmlhelp
2 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.
  • N Offline
    N Offline
    Nafiseh Salmani
    wrote on last edited by
    #1

    I want to draw a polygon using Graphic class on a webform, I use the following code but it doesn't show anything!!! :doh:

    protected void Page_Load(object sender, EventArgs e)
    {
    Bitmap objBitmap;
    Graphics objGraphics;

            objBitmap = new Bitmap(400, 440);
            objGraphics = Graphics.FromImage(objBitmap);
            objGraphics.Clear(Color.Blue); 
        }
    

    even I delete all the HTML tag except

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ImageResults.aspx.cs" Inherits="Yadgirandeh.WebForm5" %>;

    I would be really grateful if anybody helps me.

    L 1 Reply Last reply
    0
    • N Nafiseh Salmani

      I want to draw a polygon using Graphic class on a webform, I use the following code but it doesn't show anything!!! :doh:

      protected void Page_Load(object sender, EventArgs e)
      {
      Bitmap objBitmap;
      Graphics objGraphics;

              objBitmap = new Bitmap(400, 440);
              objGraphics = Graphics.FromImage(objBitmap);
              objGraphics.Clear(Color.Blue); 
          }
      

      even I delete all the HTML tag except

      <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ImageResults.aspx.cs" Inherits="Yadgirandeh.WebForm5" %>;

      I would be really grateful if anybody helps me.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You need to set the response type of the response, and then write the bitmap to the output stream of the response. Something like (after your existing code)...

          Response.ContentType = "image/jpeg";
          Response.Clear();
          Response.BufferOutput = true;
          objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
          Response.Flush();
      

      Assuming your other code is correct which I haven't really checked.

      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