Хотел сделать эффект что бы при наведении Item увеличивался, с Item манимуляции ни к чему не привели так как он оказывается за другими Itemами, сделал создание в ListBox контрола. Все работает но как позиция моего контрола становиться большее 1500 контрол исчезает((
procedure TForm1.VideoListChange(Sender: TObject);
var
scb:TScrollBar;
posVer,posIt,posNiz:Single;
po:Real;
bmp:TBitmap;
begin
po:= (VideoList.ItemIndex div vidcolumn)* VideoList.ItemHeight;
FocusItem.Position.X:=(((VideoList.ItemIndex mod vidcolumn)* VideoList.ItemWidth))*mashX+9;
FocusItem.Position.Y:=(po)*mashY+9;
if VideoList.Items.Count-1>=predit then VideoList.ItemByIndex(predit).Opacity:=1;
scb:=VideoList.FindStyleResource('vscrollbar') as TScrollBar;
posIt:= (VideoList.ItemIndex div vidcolumn) * VideoList.ItemHeight;
posVer:=scb.Value;
posNiz:=scb.Value+VideoList.Height;
if posIt>posNiz-VideoList.ItemHeight then
begin
TAnimator.AnimateFloat(scb,'Value',(VideoList.ItemIndex div 5) * VideoList.ItemHeight-VideoList.Height+VideoList.ItemHeight,0.15);
end;
if posIt<posVer then
begin
TAnimator.AnimateFloat(scb,'Value',(VideoList.ItemIndex div 5) * VideoList.ItemHeight,0.15);
end;
VideoList.ItemByIndex(VideoList.ItemIndex).StylesData['Rectangle2.Fill.Color']:=$CF0C0C0C;
VideoList.ItemByIndex(VideoList.ItemIndex).StylesData['Icon.Opacity']:=1;
FocusItem.Align:=TAlignLayout.None;
bmp:=TBitmap.Create;
bmp.Assign(VideoList.ItemByIndex(VideoList.ItemIndex).ItemData.Bitmap);
VideoList.ItemByIndex(VideoList.ItemIndex).Opacity:=0;
po:= ( ((VideoList.ItemIndex div vidcolumn)* VideoList.ItemHeight));
FocusItem.Position.X:=(((VideoList.ItemIndex mod vidcolumn)* VideoList.ItemWidth))*mashX+9;
FocusItem.Position.Y:=(po)*mashY+9;
predit:=VideoList.ItemIndex;
ItemIcon.Fill.Bitmap.Bitmap:=Bmp;
ItemText.Text:=VideoList.ItemByIndex(VideoList.ItemIndex).ItemData.Text;
FocusItem.Width:=VideoList.ItemWidth-18;
FocusItem.Height:=VideoList.ItemHeight-18;
FocusItem.Visible:=true;
FocusItem.Opacity:=1;
FocusItem.BringToFront;
TAnimator.AnimateFloat(FocusItem,'Width',FocusItem.Width+(14*(FocusItem.Width/FocusItem.Height)),0.25);
TAnimator.AnimateFloat(FocusItem,'Height',FocusItem.Height+14,0.25);
Title.Text:=FloatToStr(FocusItem.Position.X)+''+FloatToStr(FocusItem.Position.y);
TAnimator.AnimateFloat(FocusItem,'Position.X',FocusItem.Position.X-(7*(FocusItem.Width/FocusItem.Height)),0.25);
TAnimator.AnimateFloat(FocusItem,'Position.Y',FocusItem.Position.Y-7,0.25);
bmp.Free;
end;
Вопрос
OnePeople
Хотел сделать эффект что бы при наведении Item увеличивался, с Item манимуляции ни к чему не привели так как он оказывается за другими Itemами, сделал создание в ListBox контрола. Все работает но как позиция моего контрола становиться большее 1500 контрол исчезает((
procedure TForm1.VideoListChange(Sender: TObject); var scb:TScrollBar; posVer,posIt,posNiz:Single; po:Real; bmp:TBitmap; begin po:= (VideoList.ItemIndex div vidcolumn)* VideoList.ItemHeight; FocusItem.Position.X:=(((VideoList.ItemIndex mod vidcolumn)* VideoList.ItemWidth))*mashX+9; FocusItem.Position.Y:=(po)*mashY+9; if VideoList.Items.Count-1>=predit then VideoList.ItemByIndex(predit).Opacity:=1; scb:=VideoList.FindStyleResource('vscrollbar') as TScrollBar; posIt:= (VideoList.ItemIndex div vidcolumn) * VideoList.ItemHeight; posVer:=scb.Value; posNiz:=scb.Value+VideoList.Height; if posIt>posNiz-VideoList.ItemHeight then begin TAnimator.AnimateFloat(scb,'Value',(VideoList.ItemIndex div 5) * VideoList.ItemHeight-VideoList.Height+VideoList.ItemHeight,0.15); end; if posIt<posVer then begin TAnimator.AnimateFloat(scb,'Value',(VideoList.ItemIndex div 5) * VideoList.ItemHeight,0.15); end; VideoList.ItemByIndex(VideoList.ItemIndex).StylesData['Rectangle2.Fill.Color']:=$CF0C0C0C; VideoList.ItemByIndex(VideoList.ItemIndex).StylesData['Icon.Opacity']:=1; FocusItem.Align:=TAlignLayout.None; bmp:=TBitmap.Create; bmp.Assign(VideoList.ItemByIndex(VideoList.ItemIndex).ItemData.Bitmap); VideoList.ItemByIndex(VideoList.ItemIndex).Opacity:=0; po:= ( ((VideoList.ItemIndex div vidcolumn)* VideoList.ItemHeight)); FocusItem.Position.X:=(((VideoList.ItemIndex mod vidcolumn)* VideoList.ItemWidth))*mashX+9; FocusItem.Position.Y:=(po)*mashY+9; predit:=VideoList.ItemIndex; ItemIcon.Fill.Bitmap.Bitmap:=Bmp; ItemText.Text:=VideoList.ItemByIndex(VideoList.ItemIndex).ItemData.Text; FocusItem.Width:=VideoList.ItemWidth-18; FocusItem.Height:=VideoList.ItemHeight-18; FocusItem.Visible:=true; FocusItem.Opacity:=1; FocusItem.BringToFront; TAnimator.AnimateFloat(FocusItem,'Width',FocusItem.Width+(14*(FocusItem.Width/FocusItem.Height)),0.25); TAnimator.AnimateFloat(FocusItem,'Height',FocusItem.Height+14,0.25); Title.Text:=FloatToStr(FocusItem.Position.X)+''+FloatToStr(FocusItem.Position.y); TAnimator.AnimateFloat(FocusItem,'Position.X',FocusItem.Position.X-(7*(FocusItem.Width/FocusItem.Height)),0.25); TAnimator.AnimateFloat(FocusItem,'Position.Y',FocusItem.Position.Y-7,0.25); bmp.Free; end;0 ответов на этот вопрос
Рекомендуемые сообщения
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.