.NET开发

本类阅读TOP10

·NHibernate快速指南(翻译)
·vs.net 2005中文版下载地址收藏
·【小技巧】一个判断session是否过期的小技巧
·VB/ASP 调用 SQL Server 的存储过程
·?dos下编译.net程序找不到csc.exe文件
·通过Web Services上传和下载文件
·学习笔记(补)《.NET框架程序设计(修订版)》--目录
·VB.NET实现DirectDraw9 (2) 动画
·VB.NET实现DirectDraw9 (1) 托管的DDraw
·建站框架规范书之——文件命名

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
轻松实现旋转显示文本

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

//本程序显示如何旋转显示文本,代码很简单,不过个人觉得做学习用还是不错的!
//作者: i.Posei(ipqn)
//欢迎访问 www.kunwsoft.com

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

namespace eddy
{
 public class Form1:System.Windows.Forms.Form
 {
  /// 必需的设计器变量。
  private System.ComponentModel.Container components = null;

  public Form1()
  {
   InitializeComponent();
  }

  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  private void InitializeComponent()
  {
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(520, 520);
   this.Name = "Form1";
   this.Text = "旋转显示文本";
   this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
  }

  [STAThread]
     static void Main()
  {
   Application.Run(new Form1());
  }
  private void Form1_Paint(object sender,System.Windows.Forms.PaintEventArgs e)
  {
   //声明并且初始化Graphics对象
   Graphics g=e.Graphics;
   g.SmoothingMode=SmoothingMode.AntiAlias;

   string str="C#学习笔记 kunwsoft.com";
   for(int i=0;i<360;i=i+10)
   {
    g.TranslateTransform(260,260);
    //将指定旋转应用于g的变换矩阵
    g.RotateTransform(i);

    Brush myBrush=Brushes.Red;
    Font drawFont = new Font("宋体", 12);
    g.DrawString(str,drawFont,myBrush,60,0);

    g.ResetTransform();
   }
  }
 }
}

下边是程序运行时的截图:




相关文章

相关软件