public BlendFillEditorUI(IWindowsFormsEditorService in_svc, BlendFill in_blendFill, bool in_reverse) : base() { //This call is required by the Windows Form Designer. InitializeComponent(); //Add any initialization after the InitializeComponent() call this.m_svc = in_svc; // // Save out the values we were given. // this.m_direction = in_blendFill.Style; this.m_startColor = in_blendFill.StartColor; this.m_finishColor = in_blendFill.FinishColor; this.m_reverse = in_reverse; // // Populate and select values in the appropriate list boxes. // System.Resources.ResourceManager rm; rm = new System.Resources.ResourceManager(typeof(BlendFillEditorUI)); populateDirectionListBox(rm); populateAndSelectColorList(this.startColorList, this.m_startColor, rm); populateAndSelectColorList(this.finishColorList, this.m_finishColor, rm); }
//=--------------------------------------------------------------= // blendFillToString //=--------------------------------------------------------------= /// <summary> /// Converts a blend fill object to a string, using Culture /// Sensitive separators and using text values where possible. /// </summary> /// /// <param name="in_bf"> /// Convert me to a string. /// </param> /// /// <param name="in_culture"> /// From whence to get the cultural information. /// </param> /// /// <returns> /// The object as s string. /// </returns> /// private static string blendFillToString ( BlendFill in_bf, CultureInfo in_culture ) { System.Text.StringBuilder sb; TypeConverter tci, tcc; string sep; string[] args = new string[2]; // // Get appropriate conveters and culture data // tci = TypeDescriptor.GetConverter(typeof(int)); tcc = TypeDescriptor.GetConverter(typeof(Color)); if (in_culture == null) { in_culture = CultureInfo.CurrentCulture; } sep = in_culture.TextInfo.ListSeparator + " "; // // Get the style as a string // args[0] = System.Enum.GetName(typeof(BlendStyle), in_bf.Style); // // start color // args[1] = tcc.ConvertToString(in_bf.StartColor); // // Finish color // args[2] = tcc.ConvertToString(in_bf.FinishColor); // // Generate the string. We have to wrap the colors in () so that // ARGB specified ones can be determined later ... // sb = new System.Text.StringBuilder(); sb.Append(args[0]); sb.Append(sep); sb.Append("("); sb.Append(args[1]); sb.Append(")"); sb.Append(sep); sb.Append("("); sb.Append(args[2]); sb.Append(")"); return(sb.ToString()); }