Ejemplo n.º 1
0
        public void init(EditUI pOwner)
        {
            if (pOwner == null)
            {
                throw new Exception("父控件不能为空");
            }
            Rectangle rcPos   = pOwner.getPos();
            Rectangle rcInset = pOwner.getTextPadding();

            rcPos.X     += rcInset.X;
            rcPos.Y     += rcInset.Y;
            rcPos.Width  = rcPos.Right - rcInset.Right - rcPos.X;
            rcPos.Height = rcPos.Bottom - rcInset.Bottom - rcPos.Y;

            this.Size     = new Size(rcPos.Width, rcPos.Height);
            this.Location = new Point(rcPos.Left, rcPos.Top);
            this.Font     = pOwner.getManager().getDefaultFont();
            pOwner.getManager().getPaintWindow().Controls.Add(this);
            mOwner = pOwner;

            this.MaxLength = pOwner.getMaxChar();
            if (pOwner.isPasswordMode())
            {
                this.PasswordChar = pOwner.getPasswordChar();
            }
            this.Text = pOwner.getText();

            this.Focus();
            this.SelectionStart = this.Text.Length;
        }
Ejemplo n.º 2
0
        public void init(EditUI pOwner)
        {
            Rectangle rcPos   = pOwner.getPos();
            Rectangle rcInset = pOwner.getTextPadding();

            rcPos.X     += rcInset.X;
            rcPos.Y     += rcInset.Y;
            rcPos.Width  = rcPos.Right - rcInset.Right - rcPos.X;
            rcPos.Height = rcPos.Bottom - rcInset.Bottom - rcPos.Y;

            this.Size     = new Size(rcPos.Width, rcPos.Height);
            this.Location = new Point(rcPos.Left, rcPos.Top);
            this.Font     = pOwner.getManager().getDefaultFont();
            if (pOwner.getBackColor() != null && pOwner.getBackColor().A != 0)
            {
                this.BackColor = pOwner.getBackColor();
            }
            if (pOwner.getTextColor() != null && pOwner.getTextColor().A != 0)
            {
                this.ForeColor = pOwner.getTextColor();
            }
            pOwner.getManager().getPaintWindow().Controls.Add(this);
            mOwner = pOwner;

            this.MaxLength = pOwner.getMaxChar();
            if (pOwner.isPasswordMode())
            {
                this.PasswordChar = pOwner.getPasswordChar();
            }
            this.Text = pOwner.getText();

            this.Focus();
            this.SelectionStart = this.Text.Length;
            this.SelectAll();
        }