Rotate Transform and Translate Transform : Rotate : Graphics C# Source Code


Custom Search

C# Source Code » Graphics » Rotate »

 

Rotate Transform and Translate Transform









    


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using System.Drawing.Drawing2D;
using System.Drawing.Text;

public class Form1 : Form
{
      public Form1() {
            InitializeComponent();
      }
    private void SimpleStyleRenderer_Paint(object sender, PaintEventArgs e)
    {
      e.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;

      e.Graphics.TranslateTransform(this.Width / 2 - 100, this.Height / 2 - 100);

      DrawText(e.Graphics);
      e.Graphics.RotateTransform(45);
      DrawText(e.Graphics);
      e.Graphics.RotateTransform(75);
      DrawText(e.Graphics);
      e.Graphics.RotateTransform(160);
      DrawText(e.Graphics);
    }

    private void DrawText(Graphics g)
    {
      g.DrawString("www.navioo.com", new Font("Verdana", 30, FontStyle.Bold),
        Brushes.Black, 0, 0); 
    }

    private void InitializeComponent()
    {
      this.SuspendLayout();

      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(600, 600);
      this.Name = "SimpleStyleRenderer";
      this.Text = "SimpleStyleRenderer";
      this.Paint += new System.Windows.Forms.PaintEventHandler(this.SimpleStyleRenderer_Paint);
      this.ResumeLayout(false);

    }
      [STAThread]
      static void Main()
      {
        Application.EnableVisualStyles();
        Application.Run(new Form1());
      }
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Graphics
» Rotate