示例#1
0
 public static void Resize(ODGrid gridProg, Panel panelImages, Panel panelEcw, TabControl tabControlImages, Size ClientSize
                           , ODGrid gridPtInfo, ToothChartWrapper toothChart, RichTextBox textTreatmentNotes, TrackBar trackBar, Label textTrackBarDate)
 {
     if (Programs.HListIsNull())
     {
         return;
     }
     if (UsingEcwTightOrFull())
     {
         //gridProg.Width=524;
         if (gridProg.Columns != null && gridProg.Columns.Count > 0)
         {
             int gridW = 0;
             for (int i = 0; i < gridProg.Columns.Count; i++)
             {
                 gridW += gridProg.Columns[i].ColWidth;
             }
             if (gridW < 524)                   //for example, if not very many columns
             {
                 gridW = 524;
             }
             if (gridW + 20 + toothChart.Width < ClientSize.Width)                 //if space is big enough to allow full width
             {
                 gridProg.Width = gridW + 20;
             }
             else
             {
                 if (ClientSize.Width > 0)                       //prevents an error
                 {
                     if (ClientSize.Width - toothChart.Width - 1 < 524)
                     {
                         gridProg.Width = 524;
                     }
                     else
                     {
                         gridProg.Width = ClientSize.Width - toothChart.Width - 1;
                     }
                 }
             }
             //now, bump the other controls over
             toothChart.Location         = new Point(gridProg.Width + 2, 26);
             trackBar.Location           = new Point(gridProg.Width + 2 + textTrackBarDate.Width, toothChart.Bottom + 1);
             textTrackBarDate.Location   = new Point(gridProg.Width + 2, toothChart.Bottom + 1);
             textTreatmentNotes.Location = new Point(gridProg.Width + 2, trackBar.Bottom + 1);
             panelEcw.Location           = new Point(gridProg.Width + 2, textTreatmentNotes.Bottom + 1);
         }
         if (panelImages.Visible)
         {
             panelEcw.Height = tabControlImages.Top - panelEcw.Top + 1 - (panelImages.Height + 2);
         }
         else
         {
             panelEcw.Height = tabControlImages.Top - panelEcw.Top + 1;
         }
         return;
     }
     if (Programs.UsingOrion)             //full width
     {
         gridProg.Width = ClientSize.Width - gridProg.Location.X - 1;
     }
     else if (gridProg.Columns != null && gridProg.Columns.Count > 0)
     {
         int gridW = 0;
         for (int i = 0; i < gridProg.Columns.Count; i++)
         {
             gridW += gridProg.Columns[i].ColWidth;
         }
         if (gridProg.Location.X + gridW + 20 < ClientSize.Width)             //if space is big enough to allow full width
         {
             gridProg.Width = gridW + 20;
         }
         else
         {
             if (ClientSize.Width > gridProg.Location.X)                   //prevents an error
             {
                 gridProg.Width = ClientSize.Width - gridProg.Location.X - 1;
             }
         }
     }
     if (Programs.UsingOrion)
     {
         //gridPtInfo is up in the tabs and does not need to be resized.
     }
     else
     {
         gridPtInfo.Height = tabControlImages.Top - gridPtInfo.Top;
     }
 }