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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      574 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      333 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X