Csharp/C Sharp/2D Graphics/Graphics File — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 15:31, 26 мая 2010
illustrates using a graphics file
/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy
Publisher: Sybex;
ISBN: 0782129110
*/
/*
Example21_5.cs illustrates using a graphics file
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.ruponentModel;
using System.Windows.Forms;
using System.Data;
public class Example21_5 : System.Windows.Forms.Form
{
private System.ruponentModel.Container components = null;
public Example21_5()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(400, 400);
this.Name = "Example21_5";
this.Text = "Example21_5";
this.Paint += new System.Windows.Forms.
PaintEventHandler(this.Example21_5_Paint);
}
static void Main()
{
Application.Run(new Example21_5());
}
private void Example21_5_Paint(
object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
// Load the image
Bitmap b = new Bitmap("CSharp.tif");
// and display it
g.DrawImage(b, 10, 10, 350, 300);
}
}