Exemplo n.º 1
0
        private void BrowseTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            m_Browses.TestDynamicAttribute = (ETestAttribute)BrowseTypeComboBox.SelectedIndex;
            PropertyDescriptorCollection descs = TypeDescriptor.GetProperties(m_Browses);

            if (descs != null)
            {
                BrowseTypeTextBox.Text = "";
                foreach (PropertyDescriptor pd in descs)
                {
                    CPropertyDescriptor proDesc = pd as CPropertyDescriptor;
                    if (proDesc != null)
                    {
                        BrowseTypeTextBox.Text += proDesc.GetValue(null).ToString() + "\r\n";
                    }
                }
            }
        }
Exemplo n.º 2
0
    public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
    {
        List <CPropertyDescriptor>   tmpPDCLst = new List <CPropertyDescriptor>();
        PropertyDescriptorCollection tmpPDC    = TypeDescriptor.GetProperties(mCurrentSelectObject, attributes);
        CPropertyDescriptor          tmpCPD;

        foreach (PropertyDescriptor tmpPD in tmpPDC)
        {
            if (mObjectAttribs.ContainsKey(tmpPD.Name))
            {
                tmpCPD = new CPropertyDescriptor(mCurrentSelectObject, tmpPD);
                tmpCPD.SetDisplayName(mObjectAttribs[tmpPD.Name]);
                tmpCPD.SetCategory(tmpPD.Category);
                tmpPDCLst.Add(tmpCPD);
            }
        }

        return(new PropertyDescriptorCollection(tmpPDCLst.ToArray()));
    }