Example #1
0
        /// <summary>
        /// Moves down.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void MoveDown(object sender, EventArgs e)
        {
            PropertyInfo p = this.actual.GetType().GetProperty("Value");

            if (p.GetValue(this.actual, null) is CustomText)
            {
                CustomText ctext = p.GetValue(this.actual, null) as CustomText;
                this.mflabel.CustomTextmoveDown(ctext);
            }
        }
Example #2
0
        /// <summary>
        /// Creates a new instance of the specified collection item type.
        /// </summary>
        /// <param name="itemType">The type of item to create.</param>
        /// <returns>A new instance of the specified object.</returns>
        protected override object CreateInstance(Type itemType)
        {
            CustomText ctext = (CustomText)base.CreateInstance(itemType);
            string     dText = this.GetDisplayText(ctext);

            dText = dText.Substring(dText.LastIndexOf(".") + 1);
            int counter = 0;

            do
            {
                counter++;
            }while (this.mflabel.customTextNames.Contains(dText + counter.ToString()));
            ctext.Name = ctext.Text = dText + counter.ToString();
            ctext.Data = this.TextFormatNames;
            ctext.ExtPropertyChanged += new ExtPropertyChangedEventHandler(this.mflabel.CustomTextHasChanged);
            this.mflabel.AddCustomText(ctext);
            return(ctext);
        }
Example #3
0
        /// <summary>
        /// Deletes the item.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void deleteItem(object sender, EventArgs e)
        {
            PropertyInfo pInfo = this.previous.GetType().GetProperty("Value");

            if (pInfo == null || this.listBox.SelectedItem == null)
            {
                pInfo = this.actual.GetType().GetProperty("Value");
                if (pInfo != null)
                {
                    CustomText ctext = pInfo.GetValue(this.actual, null) as CustomText;
                    this.mflabel.RemoveCustomText(ctext);
                }
                return;
            }
            if (pInfo.GetValue(this.previous, null) is CustomText)
            {
                CustomText ctext = pInfo.GetValue(this.previous, null) as CustomText;
                this.mflabel.RemoveCustomText(ctext);
            }
        }
Example #4
0
 /// <summary>
 /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle" /> method.
 /// </summary>
 /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that can be used to gain additional context information.</param>
 /// <param name="provider">An <see cref="T:System.IServiceProvider" /> that this editor can use to obtain services.</param>
 /// <param name="value">The object to edit.</param>
 /// <returns>The new value of the object. If the value of the object has not changed, this should return the same object it was passed.</returns>
 public override Object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, Object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         this.edSvc = ((System.Windows.Forms.Design.IWindowsFormsEditorService)(provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService))));
         if (this.edSvc != null)
         {
             this.TextFormatNamesList.Items.Clear();
             if (context.Instance is CustomText)
             {
                 CustomText customtext = (CustomText)context.Instance;
                 this.TextFormatNamesList.Items.AddRange(customtext.Data);
                 if (value != null && value.ToString() != "")
                 {
                     this.TextFormatNamesList.SelectedItem = value;
                 }
                 this.edSvc.DropDownControl(this.TextFormatNamesList);
                 value = this.TextFormatNamesList.SelectedItem;
             }
         }
     }
     return(value);
 }