在属性网格控件中选择属性时,UI会闪烁

时间:2018-05-17 09:36:15

标签: c# propertygrid

我有一个属性网格和一个组合框,基于组合框的值,我更改了propertygrid.SelectedItem并刷新了属性网格。 问题在于,无论何时我选择一个值来编辑整个屏幕,都会开始闪烁,就像它重新绘制或重新绘制一样。这只发生在我选择属性网格上的属性时,当我转到另一个屏幕然后回来时它会消失。我没有在点击事件上写任何重绘功能。

[edit1]我添加了组合框所选项目更改的代码段

if (this.comboBoxHomerSelectSettings.SelectedItem.ToString() == "AppSettings")
            {
                this.comboBoxHomerSublist.Visible = false;
                this.propertyGridEditSettings.SelectedObject = Settings.SingleInstance.SettingsValues.AppSettings;
            }
            else if (this.comboBoxHomerSelectSettings.SelectedItem.ToString() == "WaferSpecificSettings")
            {
                this.comboBoxHomerSublist.Visible = true;
                this.comboBoxHomerSublist.Items.Clear();
                for (int i = 0; i < Settings.SingleInstance.SettingsValues.WaferSpeicificSettingsList.WaferSpeicificInformationList.Count;i++ )
                {
                    this.comboBoxHomerSublist.Items.Add(Settings.SingleInstance.SettingsValues.WaferSpeicificSettingsList.WaferSpeicificInformationList.ElementAt(i));
                }
                this.comboBoxHomerSublist.SelectedIndex = 0;
                this.propertyGridEditSettings.SelectedObject = this.comboBoxHomerSublist.SelectedItem;
            }
            else if (this.comboBoxHomerSelectSettings.SelectedItem.ToString() == "BinColorMapping")
            {
                this.comboBoxHomerSublist.Visible = true;
                this.comboBoxHomerSublist.Items.Clear();
                for (int i = 0; i < Settings.SingleInstance.SettingsValues.BinColorInfoList.BinColorInformationList.Count; i++)
                {
                    this.comboBoxHomerSublist.Items.Add(Settings.SingleInstance.SettingsValues.BinColorInfoList.BinColorInformationList.ElementAt(i));
                }
                this.comboBoxHomerSublist.SelectedIndex = 0;
                this.propertyGridEditSettings.SelectedObject = this.comboBoxHomerSublist.SelectedItem;
            }
            else if (this.comboBoxHomerSelectSettings.SelectedItem.ToString() == "CommonSettings")
            {
                this.comboBoxHomerSublist.Visible = false;
                this.propertyGridEditSettings.SelectedObject = Settings.SingleInstance.SettingsValues.CommonSettings;
            }
            else if (this.comboBoxHomerSelectSettings.SelectedItem.ToString() == "DOETypeMapping")
            {
                this.comboBoxHomerSublist.Visible = true;
                this.comboBoxHomerSublist.Items.Clear();
                for (int i = 0; i < Settings.SingleInstance.SettingsValues.DOETypeMapingInfoList.DOETypeMapingInformationList.Count; i++)
                {
                    this.comboBoxHomerSublist.Items.Add(Settings.SingleInstance.SettingsValues.DOETypeMapingInfoList.DOETypeMapingInformationList.ElementAt(i));
                }
                this.comboBoxHomerSublist.SelectedIndex = 0;
                this.propertyGridEditSettings.SelectedObject = this.comboBoxHomerSublist.SelectedItem;
            }
            this.propertyGridEditSettings.Refresh();

0 个答案:

没有答案