CSharpGL.WNDCLASSEX.Init C# (CSharp) Method

Init() public method

public Init ( ) : void
return void
        public void Init()
        {
            cbSize = (uint)Marshal.SizeOf(this);
        }
    }

Usage Example

        /// <summary>
        /// Create a new window class, as basic as possible.
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="bitDepth"></param>
        /// <returns></returns>
        private bool CreateBasicRenderContext(int width, int height, int bitDepth)
        {
            var wndClass = new WNDCLASSEX();

            wndClass.Init();
            wndClass.style         = ClassStyles.HorizontalRedraw | ClassStyles.VerticalRedraw | ClassStyles.OwnDC;
            wndClass.lpfnWndProc   = wndProcDelegate;
            wndClass.cbClsExtra    = 0;
            wndClass.cbWndExtra    = 0;
            wndClass.hInstance     = IntPtr.Zero;
            wndClass.hIcon         = IntPtr.Zero;
            wndClass.hCursor       = IntPtr.Zero;
            wndClass.hbrBackground = IntPtr.Zero;
            wndClass.lpszMenuName  = null;
            wndClass.lpszClassName = "CSharpGLRenderWindow";
            wndClass.hIconSm       = IntPtr.Zero;
            Win32.RegisterClassEx(ref wndClass);

            //	Create the window. Position and size it.
            windowHandle = Win32.CreateWindowEx(0,
                                                "CSharpGLRenderWindow",
                                                "",
                                                WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_POPUP,
                                                0, 0, width, height,
                                                IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);

            //	Get the window device context.
            this.DeviceContextHandle = Win32.GetDC(windowHandle);

            //	Setup a pixel format.
            var pfd = new PixelFormatDescriptor();

            pfd.Init();
            pfd.nVersion     = 1;
            pfd.dwFlags      = Win32.PFD_DRAW_TO_WINDOW | Win32.PFD_SUPPORT_OPENGL | Win32.PFD_DOUBLEBUFFER;
            pfd.iPixelType   = Win32.PFD_TYPE_RGBA;
            pfd.cColorBits   = (byte)bitDepth;
            pfd.cDepthBits   = 16;
            pfd.cStencilBits = 8;
            pfd.iLayerType   = Win32.PFD_MAIN_PLANE;

            //	Match an appropriate pixel format
            int iPixelformat = Win32.ChoosePixelFormat(this.DeviceContextHandle, pfd);

            if (iPixelformat == 0)
            {
                return(false);
            }

            //	Sets the pixel format
            if (Win32.SetPixelFormat(this.DeviceContextHandle, iPixelformat, pfd) == 0)
            {
                return(false);
            }

            return(true);
        }
All Usage Examples Of CSharpGL.WNDCLASSEX::Init
WNDCLASSEX