1
0
mirror of https://github.com/zhaopeiym/IoTClient synced 2025-10-26 22:15:44 +08:00
IoTClient/IoTClient.Tool/Controls/TextBoxEx.cs
BennyZhao dc25c41dac 1、SiemensClient 批量数据写
2、MQTT操作demo
3、手动更新
2020-09-11 15:41:04 +08:00

25 lines
691 B
C#

using System.Drawing;
using System.Windows.Forms;
namespace IoTClient.Tool.Controls
{
public class TextBoxEx : TextBox
{
public string PlaceHolder { get; set; }
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == 0xF || m.Msg == 0x133)
{
WmPaint(ref m);
}
}
private void WmPaint(ref Message m)
{
Graphics g = Graphics.FromHwnd(Handle);
if (!string.IsNullOrEmpty(PlaceHolder) && string.IsNullOrEmpty(Text))
g.DrawString(PlaceHolder, Font, new SolidBrush(Color.LightGray), 2, 2);
}
}
}