Simple Drawing : Graphics « Development « ASP.NET Tutorial

Home
ASP.NET Tutorial
1.ASP.Net Instroduction
2.Language Basics
3.ASP.net Controls
4.HTML Controls
5.Page Lifecycle
6.Response
7.Collections
8.Validation
9.Development
10.File Directory
11.Sessions
12.Cookie
13.Cache
14.Custom Controls
15.Profile
16.Configuration
17.LINQ
18.ADO.net Database
19.Data Binding
20.Ajax
21.Authentication Authorization
22.I18N
23.Mobile
24.WebPart
25.XML
ASP.NET Tutorial » Development » Graphics 
9.22.1.Simple Drawing
<%@ Page language="c#" Inherits="SimpleDrawing" CodeFile="Default.aspx.cs" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
    <title>SimpleDrawing</title>
    </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
    </form>
  </body>
</HTML>
File: Default.aspx.cs

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class SimpleDrawing : System.Web.UI.Page
{
  protected void Page_Load(object sender, System.EventArgs e)
  {
    Bitmap image = new Bitmap(30050);
    Graphics g = Graphics.FromImage(image);

    g.DrawRectangle(Pens.Green, 0029949);

    Font font = new Font("Impact"20, FontStyle.Regular);
    g.DrawString("This is a test.", font, Brushes.Blue, 105);

        image.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);

        g.Dispose();
        image.Dispose();
  }
}
9.22.Graphics
9.22.1.Simple Drawing
9.22.2.Mixed drawing
9.22.3.ThumbmailViewer
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.