110,567
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace JcsControlLibrary
{
public partial class JcsLineTextBox : TextBox
{
public JcsLineTextBox()
{
InitializeComponent();
this.Width = 100;
this.BorderStyle = BorderStyle.None;
}
private Color _linecolor = Color.Black ;
/// <summary>
/// 线条颜色
/// </summary>
public Color LineColor
{
get
{
return this._linecolor;
}
set
{
this._linecolor = value;
this.Invalidate();
}
}
private const int WM_PAINT = 0xF;
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_PAINT)
{
DrawLine();
}
}
private void DrawLine()
{
Graphics g = this.CreateGraphics();
using(Pen p = new Pen(this._linecolor ))
{
g.DrawLine(p,0,this.Height -1 ,this.Width ,this.Height -1);
}
}
}
}
using System.Windows.Forms;
public class Test : Form
{
Test()
{
Label lbl = new Label();
lbl.Parent = this;
lbl.BorderStyle = BorderStyle.Fixed3D;
lbl.Anchor |= AnchorStyles.Right;
lbl.Top = 50;
lbl.Width = Width;
lbl.Height = 3;
}
static void Main()
{
Application.Run(new Test());
}
}
using System.Windows.Forms;
public class Test : Form
{
Test()
{
TextBox tbx = new TextBox();
tbx.Parent = this;
tbx.Multiline = true;
tbx.Top = 50;
tbx.Height = 1;
}
static void Main()
{
Application.Run(new Test());
}
}
using System.Windows.Forms;
class TextBox : System.Windows.Forms.TextBox
{
public TextBox()
{
Multiline = true;
Height = 1;
}
}
class Test : Form
{
Test()
{
TextBox tbx1 = new TextBox();
tbx1.Parent = this;
TextBox tbx2 = new TextBox();
tbx2.Parent = this;
tbx2.Top = 50;
TextBox tbx3 = new TextBox();
tbx3.Parent = this;
tbx3.Top = 50;
tbx3.Left = 150;
}
static void Main()
{
Application.Run(new Test());
}
}