Exemple #1
0
        /// <summary>
        ///     Read the dialog resource.
        /// </summary>
        /// <param name="lpRes">Pointer to the beginning of the dialog structure.</param>
        internal override IntPtr Read(IntPtr lpRes)
        {
            _header = (Api.Structures.DialogExTemplate)Marshal.PtrToStructure(lpRes, typeof(Api.Structures.DialogExTemplate));

            lpRes = base.Read(new IntPtr(lpRes.ToInt32() + 26)); // Marshal.SizeOf(_header)

            if ((Style & (uint)DialogStyles.DS_SETFONT) > 0 || (Style & (uint)DialogStyles.DS_SHELLFONT) > 0)
            {
                // weight
                Weight = (UInt16)Marshal.ReadInt16(lpRes);
                lpRes  = new IntPtr(lpRes.ToInt32() + 2);
                // italic
                Italic = (Marshal.ReadByte(lpRes) > 0);
                lpRes  = new IntPtr(lpRes.ToInt32() + 1);
                // character set
                CharacterSet = Marshal.ReadByte(lpRes);
                lpRes        = new IntPtr(lpRes.ToInt32() + 1);
                // typeface
                TypeFace = Marshal.PtrToStringUni(lpRes);
                lpRes    = new IntPtr(lpRes.ToInt32() + (TypeFace.Length + 1) * Marshal.SystemDefaultCharSize);
            }

            return(ReadControls(lpRes));
        }
        /// <summary>
        ///     Read the dialog resource.
        /// </summary>
        /// <param name="lpRes">Pointer to the beginning of the dialog structure.</param>
        internal override IntPtr Read(IntPtr lpRes) {
            _header = (Api.Structures.DialogExTemplate)Marshal.PtrToStructure(lpRes, typeof (Api.Structures.DialogExTemplate));

            lpRes = base.Read(new IntPtr(lpRes.ToInt32() + 26)); // Marshal.SizeOf(_header)

            if ((Style & (uint)DialogStyles.DS_SETFONT) > 0 || (Style & (uint)DialogStyles.DS_SHELLFONT) > 0) {
                // weight
                Weight = (UInt16)Marshal.ReadInt16(lpRes);
                lpRes = new IntPtr(lpRes.ToInt32() + 2);
                // italic
                Italic = (Marshal.ReadByte(lpRes) > 0);
                lpRes = new IntPtr(lpRes.ToInt32() + 1);
                // character set
                CharacterSet = Marshal.ReadByte(lpRes);
                lpRes = new IntPtr(lpRes.ToInt32() + 1);
                // typeface
                TypeFace = Marshal.PtrToStringUni(lpRes);
                lpRes = new IntPtr(lpRes.ToInt32() + (TypeFace.Length + 1)*Marshal.SystemDefaultCharSize);
            }

            return ReadControls(lpRes);
        }