Пример #1
0
        public static IntPtr CreatePropertySheetPage(ref PROPSHEETPAGE psp)
        {
            IntPtr hPage = ShellAPIWrapper.CreatePropertySheetPage_(ref psp);

            if (hPage == IntPtr.Zero)
            {
                throw new Exception("CreatePropertySheetPage failed");
            }
            return(hPage);
        }
Пример #2
0
        public PROPSHEETPAGE GetPSP(short cX, short cY)
        {
            psp = new PROPSHEETPAGE();

            psp.dwSize    = Marshal.SizeOf(typeof(PROPSHEETPAGE));
            psp.hInstance = IntPtr.Zero;
            psp.dwFlags   = PSP.DEFAULT | PSP.USECALLBACK | PSP.DLGINDIRECT;

            // We're using just a plain resource file as a "placeholder" for our
            // .NET Framework classes placed controls
            // Warning: this is NOT supported feature in Windows Forms,
            // The only supported unmanaged container for managed controls is IE
            psp.pResource = GetDialogTemplate(cX, cY);

            // Application defined data
            psp.lParam = IntPtr.Zero;

            // Set the property page's title and icon
            psp.pszTitle = title;

            if (SheetIcon.Icon != null)
            {
                psp.hIcon = SheetIcon.Icon.Handle;
            }
            else
            {
                psp.hIcon = IntPtr.Zero;
            }

            // Our delegate will be called when window message arrives
            psp.pfnDlgProc  = dlgProc;
            psp.pfnCallback = callback;

            // Set if our property page uses an icon or title
            if (psp.hIcon != IntPtr.Zero)
            {
                psp.dwFlags |= PSP.USEHICON;
            }
            if (psp.pszTitle != null)
            {
                psp.dwFlags |= PSP.USETITLE;
            }

            return(psp);
        }
Пример #3
0
        public PROPSHEETPAGE GetPSP(short cX, short cY)
        {
            psp = new PROPSHEETPAGE();

            psp.dwSize = Marshal.SizeOf(typeof(PROPSHEETPAGE));
            psp.hInstance = IntPtr.Zero;
            psp.dwFlags = PSP.DEFAULT | PSP.USECALLBACK | PSP.DLGINDIRECT;

            // We're using just a plain resource file as a "placeholder" for our
            // .NET Framework classes placed controls
            // Warning: this is NOT supported feature in Windows Forms,
            // The only supported unmanaged container for managed controls is IE
            psp.pResource = GetDialogTemplate(cX, cY);

            // Application defined data
            psp.lParam = IntPtr.Zero;

            // Set the property page's title and icon
            psp.pszTitle = title;

            if (SheetIcon.Icon != null) psp.hIcon = SheetIcon.Icon.Handle;
            else psp.hIcon = IntPtr.Zero;

            // Our delegate will be called when window message arrives
            psp.pfnDlgProc = dlgProc;
            psp.pfnCallback = callback;

            // Set if our property page uses an icon or title
            if (psp.hIcon != IntPtr.Zero) psp.dwFlags |= PSP.USEHICON;
            if (psp.pszTitle != null) psp.dwFlags |= PSP.USETITLE;

            return psp;
        }
Пример #4
0
 private static extern IntPtr CreatePropertySheetPage_(ref PROPSHEETPAGE psp);
Пример #5
0
 private static extern IntPtr CreatePropertySheetPage_(ref PROPSHEETPAGE psp);
Пример #6
0
 public static IntPtr CreatePropertySheetPage(ref PROPSHEETPAGE psp)
 {
     IntPtr hPage = ShellAPIWrapper.CreatePropertySheetPage_(ref psp);
     if (hPage == IntPtr.Zero) throw new Exception("CreatePropertySheetPage failed");
     return hPage;
 }