Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Changing OutlineStroke opacity

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

    Changing OutlineStroke opacity

    How does one change the opacity of the OutlineStroke?

    This does not work, because Pen is read-only:
    Code:
    rectangle.OutlineStroke.Pen.Opacity = 0.5

    #2
    Hello,

    Thank you for the post.

    For the overloads that you can pass a Brush to, you could use a SolidColorBrush which allows for an opacity. You could pass a SolidColorBrush to the "Brush" overload for this to affect the Outline.


    Code:
    Brush b = new SolidColorBrush(Color.FromRgb(255,0,0));
    b.Opacity = 0.3;
    b.Freeze();
    Rectangle rectangle = Draw.Rectangle(this, "Rect", 1, Close[1], 0, Close[0], b);
    For the OutlineStroke specifically after you have already drawn the object you could also use the following approach:

    Code:
    Rectangle rectangle = Draw.Rectangle(this, "Rect", 1, Close[1], 0, Close[0], Brushes.Red);
    
    Brush b = new SolidColorBrush(Color.FromRgb(0,0,0));
    b.Opacity = 0.3;
    b.Freeze();
    
    Stroke s =  new Stroke(b, 3);
    rectangle.OutlineStroke = s;
    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 03-30-2017, 03:22 PM.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by marcus2300, Today, 07:02 AM
    1 response
    7 views
    1 like
    Last Post NinjaTrader_ChristopherJ  
    Started by RaddiFX, Today, 01:25 PM
    2 responses
    5 views
    0 likes
    Last Post RaddiFX
    by RaddiFX
     
    Started by Dennys Vera, Today, 01:00 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by dtl-saw, 12-29-2022, 09:12 AM
    50 responses
    3,505 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by RichardSobe, Today, 01:00 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Working...
    X