Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BackColorAll and non standard colors

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

    BackColorAll and non standard colors

    I use a gradient brush to make the charts look a little easier on the eye.
    I have tried everything I know to color the whole chart and not just the chart panel and have been unsuccessful.

    Code:
    float[] relativeIntensities = { 0.7f, 0.5f, 0.7f, 0.5f, 0.1f };
    float[] relativePositions   = { 0.0f, 0.2f, 0.4f, 0.8f, 1.0f };
    
    Blend myBlend 		= new Blend();
    myBlend.Factors 	= relativeIntensities;
    myBlend.Positions	= relativePositions;
    	
    LinearGradientBrush linGrBrush = new LinearGradientBrush (
    			new Point(0, bounds.X),
    			new Point(0,bounds.Right),
    			Color1,
    			Color2);
    	
    			linGrBrush.Blend = myBlend;
    			
    			int myheight = ChartControl.Bottom;// - bounds.Height
    			Pen pen = new Pen(linGrBrush);	
    graphics.FillRectangle(linGrBrush, bounds.X , bounds.Y, ChartControl.Right,ChartControl.Bottom  );
    I thought I might be able to take the r,g,b elements once I had painted the background and then just use that in BackColorAll - but to no avail.

    Could you give me an idea of how to get the ENTIRE form width and height? It's doing my head in.

    #2
    Mindset, I'm sorry - those methods are unfortunately not in supported scope - I tried a quick BackColorall call supplying custom ARGB values and do not see an issue -

    BackColorAll = Color.FromArgb(50, 20, 90, 150);

    Comment


      #3
      argb

      I suspected this would be beyond support.

      I can get a custom color that way but it's how to get my gradientbrush and convert it to a color. I thought maybe using

      Code:
      // having already filled my rectangle
      byte bRed 	= (byte)~(base.ChartControl.BackColor.R);
                  byte bGreen = (byte)~(base.ChartControl.BackColor.G);
      			byte bBlue 	= (byte)~(base.ChartControl.BackColor.B);
      BackColorAll = Color.FromArgb(bRed,bGreen,bBlue);
      but it's taking the original background color property and not my painted rectangle.
      What would be so much easier is simply to know how to define my rectangle as the whole area and not just the single panel? That's really the question if you can answer it?

      Comment


        #4
        Mindset, as far as I know the rectangle would unfortunately not span across panels.

        Comment


          #5
          Long time ago

          I know this is from ages ago but I haven't resolved it...

          I would love to know the boundaries of the form ie all panels. The reason - if I place my indicator in both panels the axis areas and a small boundary between panels does not get painted. Very frustrating and I can't establish how to simply copy the BackColorAll method. BackColorAll doesn't take a non standard color - far as I can tell.
          Any help appreciated.

          Attached Files

          Comment


            #6
            Mindset, what custom color are you attempting to use for BackColorAll - my prior comment still holds true, any color I define with the .FromArgb works in my testing for it here.

            Comment


              #7
              linear gradient brush

              I am using a linear gradient brush - a mix of two colors.
              The alternative would be to convert this color to an rgb - but I don't know how to do that.

              Here is my created color code.
              I have looked on msdn for a conversion method but can't seem to get it.
              Code:
              float[] relativeIntensities = { 0.0f, 0.25f, 0.5f, 0.8f, 1.0f };//top to bottom - higher nos = higher amt of Color2
              
              			float[] relativePositions   = { 0.0f, 0.2f, 0.4f, 0.6f, 1.0f };// change these to alter 'mix'NB must match array number above
              
              			Blend myBlend 		= new Blend();
              			myBlend.Factors 	= relativeIntensities;
              			myBlend.Positions	= relativePositions;
              	 // Get the bounds of the screen.
                //  Rectangle screenRectangle = Screen.PrimaryScreen.Bounds;no change
              			LinearGradientBrush linGrBrush = new LinearGradientBrush (
              			new Point(0, bounds.X),
              			new Point(0,bounds.Width),
              			Color1,
              			Color2);
              			linGrBrush.Blend = myBlend;
              			
              			Pen pen = new Pen(linGrBrush);	
              			//RectangleF rect = graphics.VisibleClipBounds;// no change
              			
              			graphics.FillRectangle(linGrBrush,bounds)

              Comment


                #8
                I don't think a conversion could exist here, since a color is not the same as a gradient brush, the color effect you create with the brush couldn't be expressed as color in ARGB components I believe.

                Comment


                  #9
                  BackColor

                  So that leaves the BackColorAll method. I had assumed it was just using bounds but obviously it's a little more involved than that.
                  Is it possible to 'reveal' this method?

                  Comment


                    #10
                    I'll check into that Mindset.

                    Comment


                      #11
                      Originally posted by NinjaTrader_Bertrand View Post
                      I'll check into that Mindset.
                      Unfortunately we could not make that available Mindset.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      576 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      334 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