Ejemplo n.º 1
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            OpenGLWinFormsControl contextTester = new OpenGLWinFormsControl();

            try {
                if (contextTester.TaoInitializeContexts(selectedFormatNum) != selectedFormatNum)
                {
                    throw new Exception(Lan.g(this, "Could not initialize pixel format ") + selectedFormatNum.ToString() + ".");
                }
            }
            catch (Exception ex) {
                MessageBox.Show(Lan.g(this, "Please choose a different pixel format, the selected pixel format will not support the 3D tooth chart on this computer: " + ex.Message));
                contextTester.Dispose();
                return;
            }
            contextTester.Dispose();
            ComputerPref computerPref = ComputerPrefs.GetForLocalComputer();

            computerPref.GraphicsUseHardware     = checkHardwareAccel.Checked;
            computerPref.GraphicsSimple          = radioSimpleChart.Checked;
            computerPref.GraphicsDoubleBuffering = checkDoubleBuffering.Checked;
            computerPref.PreferredPixelFormatNum = selectedFormatNum;
            ComputerPrefs.Update(computerPref);
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 2
0
        ///<Summary>Get all formats for the grid based on the current filters.</Summary>
        private void RefreshFormats()
        {
            this.Cursor = Cursors.WaitCursor;
            OpenGLWinFormsControl contextFinder = new OpenGLWinFormsControl();

            //Get raw formats.
            Gdi.PIXELFORMATDESCRIPTOR[] rawformats = OpenGLWinFormsControl.GetPixelFormats(contextFinder.GetHDC());
            if (checkAllFormats.Checked)
            {
                formats = new OpenGLWinFormsControl.PixelFormatValue[rawformats.Length];
                for (int i = 0; i < rawformats.Length; i++)
                {
                    formats[i] = new OpenGLWinFormsControl.PixelFormatValue();
                    formats[i].formatNumber = i + 1;
                    formats[i].pfd          = rawformats[i];
                }
            }
            else
            {
                //Prioritize formats as requested by the user.
                formats = OpenGLWinFormsControl.PrioritizePixelFormats(rawformats, checkDoubleBuffering.Checked, checkHardwareAccel.Checked);
            }
            contextFinder.Dispose();
            //Update the format grid to reflect possible changes in formats.
            FillGrid();
            this.Cursor = Cursors.Default;
        }
Ejemplo n.º 3
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            //ComputerPrefCur doesn't change until here, so make the old copy exactly when we need it instead of when the form is created.
            ComputerPref computerPrefOld = ComputerPrefCur.Copy();

            //ComputerPref computerPref=ComputerPrefs.GetForLocalComputer();
            if (radioDirectXChart.Checked)
            {
                if (!_isRemoteEdit && !TestDirectXFormat(this, selectedDirectXFormat))
                {
                    MessageBox.Show(Lan.g(this, "Please choose a different device format, " +
                                          "the selected device format will not support the DirectX 3D tooth chart on this computer"));
                    return;
                }
                ComputerPrefCur.GraphicsSimple = DrawingMode.DirectX;
                ComputerPrefCur.DirectXFormat  = selectedDirectXFormat;
            }
            else if (radioSimpleChart.Checked)
            {
                ComputerPrefCur.GraphicsSimple = DrawingMode.Simple2D;
            }
            else               //OpenGL
            {
                OpenGLWinFormsControl contextTester = new OpenGLWinFormsControl();
                try {
                    if (!_isRemoteEdit && contextTester.TaoInitializeContexts(selectedFormatNum) != selectedFormatNum)
                    {
                        throw new Exception(Lan.g(this, "Could not initialize pixel format ") + selectedFormatNum.ToString() + ".");
                    }
                }
                catch (Exception ex) {
                    MessageBox.Show(Lan.g(this, "Please choose a different pixel format, the selected pixel format will not support the 3D tooth chart on this computer: " + ex.Message));
                    contextTester.Dispose();
                    return;
                }
                contextTester.Dispose();
                ComputerPrefCur.GraphicsUseHardware     = checkHardwareAccel.Checked;
                ComputerPrefCur.GraphicsDoubleBuffering = checkDoubleBuffering.Checked;
                ComputerPrefCur.PreferredPixelFormatNum = selectedFormatNum;
                ComputerPrefCur.GraphicsSimple          = DrawingMode.OpenGL;
            }
            ComputerPrefs.Update(ComputerPrefCur, computerPrefOld);
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 4
0
        private void radio3DChart_Click(object sender, EventArgs e)
        {
            group3DToothChart.Enabled = true;
            //pick the best pixel format, completely ignoring the filters.
            OpenGLWinFormsControl autoFormat = new OpenGLWinFormsControl();

            OpenGLWinFormsControl.PixelFormatValue pfv = OpenGLWinFormsControl.ChoosePixelFormatEx(autoFormat.GetHDC());
            autoFormat.Dispose();
            selectedFormatNum = pfv.formatNumber;
            textSelected.Text = selectedFormatNum.ToString();
            RefreshFormats();
        }
Ejemplo n.º 5
0
 ///<Summary>Get all formats for the grid based on the current filters.</Summary>
 private void RefreshFormats()
 {
     this.Cursor = Cursors.WaitCursor;
     gridFormats.Rows.Clear();
     gridFormats.Invalidate();
     textSelected.Text = "";
     Application.DoEvents();
     if (this.radioDirectXChart.Checked)
     {
         xformats = ToothChartDirectX.GetStandardDeviceFormats();
     }
     else if (this.radioOpenGLChart.Checked)
     {
         OpenGLWinFormsControl contextFinder = new OpenGLWinFormsControl();
         //Get raw formats.
         Gdi.PIXELFORMATDESCRIPTOR[] rawformats = OpenGLWinFormsControl.GetPixelFormats(contextFinder.GetHDC());
         if (checkAllFormats.Checked)
         {
             formats = new OpenGLWinFormsControl.PixelFormatValue[rawformats.Length];
             for (int i = 0; i < rawformats.Length; i++)
             {
                 formats[i] = new OpenGLWinFormsControl.PixelFormatValue();
                 formats[i].formatNumber = i + 1;
                 formats[i].pfd          = rawformats[i];
             }
         }
         else
         {
             //Prioritize formats as requested by the user.
             formats = OpenGLWinFormsControl.PrioritizePixelFormats(rawformats, checkDoubleBuffering.Checked, checkHardwareAccel.Checked);
         }
         contextFinder.Dispose();
     }
     //Update the format grid to reflect possible changes in formats.
     FillGrid();
     this.Cursor = Cursors.Default;
 }