c#如何实现textbox中文本的下划线

来源:百度知道 编辑:UC知道 时间:2024/06/23 02:00:05
c#如何实现像word文档中,文字的下划线。不是简单的在界面上划个细线,而且由用户在上面打字后自动在文字的下面加上下划线。谢谢

继承自TextBox,写成扩展控件即可实现.
也可以用freetextbox控件,这是一个第三方控件,有很多功能

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<style type="text/css">
.dr
{ TEXT-DECORATION:underline;}

</style>
</head>
<body>
<form id="form1" runat="server" ondblclick="return form1_ondblclick()">
<div>
<asp:TextBox ID="TextBox1" CssClass="dr" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{