Re: Control Properties of Type System.Drawing.Color

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Hahn

    Re: Control Properties of Type System.Drawing.Color

    That looks like proper Property set code to me. What is the line of code
    that the designer is generating in the Sub InitializeCompo nent for a color
    that you select in the Properties Settings?

    "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
    news:er%23hyAFO JHA.1896@TK2MSF TNGP02.phx.gbl. ..
    Actually, it is a custom control that inherits System.Web.UI.C ontrol. My
    code for the BackgroundColor property is:
    >
    Public WriteOnly Property BackgroundColor () As System.Drawing. Color
    Set(ByVal value As System.Drawing. Color)
    Me._backgroundc olor = value
    End Set
    End Property
    >
    Me._backgroundc olor is declared as:
    >
    Private _backgroundcolo r As System.Drawing. Color
    >
    I know that my syntax for the property declaration is correct, I have used
    it many times in other classes for other types (such as String, Integer,
    etc.), just never with System.Drawing. Color. Any ideas? Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

    >
  • Nathan Sokalski

    #2
    Re: Control Properties of Type System.Drawing. Color

    I don't think I understood any of what you just said. What is
    InitializeCompo nent? It is not listed in the events for the control. I don't
    know a whole lot about developing desktop applications, but is it something
    specific to them (keep in mind that I am inheriting from
    System.Web.UI.C ontrol, which is used on web forms, not windows forms)? If
    you could please clarify what you just said, it might help. Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


    "James Hahn" <jhahn@yahoo.co mwrote in message
    news:uIpTjzHOJH A.3640@TK2MSFTN GP02.phx.gbl...
    That looks like proper Property set code to me. What is the line of code
    that the designer is generating in the Sub InitializeCompo nent for a color
    that you select in the Properties Settings?
    >
    "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
    news:er%23hyAFO JHA.1896@TK2MSF TNGP02.phx.gbl. ..
    >Actually, it is a custom control that inherits System.Web.UI.C ontrol. My
    >code for the BackgroundColor property is:
    >>
    >Public WriteOnly Property BackgroundColor () As System.Drawing. Color
    > Set(ByVal value As System.Drawing. Color)
    > Me._backgroundc olor = value
    > End Set
    >End Property
    >>
    >Me._background color is declared as:
    >>
    >Private _backgroundcolo r As System.Drawing. Color
    >>
    >I know that my syntax for the property declaration is correct, I have
    >used it many times in other classes for other types (such as String,
    >Integer, etc.), just never with System.Drawing. Color. Any ideas? Thanks.
    >--
    >Nathan Sokalski
    >njsokalski@hotm ail.com
    >http://www.nathansokalski.com/
    >>
    >

    Comment

    • James Hahn

      #3
      Re: Control Properties of Type System.Drawing. Color

      When you create objects using designer the system automatically creates the
      code required to instantiate the object and set its properties according to
      your properties settings selections in designer. The code for setting the
      properties occurs in the InitializeCompo nent sub. To see the code:

      Expand the Windows Form Designer generated code region
      Find the InitializeCompo nent sub
      Find the initializing code for your control
      Find the line that sets the relevant property, eg
      Me.<controlname >.BackgroundCol or = System.Drawing. Color.Green

      "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
      news:usd481JOJH A.5096@TK2MSFTN GP02.phx.gbl...
      >I don't think I understood any of what you just said. What is
      >InitializeComp onent? It is not listed in the events for the control. I
      >don't know a whole lot about developing desktop applications, but is it
      >something specific to them (keep in mind that I am inheriting from
      >System.Web.UI. Control, which is used on web forms, not windows forms)? If
      >you could please clarify what you just said, it might help. Thanks.
      --
      Nathan Sokalski
      njsokalski@hotm ail.com
      有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

      >
      "James Hahn" <jhahn@yahoo.co mwrote in message
      news:uIpTjzHOJH A.3640@TK2MSFTN GP02.phx.gbl...
      >That looks like proper Property set code to me. What is the line of code
      >that the designer is generating in the Sub InitializeCompo nent for a
      >color that you select in the Properties Settings?
      >>
      >"Nathan Sokalski" <njsokalski@hot mail.comwrote in message
      >news:er%23hyAF OJHA.1896@TK2MS FTNGP02.phx.gbl ...
      >>Actually, it is a custom control that inherits System.Web.UI.C ontrol. My
      >>code for the BackgroundColor property is:
      >>>
      >>Public WriteOnly Property BackgroundColor () As System.Drawing. Color
      >> Set(ByVal value As System.Drawing. Color)
      >> Me._backgroundc olor = value
      >> End Set
      >>End Property
      >>>
      >>Me._backgroun dcolor is declared as:
      >>>
      >>Private _backgroundcolo r As System.Drawing. Color
      >>>
      >>I know that my syntax for the property declaration is correct, I have
      >>used it many times in other classes for other types (such as String,
      >>Integer, etc.), just never with System.Drawing. Color. Any ideas? Thanks.
      >>--
      >>Nathan Sokalski
      >>njsokalski@hotm ail.com
      >>http://www.nathansokalski.com/
      >>>
      >>
      >
      >

      Comment

      • Nathan Sokalski

        #4
        Re: Control Properties of Type System.Drawing. Color

        There is no Windows Form Designer in my case because this is now a
        Windows/Desktop Application. I am writing a custom web control by inheriting
        from System.Web.UI.C ontrol. Am I still misunderstandin g, or am I just not
        allowed to have a property in the Property Grid that is of type
        System.Drawing. Color? Thanks.
        --
        Nathan Sokalski
        njsokalski@hotm ail.com
        有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


        "James Hahn" <jhahn@yahoo.co mwrote in message
        news:OcLkbvKOJH A.1488@TK2MSFTN GP03.phx.gbl...
        When you create objects using designer the system automatically creates
        the code required to instantiate the object and set its properties
        according to your properties settings selections in designer. The code
        for setting the properties occurs in the InitializeCompo nent sub. To see
        the code:
        >
        Expand the Windows Form Designer generated code region
        Find the InitializeCompo nent sub
        Find the initializing code for your control
        Find the line that sets the relevant property, eg
        Me.<controlname >.BackgroundCol or = System.Drawing. Color.Green
        >
        "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
        news:usd481JOJH A.5096@TK2MSFTN GP02.phx.gbl...
        >>I don't think I understood any of what you just said. What is
        >>InitializeCom ponent? It is not listed in the events for the control. I
        >>don't know a whole lot about developing desktop applications, but is it
        >>something specific to them (keep in mind that I am inheriting from
        >>System.Web.UI .Control, which is used on web forms, not windows forms)? If
        >>you could please clarify what you just said, it might help. Thanks.
        >--
        >Nathan Sokalski
        >njsokalski@hotm ail.com
        >http://www.nathansokalski.com/
        >>
        >"James Hahn" <jhahn@yahoo.co mwrote in message
        >news:uIpTjzHOJ HA.3640@TK2MSFT NGP02.phx.gbl.. .
        >>That looks like proper Property set code to me. What is the line of
        >>code that the designer is generating in the Sub InitializeCompo nent for
        >>a color that you select in the Properties Settings?
        >>>
        >>"Nathan Sokalski" <njsokalski@hot mail.comwrote in message
        >>news:er%23hyA FOJHA.1896@TK2M SFTNGP02.phx.gb l...
        >>>Actually, it is a custom control that inherits System.Web.UI.C ontrol.
        >>>My code for the BackgroundColor property is:
        >>>>
        >>>Public WriteOnly Property BackgroundColor () As System.Drawing. Color
        >>> Set(ByVal value As System.Drawing. Color)
        >>> Me._backgroundc olor = value
        >>> End Set
        >>>End Property
        >>>>
        >>>Me._backgrou ndcolor is declared as:
        >>>>
        >>>Private _backgroundcolo r As System.Drawing. Color
        >>>>
        >>>I know that my syntax for the property declaration is correct, I have
        >>>used it many times in other classes for other types (such as String,
        >>>Integer, etc.), just never with System.Drawing. Color. Any ideas?
        >>>Thanks.
        >>>--
        >>>Nathan Sokalski
        >>>njsokalski@hotm ail.com
        >>>http://www.nathansokalski.com/
        >>>>
        >>>
        >>
        >>
        >

        Comment

        • James Hahn

          #5
          Re: Control Properties of Type System.Drawing. Color

          What did it used to be before it became a Windows/Desktop application? That
          may be part of the problem - when a project type is changed the default code
          that the designer relies on may not match what it expects to see, and could
          create problems when the designer goes to write the designer file. It might
          be simplest to recreate the application using the correct project type and
          copy the code across.

          "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
          news:Oa5YbZXOJH A.4284@TK2MSFTN GP05.phx.gbl...
          There is no Windows Form Designer in my case because this is now a
          Windows/Desktop Application. I am writing a custom web control by
          inheriting from System.Web.UI.C ontrol. Am I still misunderstandin g, or am
          I just not allowed to have a property in the Property Grid that is of type
          System.Drawing. Color? Thanks.
          --
          Nathan Sokalski
          njsokalski@hotm ail.com
          有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

          >

          Comment

          • Nathan Sokalski

            #6
            Re: Control Properties of Type System.Drawing. Color

            Sorry, there was a typo in my previous posting. I meant to say:

            "There is no Windows Form Designer in my case because this is not a
            Windows/Desktop Application."
            not
            "There is no Windows Form Designer in my case because this is now a
            Windows/Desktop Application."

            Sorry for the misunderstandin g, it's amazing how much difference in meaning
            one letter can make, even in human languages.
            --
            Nathan Sokalski
            njsokalski@hotm ail.com
            有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


            "James Hahn" <jhahn@yahoo.co mwrote in message
            news:eTMFTtYOJH A.1164@TK2MSFTN GP03.phx.gbl...
            What did it used to be before it became a Windows/Desktop application?
            That may be part of the problem - when a project type is changed the
            default code that the designer relies on may not match what it expects to
            see, and could create problems when the designer goes to write the
            designer file. It might be simplest to recreate the application using the
            correct project type and copy the code across.
            >
            "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
            news:Oa5YbZXOJH A.4284@TK2MSFTN GP05.phx.gbl...
            >There is no Windows Form Designer in my case because this is now a
            >Windows/Desktop Application. I am writing a custom web control by
            >inheriting from System.Web.UI.C ontrol. Am I still misunderstandin g, or am
            >I just not allowed to have a property in the Property Grid that is of
            >type System.Drawing. Color? Thanks.
            >--
            >Nathan Sokalski
            >njsokalski@hotm ail.com
            >http://www.nathansokalski.com/
            >>
            >

            Comment

            • James Hahn

              #7
              Re: Control Properties of Type System.Drawing. Color

              OK, but unfortunately I have insufficient experience with custom web
              controls to offer much advice. I would have thought that if the property
              grid can see it as type System.Drawing. Color, which it must be to give you
              the enumerated list, then the designer should be able to handle it, whatever
              it's trying to do.

              Here's a site that might be helpful in tracking down what's happening:


              There's also an interesting tip here, right at the bottom:
              The home for technical questions and answers at Microsoft. Get started asking, answering, and browsing questions about products like .Net, Azure, or Teams.


              "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
              news:O%23fp9uiO JHA.1144@TK2MSF TNGP05.phx.gbl. ..
              Sorry, there was a typo in my previous posting. I meant to say:
              >
              "There is no Windows Form Designer in my case because this is not a
              Windows/Desktop Application."
              not
              "There is no Windows Form Designer in my case because this is now a
              Windows/Desktop Application."
              >
              Sorry for the misunderstandin g, it's amazing how much difference in
              meaning one letter can make, even in human languages.
              --
              Nathan Sokalski
              njsokalski@hotm ail.com
              有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

              >

              Comment

              Working...