و ایجاد کاشی در زمان اجرا devexpress کامپوننت دلفی
و ایجاد کد رنگ رندوم
procedure TDesktopDemoMainForm.Button1Click(Sender: TObject);
var AItem: TdxTileControlItem;
sizeItem:integer;
begin
AItem:= dxTileControl1.items.add;
with AItem do
begin
IsLarge := True;
AItem.Name:='a'+inttostr(random(4000));
AItem.Text1.value:='test';
sizeItem:=random(4) ;
case sizeItem of
// 1:AItem.Size:=tcisSmall;
1:AItem.Size:=tcisLarge;
2:AItem.Size:=tcisRegular;
3:AItem.Size:=tcisLarge;
4: AItem.Size:=tcisExtraLarge;
end;
text1.font.Size:=12;
glyph.ImageIndex:=random(9) ;
group:=dxTileControl1Group1;
style.GradientBeginColor:=GenerateRandomColor;
end;
end;
function GenerateRandomColor(const Mix: TColor = clWhite): TColor;
var
Red, Green, Blue: Integer;
begin
Red := Random(256);
Green := Random(256);
Blue := Random(256);
Red := (Red + GetRValue(ColorToRGB(Mix))) div 2;
Green := (Green + GetGValue(ColorToRGB(Mix))) div 2;
Blue := (Blue + GetBValue(ColorToRGB(Mix))) div 2;
Result := RGB(Red, Green, Blue);
end;