示例#1
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();
        }
示例#2
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;
        }
示例#3
0
        public static ControlUI getControl(string typeName)
        {
            ControlUI newControl = null;
            int       len        = typeName.Length;

            switch (len)
            {
            case 4:
            {
                if (typeName == "Edit")
                {
                    newControl = new EditUI();
                }
                else if (typeName == "List")
                {
                    newControl = new ListUI();
                }
                else if (typeName == "Text")
                {
                    newControl = new TextUI();
                }

                break;
            }

            case 5:
            {
                if (typeName == "Combo")
                {
                    newControl = new ComboUI();
                }
                else if (typeName == "Label")
                {
                    newControl = new LabelUI();
                }
                break;
            }

            case 6:
            {
                if (typeName == "Button")
                {
                    newControl = new ButtonUI();
                }
                else if (typeName == "Option")
                {
                    newControl = new OptionUI();
                }
                else if (typeName == "Slider")
                {
                    newControl = new SliderUI();
                }

                break;
            }

            case 7:
            {
                if (typeName == "Control")
                {
                    newControl = new ControlUI();
                }
                else if (typeName == "ActiveX")
                {
                    newControl = new ActiveXUI();
                }
                break;
            }

            case 8:
            {
                if (typeName == "Progress")
                {
                    newControl = new ProgressUI();
                }
                break;
            }

            case 9:
            {
                if (typeName == "Container")
                {
                    newControl = new ContainerUI();
                }
                else if (typeName == "TabLayout")
                {
                    newControl = new TabLayoutUI();
                }

                break;
            }

            case 10:
            {
                if (typeName == "ListHeader")
                {
                    newControl = new ListHeaderUI();
                }
                else if (typeName == "TileLayout")
                {
                    newControl = new TileLayoutUI();
                }

                break;
            }

            case 12:
            {
                if (typeName == "DialogLayout")
                {
                    newControl = new DialogLayoutUI();
                }
                break;
            }

            case 14:
            {
                if (typeName == "VerticalLayout")
                {
                    newControl = new VerticalLayoutUI();
                }
                else if (typeName == "ListHeaderItem")
                {
                    newControl = new ListHeaderItemUI();
                }

                break;
            }

            case 15:
            {
                if (typeName == "ListTextElement")
                {
                    newControl = new ListTextElementUI();
                }
                break;
            }

            case 16:
            {
                if (typeName == "HorizontalLayout")
                {
                    newControl = new HorizontalLayoutUI();
                }
                else if (typeName == "ListLabelElement")
                {
                    newControl = new ListLabelElementUI();
                }

                break;
            }

            case 17:
            {
                if (typeName == "ListExpandElement")
                {
                    newControl = new ListExpandElementUI();
                }
                break;
            }

            case 20:
            {
                if (typeName == "ListContainerElement")
                {
                    newControl = new ListContainerElementUI();
                }
                break;
            }
            }

            return(newControl);
        }