Exemple #1
0
        /// <summary>Create instance of the Win32 API dialog template</summary>
        /// <param name="templateOld">Defines the dimensions and style of a dialog box.</param>
        public DialogTemplate(WinUser.DLGTEMPLATE templateOld)
        {
            this.Styles   = templateOld.style;
            this.StylesEx = templateOld.dwExtendedStyle;
            this.X        = templateOld.x;
            this.Y        = templateOld.y;
            this.CX       = templateOld.cx;
            this.CY       = templateOld.cy;

            this.Controls = new DialogItemTemplate[templateOld.cdit];
        }
Exemple #2
0
        /// <summary>Win32 API dialog generic resource control template</summary>
        /// <param name="control">Defines the dimensions and style of a control in a dialog box.</param>
        /// <param name="controlEx">A block of text used by an extended dialog box template to describe the extended dialog box.</param>
        /// <param name="itemClass">Type of dialog item template (predefined control or COM control)</param>
        /// <param name="itemText">Item title text</param>
        /// <param name="extraData">Control item extended data</param>
        public DialogItemTemplate(WinUser.DLGITEMTEMPLATE?control, WinUser.DLGITEMTEMPLATEEX?controlEx, ResourceBase.SzInt itemClass, ResourceBase.SzInt itemText, Byte[] extraData)
        {
            if (control == null && controlEx == null)
            {
                throw new ArgumentNullException("control or controlEx must be not null");
            }

            if (control != null)
            {
                this.Styles    = control.Value.style;
                this.StylesEx  = control.Value.dwExtendedStyle;
                this.X         = control.Value.x;
                this.Y         = control.Value.y;
                this.CX        = control.Value.cx;
                this.CY        = control.Value.cy;
                this.ControlID = control.Value.id;
            }

            if (controlEx != null)
            {
                this.HelpID    = controlEx.Value.helpID;
                this.Styles    = controlEx.Value.style;
                this.StylesEx  = controlEx.Value.exStyle;
                this.X         = controlEx.Value.x;
                this.Y         = controlEx.Value.y;
                this.CX        = controlEx.Value.cx;
                this.CY        = controlEx.Value.cy;
                this.ControlID = controlEx.Value.id;
            }

            if (!itemClass.IsEmpty)
            {
                switch (itemClass.Type)
                {
                case ResourceBase.SzInt.SzIntResult.Index:
                    this.ItemSystemClass = (DialogItemTemplate.ControlSystemClass)itemClass.Index;
                    break;

                case ResourceBase.SzInt.SzIntResult.Name:
                    this.ItemClass = itemClass.Name;
                    break;

                default:
                    throw new NotSupportedException();
                }
            }

            if (!itemText.IsEmpty)
            {
                this.ItemText = itemText;
            }
            this.ExtraData = extraData;
        }
Exemple #3
0
        /// <summary>Create instance of the Win32 API dialog template</summary>
        /// <param name="template">An extended dialog box template begins with a DLGTEMPLATEEX header that describes the dialog box and specifies the number of controls in the dialog box.</param>
        public DialogTemplate(WinUser.DLGTEMPLATEEX template)
        {
            this.Version   = template.dlgVer;
            this.Signature = template.signature;
            this.helpID    = template.helpID;
            this.Styles    = template.style;
            this.StylesEx  = template.exStyle;
            this.X         = template.x;
            this.Y         = template.y;
            this.CX        = template.cx;
            this.CY        = template.cy;

            this.Controls = new DialogItemTemplate[template.cDlgItems];
        }