Esempio n. 1
0
 private void ClearStyles()
 {
     if (styleApplicator != null)
     {
         styleApplicator.ClearStyles();
     }
 }
Esempio n. 2
0
        private void MakeThisCurrentApplicator()
        {
            if (currentApplicator != null && currentApplicator != this)
            {
                currentApplicator.ClearStyles();
            }

            currentApplicator = this;
        }
Esempio n. 3
0
        private void FormClosedEventHandler(object sender, EventArgs e)
        {
            /* Why clear styles when the form is closed?
             * I encountered an issue with ComoboBox, where text in the drop-down area would have a different font when re-opening the form (as if UseCompatibleTextRendering was enabled).
             * This occurred when opening the form through a static instance, where the same instance would be re-opened.
             * This occurred even if styles were not re-applied, meaning closing the form while styles are applied seems to be triggering the problem.
             */

            if (sender is Form form)
            {
                // Hide the form before clearing styles so that the user doesn't see the styles being cleared.

                form.Visible = false;

                styleApplicator.ClearStyles(form);
            }
        }