Server/MainForm.cs
changeset 158 e22bf44c4300
parent 157 0f3e7b21c663
child 167 d2295c186ce1
     1.1 --- a/Server/MainForm.cs	Thu Sep 03 20:05:09 2015 +0200
     1.2 +++ b/Server/MainForm.cs	Thu Sep 24 14:35:50 2015 +0200
     1.3 @@ -133,6 +133,7 @@
     1.4              UpdateStatus();
     1.5  
     1.6              //We have a bug when drawing minimized and reusing our bitmap
     1.7 +            //Though I could not reproduce it on Windows 10
     1.8              iBmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height, PixelFormat.Format32bppArgb);
     1.9              iCreateBitmap = false;
    1.10  
    1.11 @@ -879,8 +880,9 @@
    1.12  					//Draw to bitmap
    1.13  					if (iCreateBitmap)
    1.14  					{
    1.15 -						iBmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height, PixelFormat.Format32bppArgb);
    1.16 -					}
    1.17 +                        iBmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height, PixelFormat.Format32bppArgb);
    1.18 +                        iCreateBitmap = false;
    1.19 +                    }
    1.20  					tableLayoutPanel.DrawToBitmap(iBmp, tableLayoutPanel.ClientRectangle);
    1.21  					//iBmp.Save("D:\\capture.png");
    1.22  
    1.23 @@ -1269,8 +1271,8 @@
    1.24          {
    1.25              if (WindowState == FormWindowState.Minimized)
    1.26              {
    1.27 -                // Do some stuff
    1.28 -                //iBmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height, PixelFormat.Format32bppArgb);
    1.29 +                // To workaround our empty bitmap bug on Windows 7 we need to recreate our bitmap when the application is minimized
    1.30 +                // That's apparently not needed on Windows 10 but we better leave it in place.
    1.31                  iCreateBitmap = true;
    1.32              }
    1.33          }
    1.34 @@ -1502,11 +1504,18 @@
    1.35                      //Don't change a thing if the layout is the same
    1.36                      if (!client.Layout.IsSameAs(aLayout))
    1.37                      {
    1.38 +                        Debug.Print("SetClientLayoutThreadSafe: Layout updated.");
    1.39                          //Set our client layout then
    1.40                          client.Layout = aLayout;
    1.41 +                        //Layout has changed clear our fields then
    1.42 +                        client.Fields.Clear();
    1.43                          //
    1.44                          UpdateClientTreeViewNode(client);
    1.45                      }
    1.46 +                    else
    1.47 +                    {
    1.48 +                        Debug.Print("SetClientLayoutThreadSafe: Layout has not changed.");
    1.49 +                    }
    1.50                  }
    1.51              }
    1.52          }
    1.53 @@ -1553,7 +1562,7 @@
    1.54                  layoutChanged = true;
    1.55              }
    1.56  
    1.57 -            //Now that we know hour fields are in place just update that one
    1.58 +            //Now that we know our fields are in place just update that one
    1.59              client.Fields[aField.Index] = aField;
    1.60  
    1.61              if (client.Fields[aField.Index].IsSameLayout(aField))
    1.62 @@ -1602,6 +1611,14 @@
    1.63                          UpdateTableLayoutPanel(iCurrentClientData);
    1.64                      }
    1.65                  }
    1.66 +                else
    1.67 +                {
    1.68 +                    Debug.Print("Layout has not changed.");
    1.69 +                }
    1.70 +            }
    1.71 +            else
    1.72 +            {
    1.73 +                Debug.Print("WARNING: content and layout have not changed!");
    1.74              }
    1.75  
    1.76              //When a client field is set we try switching to this client to present the new information to our user