Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CheckBox"/> class with the specified text.
        /// </summary>
        /// <param name="text">The text specified by the <see cref="CheckBox"/>.</param>
        public CheckBox(string text)
        {
            IntPtr strPtr = LibuiConvert.ToLibuiString(text);

            Handle = new SafeControlHandle(LibuiLibrary.uiNewCheckbox(strPtr));
            Marshal.FreeHGlobal(strPtr);
            this.text = text;
            InitializeEvents();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Window"/> class, with the options of specifying
        /// the window's width, height, title, and whether or not it has a <see cref="MenuStrip"/>.
        /// </summary>
        /// <param name="width">The width of the window.</param>
        /// <param name="height">The height of the window.</param>
        /// <param name="title">The title at the top of the window.</param>
        /// <param name="hasMenuStrip">Whether or not the window will have a menu.</param>
        public Window(int width = 500, int height = 300, string title = null, bool hasMenuStrip = false) : base()
        {
            if (string.IsNullOrEmpty(title))
            {
                title = "LibUISharp";
            }

            IntPtr strPtr = LibuiConvert.ToLibuiString(title);

            Handle = new SafeControlHandle(LibuiLibrary.uiNewWindow(strPtr, width, height, hasMenuStrip));
            Marshal.FreeHGlobal(strPtr);

            WindowCache.Add(Handle, this);
            this.title = title;
            size       = new Size(width, height);
            InitializeEvents();
        }