예제 #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;
        }
예제 #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;
        }
예제 #3
0
        private void FillGrid()
        {
            int selectionIndex = -1;

            gridFormats.BeginUpdate();
            gridFormats.Rows.Clear();
            for (int i = 0; i < formats.Length; i++)
            {
                ODGridRow row = new ODGridRow();
                row.Cells.Add(formats[i].formatNumber.ToString());
                row.Cells.Add(OpenGLWinFormsControl.FormatSupportsOpenGL(formats[i].pfd)?"Yes":"No");
                row.Cells.Add(OpenGLWinFormsControl.FormatSupportsWindow(formats[i].pfd)?"Yes":"No");
                row.Cells.Add(OpenGLWinFormsControl.FormatSupportsBitmap(formats[i].pfd)?"Yes":"No");
                row.Cells.Add(OpenGLWinFormsControl.FormatUsesPalette(formats[i].pfd)?"Yes":"No");
                row.Cells.Add(OpenGLWinFormsControl.FormatSupportsAcceleration(formats[i].pfd)?"Yes":"No");
                row.Cells.Add(OpenGLWinFormsControl.FormatSupportsDoubleBuffering(formats[i].pfd)?"Yes":"No");
                row.Cells.Add(formats[i].pfd.cColorBits.ToString());
                row.Cells.Add(formats[i].pfd.cDepthBits.ToString());
                gridFormats.Rows.Add(row);
                if (formats[i].formatNumber == selectedFormatNum)
                {
                    selectionIndex = i;
                }
            }
            gridFormats.EndUpdate();
            if (selectionIndex >= 0)
            {
                gridFormats.SetSelected(selectionIndex, true);
            }
        }
예제 #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();
        }
예제 #5
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;
        }
예제 #6
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;
 }
예제 #7
0
        private void FillGrid()
        {
            int selectionIndex = -1;

            gridFormats.BeginUpdate();
            gridFormats.Rows.Clear();
            if (this.radioDirectXChart.Checked)
            {
                textSelected.Text = "";
                gridFormats.BeginUpdate();
                gridFormats.Columns.Clear();
                ODGridColumn col = new ODGridColumn(Lan.g(this, "FormatNum"), 80);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Adapter"), 60);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Accelerated"), 80);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Buffered"), 75);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "ColorBits"), 75);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "ColorFormat"), 75);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "DepthBits"), 75);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "DepthFormat"), 75);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Antialiasing"), 75);
                gridFormats.Columns.Add(col);
                gridFormats.EndUpdate();
                for (int i = 0; i < xformats.Length; i++)
                {
                    ODGridRow row = new ODGridRow();
                    row.Cells.Add((i + 1).ToString());
                    row.Cells.Add(xformats[i].adapterIndex.ToString());
                    row.Cells.Add(xformats[i].IsHardware?"Yes":"No");                                              //Supports hardware acceleration?
                    row.Cells.Add("Yes");                                                                          //Supports double-buffering. All DirectX devices support double-buffering as required.
                    row.Cells.Add(ToothChartDirectX.GetFormatBitCount(xformats[i].BackBufferFormat).ToString());   //Color bits.
                    row.Cells.Add(xformats[i].BackBufferFormat);
                    row.Cells.Add(ToothChartDirectX.GetFormatBitCount(xformats[i].DepthStencilFormat).ToString()); //Depth buffer bits.
                    row.Cells.Add(xformats[i].DepthStencilFormat);
                    row.Cells.Add(xformats[i].MultiSampleCount.ToString());
                    gridFormats.Rows.Add(row);
                    if (xformats[i].ToString() == selectedDirectXFormat)
                    {
                        selectionIndex    = i;
                        textSelected.Text = (i + 1).ToString();
                    }
                }
            }
            else if (this.radioOpenGLChart.Checked)
            {
                textSelected.Text = selectedFormatNum.ToString();
                gridFormats.BeginUpdate();
                gridFormats.Columns.Clear();
                ODGridColumn col = new ODGridColumn(Lan.g(this, "FormatNum"), 80);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "OpenGL"), 60);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Windowed"), 80);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Bitmapped"), 80);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Palette"), 75);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Accelerated"), 80);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "Buffered"), 75);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "ColorBits"), 75);
                gridFormats.Columns.Add(col);
                col = new ODGridColumn(Lan.g(this, "DepthBits"), 75);
                gridFormats.Columns.Add(col);
                gridFormats.EndUpdate();
                for (int i = 0; i < formats.Length; i++)
                {
                    ODGridRow row = new ODGridRow();
                    row.Cells.Add(formats[i].formatNumber.ToString());
                    row.Cells.Add(OpenGLWinFormsControl.FormatSupportsOpenGL(formats[i].pfd)?"Yes":"No");
                    row.Cells.Add(OpenGLWinFormsControl.FormatSupportsWindow(formats[i].pfd)?"Yes":"No");
                    row.Cells.Add(OpenGLWinFormsControl.FormatSupportsBitmap(formats[i].pfd)?"Yes":"No");
                    row.Cells.Add(OpenGLWinFormsControl.FormatUsesPalette(formats[i].pfd)?"Yes":"No");
                    row.Cells.Add(OpenGLWinFormsControl.FormatSupportsAcceleration(formats[i].pfd)?"Yes":"No");
                    row.Cells.Add(OpenGLWinFormsControl.FormatSupportsDoubleBuffering(formats[i].pfd)?"Yes":"No");
                    row.Cells.Add(formats[i].pfd.cColorBits.ToString());
                    row.Cells.Add(formats[i].pfd.cDepthBits.ToString());
                    gridFormats.Rows.Add(row);
                    if (formats[i].formatNumber == selectedFormatNum)
                    {
                        selectionIndex = i;
                    }
                }
            }
            gridFormats.EndUpdate();
            if (selectionIndex >= 0)
            {
                gridFormats.SetSelected(selectionIndex, true);
            }
        }