System.ComponentModel.TypeConverter.ConvertToString C# (CSharp) Method

ConvertToString() public method

public ConvertToString ( ITypeDescriptorContext context, CultureInfo culture, object value ) : string
context ITypeDescriptorContext
culture System.Globalization.CultureInfo
value object
return string
        public string ConvertToString(ITypeDescriptorContext context, CultureInfo culture, object value) {
            return (string)ConvertTo(context, culture, value, typeof(string));
        }

Same methods

TypeConverter::ConvertToString ( ITypeDescriptorContext context, object value ) : string
TypeConverter::ConvertToString ( object value ) : string

Usage Example

Example #1
0
File: MyForm.cs Project: gvhung/dp2
        /*
         * static void ReLayout(Control parent_control)
         * {
         *  foreach (Control control in parent_control.Controls)
         *  {
         *      ReLayout(control);
         *
         *      control.ResumeLayout(false);
         *      control.PerformLayout();
         *  }
         *
         *  parent_control.ResumeLayout(false);
         * }*/

        /// <summary>
        /// 保存字体设置信息到配置参数存储
        /// </summary>
        public void SaveFontSetting()
        {
            if (this.MainForm != null && this.MainForm.AppInfo != null)
            {
                {
                    // Create the FontConverter.
                    System.ComponentModel.TypeConverter converter =
                        System.ComponentModel.TypeDescriptor.GetConverter(typeof(Font));

                    string strFontString = converter.ConvertToString(this.Font);

                    this.MainForm.AppInfo.SetString(
                        this.FormName,
                        "default_font",
                        strFontString);
                }

                {
                    // Create the ColorConverter.
                    System.ComponentModel.TypeConverter converter =
                        System.ComponentModel.TypeDescriptor.GetConverter(typeof(Color));

                    string strFontColor = converter.ConvertToString(this.ForeColor);

                    MainForm.AppInfo.SetString(
                        this.FormName,
                        "default_font_color",
                        strFontColor);
                }
            }
        }
All Usage Examples Of System.ComponentModel.TypeConverter::ConvertToString