using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TomWinform.CustomerControl
{
public partial class BorderTextBox : TextBox
{
//设置Rect消息
private const int EM_SETRECT = 179;
//获取Rect消息
private const int EM_GETRECT = 178;
//粘贴消息
private const int WM_PASTE = 0x0302;
private Color borderColor = Color.Black;
private float leftBorderSize = 1;
private float rightBorderSize = 1;
private float topBorderSize = 1;
private float bottomBorderSize = 1;
private Padding textPadding = new Padding(1);
private bool allowReturn = false;
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern IntPtr GetWindowDC(IntPtr hWnd);
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessageA")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, string lParam);
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessageA")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, ref Rectangle lParam);
public BorderTextBox()
{
InitializeComponent();
}
//画边框
priva
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TomWinform.CustomerControl
{
public partial class BorderTextBox : TextBox
{
//设置Rect消息
private const int EM_SETRECT = 179;
//获取Rect消息
private const int EM_GETRECT = 178;
//粘贴消息
private const int WM_PASTE = 0x0302;
private Color borderColor = Color.Black;
private float leftBorderSize = 1;
private float rightBorderSize = 1;
private float topBorderSize = 1;
private float bottomBorderSize = 1;
private Padding textPadding = new Padding(1);
private bool allowReturn = false;
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern IntPtr GetWindowDC(IntPtr hWnd);
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessageA")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, string lParam);
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessageA")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, ref Rectangle lParam);
public BorderTextBox()
{
InitializeComponent();
}
//画边框
priva