|
楼主 |
发表于 2013-10-24 09:23:14
|
显示全部楼层
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace ControlLibraryUserTextBox
- {
- public partial class uTextBox :TextBox
- {
- public uTextBox()
- {
- InitializeComponent();
- this.button1.Location = ButtonPoint();
- this.Controls.Add(button1);
- }
- public uTextBox(IContainer container)
- {
- container.Add(this);
- InitializeComponent();
- this.button1.Location = ButtonPoint();
- this.Controls.Add(button1);
- }
- private Point ButtonPoint()
- {
- Point p = new Point();
- if (this.button1.Height != this.Height - 2)
- {
- this.button1.Height = this.Height - 2;
- }
- //X轴位置
- p.X = this.Width-button1.Width-4 ;
- // 获取Y轴位置
- p.Y = -1 ;
- return p;
- }
- }
- }
复制代码 |
|