代码改变世界

FontComboBox

2010-02-23 14:47  爱研究源码的javaer  阅读(280)  评论(0编辑  收藏  举报

 

public FontFamily SelectedFontFamily
  {

   get
   {

    if (m_comboBox == null)
     return null;

    int index = m_comboBox.SelectedIndex;

    if (index == -1)
     return null;

    return ((Font)m_comboBox.SelectedItem).FontFamily;

   } 

   set
   {

    // Sanity check the combobox before attempting to use it.
    if (m_comboBox == null)
     return;

    int index = -1;

    // Should we look for a matching item?
    if (value != null)
     index = m_comboBox.FindString(value.Name, 0);

    // Select the item.
    m_comboBox.SelectedIndex = index;
    
   } // End set

  }

 转自:http://www.myfirm.cn/News/DotNetUserInterface/20080209014905392.html

 /Files/johnwonder/CGFontComboSrc.rar

 

自定义属性:

[CGDescription(typeof(CGFontCombo), "selected_index_changed")]
 [CGCategory(typeof(CGFontCombo), "behavior")]
 public event EventHandler SelectedIndexChanged;

/Files/johnwonder/Core.rar