예제 #1
0
        public void UpdatePropertyGrid(PropertyGridEx.PropertyGridEx pgProperties)
        {
            // Get Attribute information from the database regarding this attribute.
            //String strQuery = "Select NETWORK_NAME, DESCRIPTION, DESIGNER_USERID, DESIGNER_NAME, DATE_CREATED, DATE_LAST_EDIT, NUMBER_SECTIONS, LOCK_, PRIVATE_ From NETWORKS Where NETWORK_NAME = '" + m_strNetworkName + "'";
            String strQuery = "Select NETWORK_NAME, DESCRIPTION, DESIGNER_USERID, DESIGNER_NAME, DATE_CREATED, DATE_LAST_EDIT, NUMBER_SECTIONS From NETWORKS Where NETWORK_NAME = '" + m_strNetworkName + "'";

            try
            {
                DataSet ds = DBMgr.ExecuteQuery(strQuery);

                // More random error checking
                if (ds.Tables[0].Rows.Count != 1)
                {
                    throw (new Exception());
                }
                else
                {
                    pgProperties.Item[0].Value = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                    pgProperties.Item[1].Value = ds.Tables[0].Rows[0].ItemArray[1].ToString();
                    pgProperties.Item[2].Value = ds.Tables[0].Rows[0].ItemArray[2].ToString();
                    pgProperties.Item[3].Value = ds.Tables[0].Rows[0].ItemArray[3].ToString();
                    pgProperties.Item[4].Value = ds.Tables[0].Rows[0].ItemArray[4].ToString();
                    pgProperties.Item[5].Value = ds.Tables[0].Rows[0].ItemArray[5].ToString();
                    pgProperties.Item[6].Value = ds.Tables[0].Rows[0].ItemArray[6].ToString();
                    pgProperties.Refresh();
                }
            }
            catch (Exception sqlE)
            {
                Global.WriteOutput("Error: Cannot update property tool window.  " + sqlE.Message);
            }
        }
예제 #2
0
        private void ParseProperty(ParseType parseType)
        {
            //_propertyGridEx.SelectedObject = _controls[0]
            CustomDesignControl customDesignControl = (CustomDesignControl)_controls[tvSettings.SelectedNode.Index];
            Control             cntrl = (Control)_controls[tvSettings.SelectedNode.Index].ObjectControl;

            PropertyInfo[] properties = cntrl.GetType().GetProperties();
            if (parseType == ParseType.LoadFromControl)
            {
                _propertyGridEx.Item.Clear();
            }
            foreach (PropertyInfo pi in properties)
            {
                switch (pi.Name)
                {
                case "Font":
                    if (cntrl is DataGridView)
                    {
                        continue;
                    }
                    if (cntrl is ToolStrip)
                    {
                        continue;
                    }
                    if (cntrl is RichTextBox)
                    {
                        continue;
                    }
                    cntrl.Font = ParseFontDesignSetting(parseType, cntrl, FONT_PROP_NAME, cntrl.Font, customDesignControl.SettingId);
                    break;

                case "BackColor":
                    if (cntrl is DataGridView)
                    {
                        continue;
                    }
                    if (cntrl is TabControl)
                    {
                        foreach (TabPage tp in (((TabControl)cntrl).TabPages))
                        {
                            //tp.BackColor = ParseColorDesignSetting(parseType, (TabControl)cntrl, BACK_COLOR_PROP_NAME, cntrl.BackColor);
                            tp.BackColor = ParseColorDesignSetting(parseType, (TabControl)cntrl, BACK_COLOR_PROP_NAME, tp.BackColor, customDesignControl.SettingId);
                        }
                        continue;
                    }
                    cntrl.BackColor = ParseColorDesignSetting(parseType, cntrl, BACK_COLOR_PROP_NAME, cntrl.BackColor, customDesignControl.SettingId);
                    break;

                case "BackgroundColor":
                    if (cntrl is DataGridView)
                    {
                        ((DataGridView)cntrl).BackgroundColor = ParseColorDesignSetting(parseType, cntrl, BACK_COLOR_PROP_NAME, ((DataGridView)cntrl).BackgroundColor, customDesignControl.SettingId);
                    }
                    break;

                case "ColumnHeadersDefaultCellStyle":
                    if (cntrl is DataGridView)
                    {
                        ((DataGridView)cntrl).ColumnHeadersDefaultCellStyle.BackColor = ParseColorDesignSetting(parseType, cntrl, HEADER_STYLE_BACK_COLOR_PROP_NAME, ((DataGridView)cntrl).ColumnHeadersDefaultCellStyle.BackColor, customDesignControl.SettingId);
                        ((DataGridView)cntrl).ColumnHeadersDefaultCellStyle.Font      = ParseFontDesignSetting(parseType, cntrl, HEADER_STYLE_FONT_PROP_NAME, ((DataGridView)cntrl).ColumnHeadersDefaultCellStyle.Font, customDesignControl.SettingId);
                        ((DataGridView)cntrl).DefaultCellStyle.Font = ParseFontDesignSetting(parseType, cntrl, CELL_FONT_PROP_NAME, ((DataGridView)cntrl).DefaultCellStyle.Font, customDesignControl.SettingId);
                    }
                    break;
                    //default:
                    //  _propertyGridEx.Item.Add(pi.Name, string.Empty, false, pi.PropertyType.Name, string.Empty, true);
                    //  break;
                }
            }
            if (parseType == ParseType.LoadFromControl)
            {
                _propertyGridEx.Refresh();
            }
        }