Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- namespace WinFormsExample
- {
- public partial class MyForm : Form
- {
- public MyForm()
- {
- this.InitializeComponent();
- }
- public void DrawVerticalString()
- {
- Graphics formGraphics = this.CreateGraphics();
- string drawString = this.Name; /* SET THE NAME HERE */
- Font drawFont = new Font("Arial", 16);
- SolidBrush drawBrush = new SolidBrush(System.Drawing.Color.Black);
- float x = 150.0F;
- float y = 50.0F;
- StringFormat drawFormat = new StringFormat();
- drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
- formGraphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
- drawFont.Dispose();
- drawBrush.Dispose();
- formGraphics.Dispose();
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- this.DrawVerticalString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement