Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to set the TypeConverter of a Control?

How to set the TypeConverter of a Control?

Scheduled Pinned Locked Moved C#
questioncsharpc++dotnetgraphics
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wangier
    wrote on last edited by
    #1

    :confused: A custome control, which has a property "NormalImage", its type is Image. When I use this control, In the Property Editor, once I have assign the property NoarmalImage a Bitmap, I can't set it to null anymore. How can I set this property to be can-set-empty with attribute attached to this property? The native control Button of .net framework has a property "Image", and it can be set to empty(null) through press the key "delete". How can I do like this? Someone can answer me?

    G 1 Reply Last reply
    0
    • W wangier

      :confused: A custome control, which has a property "NormalImage", its type is Image. When I use this control, In the Property Editor, once I have assign the property NoarmalImage a Bitmap, I can't set it to null anymore. How can I set this property to be can-set-empty with attribute attached to this property? The native control Button of .net framework has a property "Image", and it can be set to empty(null) through press the key "delete". How can I do like this? Someone can answer me?

      G Offline
      G Offline
      god4k
      wrote on last edited by
      #2

      Dear, Sir //If no the following line, press the key "Delete" will no result. [DefaultValue(null)] //<====this line is important. public Image Image { get {return yourImage; } set {yourImage = value; } } I have a problem above this message. can you help me? (see author: god4k). ;):|:|:|:|:|:|:|;)

      B W 2 Replies Last reply
      0
      • G god4k

        Dear, Sir //If no the following line, press the key "Delete" will no result. [DefaultValue(null)] //<====this line is important. public Image Image { get {return yourImage; } set {yourImage = value; } } I have a problem above this message. can you help me? (see author: god4k). ;):|:|:|:|:|:|:|;)

        B Offline
        B Offline
        Bo Hunter
        wrote on last edited by
        #3

        The DefaultValueAttribute( null ) is what the runtime checks to see if the value is set to the default value. You also need to set the yourImage to null in the ctor or where it is declared. Also you need a method called ResetImage that simply sets yourImage member to null. Thank You Bo Hunter

        1 Reply Last reply
        0
        • G god4k

          Dear, Sir //If no the following line, press the key "Delete" will no result. [DefaultValue(null)] //<====this line is important. public Image Image { get {return yourImage; } set {yourImage = value; } } I have a problem above this message. can you help me? (see author: god4k). ;):|:|:|:|:|:|:|;)

          W Offline
          W Offline
          wangier
          wrote on last edited by
          #4

          I got it. Thank you!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups