I use DefaultValue for a property so that it will be not generated in designer when I create a control which has this property in designer. However, with properties which have data type is not standard, example: Image, how to use DefaultValue. Thanks.
This is an example codes:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
namespace DemoChart
{
  public class MyControl : Control
  {
    private Image m_Img = DemoChart.Properties.Resources.link;
    [DefaultValue("DemoChart.Properties.Resources.link")]
    public Image Img
    {
      get { return m_Img; }
      set { m_Img = value; }
    }
    public MyControl()
    {
    }
  }
}
Note: DemoChart.Properties.Resources.link is a Image resource which I add in project.
I create a form named Form1, drag a MyControl to this form and it name is myControl1. I open Form1.designer.cs to view generated codes, I still see myControl1's Img property. Why? I use DefaultValue but it doesn't have effect. Please help me. Thanks.
 
    