Picture Cube: DrawImage : Graphics « 2D Graphics « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » 2D Graphics » GraphicsScreenshots 
Picture Cube: DrawImage
 

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class Form1 : System.Windows.Forms.Form {
    [STAThread]
    static void Main() {
        Application.Run(new Form1());
    }
    protected override void OnPaint(PaintEventArgs pea) {
        CubeDBuf();
    }
    private void CubeDBuf() {
        Graphics g;

        string path;
        int x = 100, y = 40;
        Point A = new Point(1050);
        Point B = new Point(18050);
        Point C = new Point(10170);

        Point a = new Point(A.X + x, A.Y - y);
        Point b = new Point(B.X + x, B.Y - y);
        Point Z = new Point(B.X, C.Y);

        Point[] p3Fro = A, B, C };
        Point[] p3Top = a, b, A };
        Point[] p3Rig = B, b, Z };

        Bitmap bm = new Bitmap(B.X + x, C.Y + y);
        g = Graphics.FromImage(bm);

        path = "A.bmp";
        Image im1 = Image.FromFile(path);
        g.DrawImage(im1, p3Fro);

        path = "B.BMP";
        Image im3 = Image.FromFile(path);
        g.DrawImage(im3, p3Top);

        path = "C.bmp";
        Image im2 = Image.FromFile(path);
        g.DrawImage(im2, p3Rig);

        g = Graphics.FromHwnd(this.Handle);
        g.DrawImage(bm, 11);

        g.Dispose();
    }
}

 
Related examples in the same category
1.Graphics: TranslateClip
2.Graphics: SetClip
3.Scribble with MouseScribble with Mouse
4.FillPolygon: Alternate and Winding Fill Modes
5.One-Inch Ellipse
6.Graphics: FillRectangles
7.Graphics: FillRectangle
8.Graphics: FillEllipse
9.Wide Polyline: DrawLines
10.Line and Arc Combo
11.Graphics: FillClosedCurve
12.Bezier Art: DrawBeziers
13.Graphics: MeasureString
14.Clear a Graphics
15.Graphics: DrawRectangles
16.Graphics: DrawRectangle
17.Draw Ellipse
18.Graphics: DrawArc
19.Graphics: DrawPie
20.Draw a Rectangle
21.Draw an Image
22.FillEllipse: Red Traffic Light
23.Graphics: Draw an Icon
24.Graphics: DrawString
25.Use different Font object to draw a line of text
26.Graphics: ScaleTransform
27.Graphics: Transform
28.Graphics: TranslateTransform
29.Graphics: Pen Alignment
30.Graphics: PageScale
31.Graphics: PageUnit
32.DpiY and DpiX
33.PixelOffsetMode
34.Paint along points in a list pointsPaint along points in a list points
35.Clipping: ResetClip
36.Rotate the text 45 degrees clockwise then Translate the text 150 pixels horizontally
37.Transform and RotateTransform in a loop
38.Apply the scaling transformation(scale subsequent operations by 2x horizontally and 3x vertically)
39.Translate the text 150 pixels horizontally and 75 vertically
40.Reset the transformation Translate by 30 pixels in vertical direction
41.Rotate the text through 45 degrees
42.Fill the area 'bounded' by the path
43.DrawImage with destination points
44.DrawImage with size
45.Graphics.SmoothingMode
46.DrawPie with offset
47.TransformPoints
48.Fill a Rectangle with TextureBrush
49.Fill a Rectangle with LinearGradientBrush
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.