private void listView1_SelectedIndexChanged(object sender, EventArgs e) { try { if (listView1.SelectedItems.Count <= 0) { propertyGrid1.SelectedObject = null; return; } ClearSelectionElements(); DesignControlInstanceInfo dci = listView1.SelectedItems[0].Tag as DesignControlInstanceInfo; TypeDescriptor.AddAttributes(dci, new Attribute[] { new ReadOnlyAttribute(true) }); propertyGrid1.SelectedObject = dci; if (dci.Instance != null) { DesignComponent dcmpt = dci.Instance as DesignComponent; if (dcmpt != null) { //后台组件 ListViewItem[] lviComponents = _bizMain.listView1.Items.Find(dci.ModuleName, false); if (lviComponents.Length > 0) { lviComponents[0].Selected = true; } } else { DesignControl dc = dci.Instance as DesignControl; if (dc != null) { LayoutControl lc = dc.Parent as LayoutControl; if (lc != null) { LayoutControlItem lci = lc.GetItemByControl(dc); if (lci != null) { lc.ShowCustomizationForm(); lci.Selected = true; } } } } } } catch (Exception ex) { MsgBox.ShowException(ex, this); } }