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

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();
        }
    }
}

 

你可能感兴趣的:(C++,c,windows,C#,LINQ)