Пример #1
0
        void SetBufferRect(CarbonWindowInfo carbonWindow)
        {
            if (carbonWindow.IsControl == false)
            {
                return;
            }
            System.Windows.Forms.Control ctrl = Control.FromHandle(carbonWindow.WindowRef);
            if (ctrl.TopLevelControl == null)
            {
                return;
            }
            Rect rect = API.GetControlBounds(carbonWindow.WindowRef);

            System.Windows.Forms.Form frm = (System.Windows.Forms.Form)ctrl.TopLevelControl;
            System.Drawing.Point      loc =
                frm.PointToClient(ctrl.PointToScreen(System.Drawing.Point.Empty));
            rect.X = (short)loc.X;
            rect.Y = (short)loc.Y;
            Debug.Print("Setting buffer_rect for control.");
            Debug.Print("MacOS Coordinate Rect:   {0}", rect);
            rect.Y = (short)(ctrl.TopLevelControl.ClientSize.Height - rect.Y - rect.Height);
            Debug.Print("  AGL Coordinate Rect:   {0}", rect);
            int[] glrect = new int[4];
            glrect[0] = rect.X;
            glrect[1] = rect.Y;
            glrect[2] = rect.Width;
            glrect[3] = rect.Height;
            Agl.aglSetInteger(Handle.Handle, Agl.ParameterNames.AGL_BUFFER_RECT, glrect);
            MyAGLReportError("aglSetInteger");
            Agl.aglEnable(Handle.Handle, Agl.ParameterNames.AGL_BUFFER_RECT);
            MyAGLReportError("aglEnable");
        }