Thumbnail Image Creation : Draw Image « 2D « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » 2D » Draw Image 
27.19.2.Thumbnail Image Creation
Thumbnail Image Creation
using System;
using System.Drawing;
using System.Windows.Forms;

public class ThumbnailImageCreation : Form
{
    public ThumbnailImageCreation()
    {
        this.SuspendLayout();

        this.AutoScaleDimensions = new System.Drawing.SizeF(6F13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(299273);
        this.Text = "Thumbnails";
        this.Paint += new System.Windows.Forms.PaintEventHandler(this.ThumbnailImageCreation_Paint);
        this.Load += new System.EventHandler(this.ThumbnailImageCreation_Load);
        this.ResumeLayout(false);

    }

    Image thumbnail;

    private void ThumbnailImageCreation_Load(object sender, EventArgs e)
    {
        Image img = Image.FromFile("YourFile.jpg");
        
        int thumbnailWidth = 200, thumbnailHeight = 100;

        thumbnail = img.GetThumbnailImage(thumbnailWidth, thumbnailHeight,
          null, IntPtr.Zero);
        
    }

    private void ThumbnailImageCreation_Paint(object sender, PaintEventArgs e)
    {
        e.Graphics.DrawImage(thumbnail, 1010);
    }
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new ThumbnailImageCreation());
    }
}
27.19.Draw Image
27.19.1.Resize a bitmap in drawingResize a bitmap in drawing
27.19.2.Thumbnail Image CreationThumbnail Image Creation
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.