Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Rectangle Area && Opacity

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

    Draw.Rectangle Area && Opacity

    Hey NT,

    I believe I found a bug for y'all.

    On Draw.Rectangle it allows you to set the color for the area and opacity level, however it only draws the line and not the area at all. See code and picture.

    Code:
    Draw.Rectangle(this,"Line"+CurrentBar.ToString()+i,true,0,(MAX(High,Period)[0]) - ((i)*TickSize*BoxSize),1,(MAX(High,Period)[0]) - ((i+1)*TickSize*BoxSize),Brushes.Gray,Brushes.DimGray,5);
    This code should be drawing the area of the rectangle, but only draws the outline.

    Cheers,

    Sody
    Attached Files

    #2
    Draw Square

    Also, a suggestion!

    Draw.Square is awesome for Point and Figure, but there is no opacity parameter.. I would suggest adding one, us power users might really like it.

    Sody
    Attached Files

    Comment


      #3
      This may work,

      Create a separate Brush:
      Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.Red);
      brushBid.Opacity=0.3;

      This works for me with some of the SharpDX stuff, don't see why the Brush wouldn't work for the lines as well.

      Comment


        #4
        Originally posted by NJA_MC View Post
        This may work,

        Create a separate Brush:
        Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.Red);
        brushBid.Opacity=0.3;

        This works for me with some of the SharpDX stuff, don't see why the Brush wouldn't work for the lines as well.
        Getting closer maybe...

        Failed to call OnRender() for chart object 'Square': The calling thread cannot access this object because a different thread owns it'
        Code:
        Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.DimGray);
        			brushBid.Opacity=0.3;
        Code:
        Draw.Square(this,"tag"+CurrentBar.ToString()+i,true,0,(MAX(High,Period)[0]) - ((i)*TickSize*BoxSize),brushBid);
        Might need a new thread? Dispatch.BeginInvoke?

        Sody
        Last edited by SodyTexas; 05-12-2015, 12:52 PM.

        Comment


          #5
          I am not sure you can access the Draw functions in the OnRender... You will likely need to use the SharpDX functions.

          Here is a FillRectangle example:
          RenderTarget.FillRectangle(new RectangleF(chartControl.CanvasRight, chartScale.GetYByValue(key.Key) - (height / 2), (int)-(key.Value * barLengthScale), height), brushAsk.ToDxBrush(RenderTarget));
          Last edited by NJA_MC; 05-12-2015, 01:29 PM.

          Comment


            #6
            Originally posted by NJA_MC View Post
            I am not sure you can access the Draw functions in the OnRender... You will likely need to use the SharpDX functions.

            Here is a FillRectangle example:
            RenderTarget.FillRectangle(new RectangleF(chartControl.CanvasRight, chartScale.GetYByValue(key.Key) - (height / 2), (int)-(key.Value * barLengthScale), height), brushAsk.ToDxBrush(RenderTarget));
            Thanks, SharpDX functions worked..
            Attached Files

            Comment


              #7
              I'd recommend using SharpDX stuff directly rather than the draw methods for such tasks. For power users such as yourself, you can always create your own draw object, and in fact, implement your own signatures to be called from other indicators, etc...
              MatthewNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, Yesterday, 10:06 AM
              0 responses
              14 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              11 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              9 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              4 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              31 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X