예제 #1
0
 public int Add(object value)
 {
     _collection.Add(value as StripTabCursor);
     return(_collection.Count - 1);
 }
예제 #2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            //打开属性编辑器修改数据
            Control                  control    = context.Instance as Control;
            PropertyDescriptor       descriptor = context.PropertyDescriptor;
            StripTabCursorCollection tabCursor  = descriptor.GetValue(context.Instance) as StripTabCursorCollection;
            // 强制变更,以将变更写入文件
            PropertyDescriptor backColorProperty = TypeDescriptor.GetProperties(control)["BackColor"];

            backColorProperty.SetValue(control, control.BackColor);

            return(CollectionPropertyEditorForm <StripTabCursor> .EditValue(descriptor.Name, tabCursor, () => { tabCursor.Add(new StripTabCursor()); }, true));
        }
 private void button_add_Click(object sender, EventArgs e)
 {
     _cursors.Add(new StripTabCursor());
     RefreshCursorInfo();
 }