.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

Graphic GDI : Formatted Text Options · View
paedotnet
Posted: Saturday, March 08, 2008 9:43:53 PM

Rank: มือเทพ
Groups: Member

Joined: 12/6/2007
Posts: 354
Location: bkk
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;
using System.Drawing.Text;
namespace WindowsFormsApplication13
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            string str ="This class provides the set of standard root keys found in the registry on machines running Windows."+
            "The registry is a storage facility for information about applications, users, and default system settings. "+
            "For example, applications can use the registry for storing information that needs to be preserved once the"+
            "application is closed, and access that same information when the application is reloaded. For instance, you"+
            "can store color preferences, screen locations, or the size of the window. You can control this for each user "+
            "by storing the information in a different location in the registry.";
            Graphics g = e.Graphics;
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            Rectangle rect = new Rectangle(5, 5, this.ClientSize.Width - 10, this.ClientSize.Height);
            using (Font font = new Font("Arial", 25, FontStyle.Regular | FontStyle.Bold, GraphicsUnit.Pixel))
            {
                using (StringFormat format = new StringFormat())
                {
                    format.Alignment = StringAlignment.Center;
                    format.FormatFlags = StringFormatFlags.LineLimit;
                    format.Trimming = StringTrimming.EllipsisWord;
                    format.HotkeyPrefix = HotkeyPrefix.Show;
                    g.DrawString(str, font, Brushes.Red, rect, format);
                    g.DrawRectangle(Pens.Black, rect);
                }
            }
        }
    }
}

 



[With great power comes great responsibility]
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by