Пример #1
0
        public static void DeleteContext(ContextHandle context)
        {
            if (_contexts.ContainsKey(context.HDC))
            {
                _contexts.Remove(context.HDC);
            }

            if (context != ContextHandle.Zero)
            {
                Win32Helper.DeleteContext(context.Handle);
            }

            if (_contexts.Count == 0)
            {
                GLFunc.Dispose();
            }
        }
Пример #2
0
        protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (!_isDisposed)
            {
                switch ((WindowMessage)msg)
                {
                case WindowMessage.PAINT:
                    // Block background color updates
                    var paint = new PAINTSTRUCT(32);
                    Win32Helper.BeginPaint(Handle, ref paint);
                    Win32Helper.EndPaint(Handle, ref paint);

                    _Refresh();
                    break;
                }
            }
            return(base.WndProc(hwnd, msg, wParam, lParam, ref handled));
        }
Пример #3
0
 protected override void DestroyWindowCore(HandleRef hwnd)
 {
     Win32Helper.DestroyWindow(hwnd.Handle);
 }
Пример #4
0
 public static void MakeCurrentContext(ContextHandle context)
 {
     Win32Helper.MakeCurrent(context.HDC, context.Handle);//激活当前渲染上下文
     _current = context;
 }