public int Button(
            int formHandle,
            string caption,
            LuaFunction clickEvent,
            int?x      = null,
            int?y      = null,
            int?width  = null,
            int?height = null)
        {
            var form = GetForm(formHandle);

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

            var button = new LuaButton();

            SetText(button, caption);
            form.Controls.Add(button);
            form.ControlEvents.Add(new LuaWinform.LuaEvent(button.Handle, clickEvent));

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

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

            return((int)button.Handle);
        }
示例#2
0
        public int Button(
            int formHandle,
            string caption,
            LuaFunction clickEvent,
            int?x      = null,
            int?y      = null,
            int?width  = null,
            int?height = null)
        {
            var form = GetForm(formHandle);

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

            var button = new LuaButton();

            SetText(button, caption);
            button.BackColor = Color.White;
            button.AutoSize  = true;
            button.Font      = new Font(TextBox.DefaultFont, FontStyle.Bold);
            form.Controls.Add(button);
            form.ControlEvents.Add(new LuaWinform.LuaEvent(button.Handle, clickEvent));

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

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

            return((int)button.Handle);
        }
示例#3
0
		public int Button(
			int formHandle,
			string caption,
			LuaFunction clickEvent,
			int? x = null,
			int? y = null,
			int? width = null,
			int? height = null)
		{
			var form = GetForm(formHandle);
			if (form == null)
			{
				return 0;
			}

			var button = new LuaButton();
			SetText(button, caption);
			form.Controls.Add(button);
			form.ControlEvents.Add(new LuaWinform.LuaEvent(button.Handle, clickEvent));

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

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

			return (int)button.Handle;
		}