×

C#.NET 中的textbox不支持不支持onPaint事件

Kalet Kalet 发表于2009-03-20 12:00:14 浏览243 评论0

抢沙发发表评论

using System;
using System.Collections.Generic;
using System.Text;C#.NET 中的textbox不支持不支持onPaint事件
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;


namespace EInfoClient
{
    class RoyTextBox : System.Windows.Forms.TextBox
    {
        public RoyTextBox()
        {
        }


         protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            base.WndProc(ref m);
            const int WM_PAINT = 0xF;C#.NET 中的textbox不支持不支持onPaint事件
           
             //if (m.Msg == WM_PAINT && this.BorderStyle == System.Windows.Forms.BorderStyle.FixedSingle)
            if (m.Msg == WM_PAINT )
            {
                Graphics g = Graphics.FromHwnd(this.Handle);
               
                //g.DrawRectangle(Pens.Green, this.ClientRectangle.Left, this.ClientRectangle.Top, this.ClientRectangle.Width - 1, this.ClientRectangle.Height - 1);


                g.DrawLine(Pens.Green, 0, 0 , this.ClientRectangle.Width , 0);


                g.DrawLine(Pens.Green, 0, this.ClientRectangle.Height - 1, this.ClientRectangle.Width , this.ClientRectangle.Height - 1 );
                g.Dispose();
            }
        }
 
    }C#.NET 中的textbox不支持不支持onPaint事件
}



群贤毕至

访客