예제 #1
0
 public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType)
 {
     Skybound.VisualTips.VisualTip visualTip = value as Skybound.VisualTips.VisualTip;
     if (destinationType == typeof(string))
     {
         if (!visualTip.ShouldSerialize())
         {
             return("(none)");
         }
         return("(VisualTip)");
     }
     if (destinationType == typeof(System.ComponentModel.Design.Serialization.InstanceDescriptor))
     {
         return(new System.ComponentModel.Design.Serialization.InstanceDescriptor(typeof(Skybound.VisualTips.VisualTip).GetConstructor(System.Type.EmptyTypes), null, false));
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
예제 #2
0
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     WinForms = provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)) as System.Windows.Forms.Design.IWindowsFormsEditorService;
     Skybound.VisualTips.VisualTip visualTip = value as Skybound.VisualTips.VisualTip;
     System.Windows.Forms.Control  control   = new System.Windows.Forms.Control();
     if (visualTip.ShouldSerialize())
     {
         Layout = visualTip.Provider.Renderer.CreateLayout(visualTip);
         Layout.Offset(8, 8);
         CurrentTip         = visualTip;
         control.Size       = Layout.GetSize() + (new System.Drawing.Size(16, 16));
         control.Paint     += new System.Windows.Forms.PaintEventHandler(OnDropDownPaint);
         control.MouseDown += new System.Windows.Forms.MouseEventHandler(OnDropDownMouseDown);
     }
     else
     {
         control.Size   = new System.Drawing.Size(144, 28);
         control.Paint += new System.Windows.Forms.PaintEventHandler(OnEmptyDropDownPaint);
     }
     WinForms.DropDownControl(control);
     return(value);
 }