Exemplo n.º 1
0
        public void UpdateParentDesign(Form frmParent)
        {
            if (configParser == null)
            {
                return;
            }
            FormDesign formDesign = configParser.GetFormDesign();

            frmParent.PerformSafely(() =>
            {
                double scalingFactor = frmParent.CreateGraphics().DpiX / 96.0;
                if (formDesign.Height > 0)
                {
                    frmParent.Height = (int)Math.Round(formDesign.Height * scalingFactor);
                }
                if (formDesign.Width > 0)
                {
                    frmParent.Width = (int)Math.Round(formDesign.Width * scalingFactor);
                }
                if (formDesign.ClientWidth > 0 && formDesign.ClientHeight > 0)
                {
                    frmParent.ClientSize = new Size((int)Math.Round(formDesign.ClientWidth * scalingFactor), (int)Math.Round(formDesign.ClientHeight * scalingFactor));
                }

                frmParent.BackColor = formDesign.BackgroundColor;
                if (formDesign.FormName != "")
                {
                    frmParent.Text = formDesign.FormName;
                }
            });
        }
Exemplo n.º 2
0
        private void SetFormDesign()
        {
            _formDesign = new FormDesign();
            XmlNode formDesignNode = _xmlDoc.SelectSingleNode("//FormDesign");

#if DEBUG
            Logger.GetLogger().Info("Read config file - Form Design:", Logger.Level.MEDIUM_DEBUG_LEVEL);
#endif
            if (formDesignNode == null)
            {
                return;
            }

            _formDesign.Height       = XmlParser.GetIntValue(formDesignNode, "Height");
            _formDesign.Width        = XmlParser.GetIntValue(formDesignNode, "Width");
            _formDesign.ClientHeight = XmlParser.GetIntValue(formDesignNode, "ClientHeight");
            _formDesign.ClientWidth  = XmlParser.GetIntValue(formDesignNode, "ClientWidth");

            _formDesign.BackgroundColor = XmlParser.GetColorValue(formDesignNode, "BackgroundColor");

            _formDesign.FormName = XmlParser.GetStringValue(formDesignNode, "FormName");

            _formDesign.DefaultControlDesign = XmlParser.GetXpathRefAttributes(formDesignNode.SelectSingleNode("DefaultControlDesign"));
        }