Exemplo n.º 1
0
		public int Textbox(
			int formHandle,
			string caption = null,
			int? width = null,
			int? height = null,
			string boxtype = null,
			int? x = null,
			int? y = null,
			bool multiline = false,
			bool fixedWidth = false)
		{
			var form = GetForm(formHandle);
			if (form == null)
			{
				return 0;
			}

			var textbox = new LuaTextBox();
			if (fixedWidth)
			{
				textbox.Font = new Font("Courier New", 8);
			}

			textbox.Multiline = multiline;
			SetText(textbox, caption);

			if (x.HasValue && y.HasValue)
			{
				SetLocation(textbox, x.Value, y.Value);
			}

			if (width.HasValue && height.HasValue)
			{
				SetSize(textbox, width.Value, height.Value);
			}

			if (boxtype != null)
			{
				switch (boxtype.ToUpper())
				{
					case "HEX":
					case "HEXADECIMAL":
						textbox.SetType(BoxType.Hex);
						break;
					case "UNSIGNED":
					case "UINT":
						textbox.SetType(BoxType.Unsigned);
						break;
					case "NUMBER":
					case "NUM":
					case "SIGNED":
					case "INT":
						textbox.SetType(BoxType.Signed);
						break;
				}
			}

			form.Controls.Add(textbox);
			return (int)textbox.Handle;
		}
        public int Textbox(
            int formHandle,
            string caption    = null,
            int?width         = null,
            int?height        = null,
            string boxtype    = null,
            int?x             = null,
            int?y             = null,
            bool multiline    = false,
            bool fixedWidth   = false,
            string scrollbars = null)
        {
            var form = GetForm(formHandle);

            if (form == null)
            {
                return(0);
            }

            var textbox = new LuaTextBox();

            if (fixedWidth)
            {
                textbox.Font = new Font("Courier New", 8);
            }

            textbox.Multiline = multiline;
            if (scrollbars != null)
            {
                switch (scrollbars.ToUpper())
                {
                case "VERTICAL":
                    textbox.ScrollBars = ScrollBars.Vertical;
                    break;

                case "HORIZONTAL":
                    textbox.ScrollBars = ScrollBars.Horizontal;
                    textbox.WordWrap   = false;
                    break;

                case "BOTH":
                    textbox.ScrollBars = ScrollBars.Both;
                    textbox.WordWrap   = false;
                    break;

                case "NONE":
                    textbox.ScrollBars = ScrollBars.None;
                    break;
                }
            }
            SetText(textbox, caption);

            if (x.HasValue && y.HasValue)
            {
                SetLocation(textbox, x.Value, y.Value);
            }

            if (width.HasValue && height.HasValue)
            {
                SetSize(textbox, width.Value, height.Value);
            }

            if (boxtype != null)
            {
                switch (boxtype.ToUpper())
                {
                case "HEX":
                case "HEXADECIMAL":
                    textbox.SetType(BoxType.Hex);
                    break;

                case "UNSIGNED":
                case "UINT":
                    textbox.SetType(BoxType.Unsigned);
                    break;

                case "NUMBER":
                case "NUM":
                case "SIGNED":
                case "INT":
                    textbox.SetType(BoxType.Signed);
                    break;
                }
            }

            form.Controls.Add(textbox);
            return((int)textbox.Handle);
        }