Ejemplo n.º 1
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            Font ft = new Font("Times New Roman", e.Bounds.Height, GraphicsUnit.Pixel);
            AssemblyTargetFramework tf = (AssemblyTargetFramework)e.Value;

            if (tf == AssemblyTargetFramework.V35)
            {
                e.Graphics.DrawString(".Net Framework 3.5", ft, Brushes.Black, (float)0, (float)0);
            }
            else if (tf == AssemblyTargetFramework.V40)
            {
                e.Graphics.DrawString(".Net Framework 4.0", ft, Brushes.Black, (float)0, (float)0);
            }
            base.PaintValue(e);
        }
Ejemplo n.º 2
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             object[] vs = new object[2];
             vs[0] = ".Net Framework 3.5";
             vs[1] = ".Net Framework 4.0";
             ValueList list = new ValueList(edSvc, vs);
             if (value != null)
             {
                 try
                 {
                     AssemblyTargetFramework tf = (AssemblyTargetFramework)value;
                     if (tf == AssemblyTargetFramework.V35)
                     {
                         list.SelectedIndex = 0;
                     }
                     else if (tf == AssemblyTargetFramework.V40)
                     {
                         list.SelectedIndex = 1;
                     }
                 }
                 catch
                 {
                 }
             }
             edSvc.DropDownControl(list);
             if (list.MadeSelection)
             {
                 if (list.Selection == 0)
                 {
                     value = AssemblyTargetFramework.V35;
                 }
                 else
                 {
                     value = AssemblyTargetFramework.V40;
                 }
             }
         }
     }
     return(value);
 }