using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; namespace WindowsFormsApplication1 { [ToolboxItem(true)] public partial class TextBoxLine : TextBox { public TextBoxLine() { InitializeComponent(); this.SetStyle(ControlStyles.DoubleBuffer, true); this.BorderStyle = BorderStyle.None; } public TextBoxLine(IContainer container) { container.Add(this); InitializeComponent(); this.SetStyle(ControlStyles.DoubleBuffer, true); this.BorderStyle = BorderStyle.None; } private bool m_DrawLine = false; public bool DrawLine { get { return this.m_DrawLine; } set { this.m_DrawLine = value; this.Invalidate(); } } private Color _linecolor = Color.Black; ////// 線條顏色 /// public Color LineColor { get { return this._linecolor; } set { this._linecolor = value; this.Invalidate(); } } [System.Runtime.InteropServices.DllImport("user32.dll ")] static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); [System.Runtime.InteropServices.DllImport("user32.dll ")] static extern IntPtr GetWindowDC(IntPtr hWnd); protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == 0xf || m.Msg == 0x133) { if (this.DrawLine) { IntPtr hDC = GetWindowDC(m.HWnd); if (hDC.ToInt32() == 0) { return; } Graphics g = Graphics.FromHdc(hDC); Pen p = new Pen(this._linecolor, 1); Point p1 = new Point(0, this.Height - 1); Point p2 = new Point(this.Width, Height - 1); g.DrawLine(p, p1, p2); m.Result = IntPtr.Zero; ReleaseDC(m.HWnd, hDC); } } } } }
原文地址:http://blog.csdn.net/geovi/article/details/7399406
在網(wǎng)站制作、網(wǎng)站建設(shè)中從網(wǎng)站色彩、結(jié)構(gòu)布局、欄目設(shè)置、關(guān)鍵詞群組等細(xì)微處著手,突出企業(yè)的產(chǎn)品/服務(wù)/品牌,幫助企業(yè)鎖定精準(zhǔn)用戶,提高在線咨詢和轉(zhuǎn)化,使成都網(wǎng)站營(yíng)銷(xiāo)成為有效果、有回報(bào)的無(wú)錫營(yíng)銷(xiāo)推廣。創(chuàng)新互聯(lián)公司專業(yè)成都網(wǎng)站建設(shè)十年了,客戶滿意度97.8%,歡迎成都創(chuàng)新互聯(lián)客戶聯(lián)系。另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。