I want show a different color of preview box for any value of TNXSpinEdit, so when the user change the TNXSpinEdit value I need draw the preview box with a simple rectangle with different color.
I have try this code but NOT work:
procedure TMyForm.mySpinEditCustomPreviewDraw(Sender: TObject;
PreviewRect: TRect);
var
colIndex: Integer;
col: TColor;
r: TRect;
begin
if (sneNome.Value > -1) and (sneNome.Value < 6) then
begin
colIndex := StrToInt(sneNome.AsString);
if colIndex > 0 then
begin
col := GetBoxColor(colIndex);
r := PreviewRect;
InflateRect(r, -2, -2);
with mySpinEdit.Canvas do
begin
Brush.Color := col;
FillRect(r);
end;
end;
end;
end;
Note TNXSpinEdit doesn't have DrawingOptions property...











