六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 42|回复: 0

C# 实现文子从上到下,从右到左

[复制链接]

升级  94%

53

主题

53

主题

53

主题

秀才

Rank: 2

积分
191
 楼主| 发表于 2013-2-7 03:40:59 | 显示全部楼层 |阅读模式
C# 实现文子从上到下,从右到左
对OnPaint()方法的重写:
 
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace OverrideOnPaint{    public partial class Form1 : Form    {        protected override void OnPaint(PaintEventArgs e)        {            base.OnPaint(e);            Rectangle r = new Rectangle(new Point(40, 40), new Size(70, 70));            StringFormat f = new StringFormat(StringFormatFlags.DirectionRightToLeft | StringFormatFlags.DirectionVertical);            e.Graphics.DrawRectangle(Pens.Green, r);            e.Graphics.DrawString("祝大家国庆节快乐!", Font, Brushes.Blue, (RectangleF)r, f);        }               public Form1()        {            InitializeComponent();        }    }} 
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表