Recent

Author Topic: how can i create range of color ?  (Read 2901 times)

majid.ebru

  • Hero Member
  • *****
  • Posts: 502
how can i create range of color ?
« on: September 22, 2017, 04:46:07 pm »
Hi

how can i create range of color (like blue or red or ....)?

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: how can i create range of color ?
« Reply #1 on: September 22, 2017, 05:45:48 pm »
One way is some variation on this:
Code: Pascal  [Select][+][-]
  1. procedure TTestMultiDialogForm.FormPaint(Sender: TObject);
  2. var
  3.   r: TRect;
  4. begin
  5.   r:=ClientRect;
  6.   r.Top:=r.CenterPoint.x;
  7.   Canvas.GradientFill(r, clNavy, clSkyBlue, gdHorizontal);
  8. end;
 

majid.ebru

  • Hero Member
  • *****
  • Posts: 502
Re: how can i create range of color ?
« Reply #2 on: September 24, 2017, 06:29:48 am »
Hi

Thank you

i have 4 questions:

1 - your code in my laptop worked correctly but this doesn't work in onther PC ?!?!

Code: Pascal  [Select][+][-]
  1. unit1.pas(36,12) Error: identifier idents no member "CenterPoint"

2 - can i use this code for Panel ? (can i  paint Panel whit this code?)

3 - can you splitte(separate) color code ?

4 - can you show show code of color like "$00939393" ?

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: how can i create range of color ?
« Reply #3 on: September 24, 2017, 09:41:42 am »
1 - your code in my laptop worked correctly but this doesn't work in onther PC ?!?!

Code: Pascal  [Select][+][-]
  1. unit1.pas(36,12) Error: identifier idents no member "CenterPoint"
CenterPoint and various other TRect properties were added only in a recent FPC version. For older FPC compiler versions with an older RTL/FCL you will have to calculate the centre point yourself. I'm sure you can do that.

2 - can i use this code for Panel ? (can i  paint Panel whit this code?)
Generate an OnPaint handler for your panel and do something like this:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Panel1Paint(Sender: TObject);
  2. begin
  3.   Panel1.Canvas.GradientFill(Panel1.ClientRect, RGBToColor($ff,$ff,$ff), RGBToColor($93,$93,$93),gdHorizontal);
  4. end;

3 - can you splitte(separate) color code ?
I don't understand what you mean.

4 - can you show show code of color like "$00939393" ?
See code above.

majid.ebru

  • Hero Member
  • *****
  • Posts: 502
Re: how can i create range of color ?
« Reply #4 on: September 24, 2017, 12:56:01 pm »
Thank you :) ;) :D

 

TinyPortal © 2005-2018