| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Client.Public
- {
- public partial class F_SYS_0104 : Form
- {
- private const int WS_EX_TOOLWINDOW = 0x00000080;
- private const int WS_EX_NOACTIVATE = 0x08000000;
- protected override CreateParams CreateParams
- {
- get
- {
- CreateParams cp = base.CreateParams;
- cp.ExStyle |= (WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW);
- cp.Parent = IntPtr.Zero; // Keep this line only if you used UserControl
- return cp;
- //return base.CreateParams;
- }
- }
- private TextBox _textbox = null;
- public F_SYS_0104()
- {
- InitializeComponent();
- }
- public void SetLocation(TextBox textbox)
- {
- this._textbox = textbox;
- Point p = this.GetLocation(textbox);
- p.Offset(12, textbox.Height + 12);
- this.Location = p;
- }
- private void btnClose_Click(object sender, EventArgs e)
- {
- Button b = sender as Button;
- if(b == null)
- {
- return ;
- }
- string text = this._textbox.Text;
- switch (b.Text)
- {
- case "关闭":
- this.Close();
- break;
- case "<-":
- System.Windows.Forms.SendKeys.Send("{BACKSPACE}");
- break;
- case "Delete":
- System.Windows.Forms.SendKeys.Send("{DELETE}");
- break;
- default:
- System.Windows.Forms.SendKeys.Send(b.Text);
- break;
- }
- }
- private Point GetLocation(Control c)
- {
- if (c.Parent == null)
- {
- return c.Location;
- }
- if (c.Parent is Form)
- {
- Point p = c.Parent.Location;
- p.Offset(c.Location);
- return p;
- }
- Point pc = this.GetLocation(c.Parent);
- pc.Offset(c.Location);
- return pc;
- }
- }
- }
|