Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using a variable to supply a color to DrawRegion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using a variable to supply a color to DrawRegion

    I would like my DrawRegion to change color based on a set of criteria, so I created a variable to hold the color I want:

    string HighFillColor = "Color.LightGray";

    However I get a compile error using this variable in my DrawRegion:


    DrawRegion(FillCounter.ToString()+"FillTag",HighCounter,0,ROCPlot,HighLineValue[0],HighFillColor,HighFillColor,3);

    I have tried setting HighFillColor to just "LightGray" and that doesn't complie.

    I have also tried System.Drawing.Color(HighFillColor) and that didn't work either.

    What is the correct syntax for setting a color using a variable in DrawRegion?

    Thanks.

    #2
    Originally posted by Grasul View Post
    I would like my DrawRegion to change color based on a set of criteria, so I created a variable to hold the color I want:

    string HighFillColor = "Color.LightGray";

    However I get a compile error using this variable in my DrawRegion:


    DrawRegion(FillCounter.ToString()+"FillTag",HighCounter,0,ROCPlot,HighLineValue[0],HighFillColor,HighFillColor,3);

    I have tried setting HighFillColor to just "LightGray" and that doesn't complie.

    I have also tried System.Drawing.Color(HighFillColor) and that didn't work either.


    What is the correct syntax for setting a color using a variable in DrawRegion?

    Thanks.
    Hi Grasul, what newfangled stuff has Osi come up with on TTW recently?

    On to your question, your code will not compile because color is not a string. You could convert it with a parser, but much simpler is to declare it as a color in the first place thus:
    Code:
    Color HighFillColor = Color.LightGray;
    Last edited by koganam; 09-21-2011, 06:17 PM.

    Comment


      #3
      Thank you very much.

      Come by and check, Osi seems to be getting into his typical amount of trouble..

      And btw, a pox on computer languages where Capitalization matters for syntax. I have enough trouble with spelling.
      Last edited by Grasul; 09-21-2011, 06:26 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      164 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      318 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      246 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X