像Itunes一样的图像流控制 [英] Image Flow Control like Itunes

查看:74
本文介绍了像Itunes一样的图像流控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解是否有人知道如何创建一个控件,使用户可以查看图片,专辑封面等.
我希望它可以与拖放事件一起使用.

搜索完网络后,我仅在 http://www.weberdesignlabs.com/blog/2007/09/flash-itunes-cover-flow [

I would like to find out if anybody knows how to create a control that enables a user to view pictures, album art, etc.
I want it to work with a drag-drop kind of event.

After searching the web I have only found a control created with Flash, "iTunes Cover Flow" on http://www.weberdesignlabs.com/blog/2007/09/flash-itunes-cover-flow[^]

Thanks...

推荐答案

看看这个WPF控件:

http://www.codeproject.com/Catalogs/3590/WPF-Coverflow-by- Mindscape.aspx [ ^ ]

单击该图像,它将带您到相关的网站,您应该可以在该网站上下载其控件库.我自己没用过,但是看起来不错:)

如果您想在网上进行此操作,则只能在Flash中完成; P

希望这会有所帮助,

Ed
Have a look at this WPF control:

http://www.codeproject.com/Catalogs/3590/WPF-Coverflow-by-Mindscape.aspx[^]

Click the image, it will take you to the relevant website where you should be able to download their control library. Not used it myself, but it looks good :)

If you''re looking to do this on the web, it can only be done in flash ;P

Hope this helps,

Ed


感谢您的帮助.
我还找到了一些有用的源代码的链接,供想要使用OverFlow的任何人使用.

Thanks for the help.
I also found a link to some useful source code, for anybody that wants to use OverFlow.

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
using Balder.Core.Math;
namespace Coverflow{
  public partial class CoverFlow : UserControl
  {
    public static DependencyProperty CoverProperty =
      DependencyProperty.Register("Cover", typeof(double), typeof(CoverFlow), new PropertyMetadata(0d, new PropertyChangedCallback(OnCoverChanged)));

    public const double CameraYPos = 0;
    public const double CameraZPos = 100;
    public const double CoverSpace = 5d;
    public const double CoverChangeDuration = 500d;
    public const double CurrentCoverOpeningSpace = 5d;
    private List<Cover> _covers;
    private int _currentCoverIndex;
    private Storyboard _coverStoryboard;
    private DoubleAnimation _coverAnimation;

    public CoverFlow()
    {
      InitializeComponent();
      this._covers = new List<Cover>();
      this._camera.Position = new Vector(0, CameraYPos, CameraZPos);
      this._coverStoryboard = new Storyboard();
      this._coverAnimation = new DoubleAnimation();
      this._coverAnimation.Duration = TimeSpan.FromMilliseconds(CoverChangeDuration);
      this._coverStoryboard.Children.Add(this._coverAnimation);
      Storyboard.SetTarget(this._coverAnimation, this);
      Storyboard.SetTargetProperty(this._coverAnimation, new PropertyPath("(CoverFlow.Cover)"));
    }
    public void AddCover()
    {
      double coverPos = ((double)this._covers.Count) * CoverSpace;
      Cover cover = new Cover();
      this._covers.Add(cover);
      this._viewport.Children.Add(cover);
      cover.Position = new Vector(coverPos, 0, 0);
      this.Update();
    }
    public void Update()
    {
      int index = 0;
      foreach (var cover in this._covers)
      {
        if (index == this._currentCoverIndex)
        {
          cover.MoveToFront();
        }
        else if (index < this._currentCoverIndex)
        {
          cover.MoveToLeft();
        }
        else
        {
          cover.MoveToRight();
        }
        index++;
      }
    }
    private int CurrentCoverIndex
    {
      get
      {
        return this._currentCoverIndex;
      }
      set
      {
        this._currentCoverIndex = value;
        this.Update();
      }
    }
    public double Cover
    {
      get
      {
        return (double)this.GetValue(CoverProperty);
      }
      set
      {
        this.SetValue(CoverProperty, value);
      }
    }

    public static void OnCoverChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
    {
      CoverFlow coverFlow = (CoverFlow)obj;

      coverFlow.CurrentCoverIndex = Convert.ToInt32(e.NewValue);
      var currentCover = ((double)e.NewValue);


      double xpos = ((double)e.NewValue) * CoverSpace;
      coverFlow._camera.Target = new Vector(xpos, 0, 0);
      coverFlow._camera.Position = new Vector(xpos, CameraYPos, CameraZPos);
      coverFlow.Cover = (double)e.NewValue;
    }
    public int CurrentlyBeingMovedTo
    {
      get; private set;
    }
    public void MoveTo(int cover)
    {
      this.CurrentlyBeingMovedTo = cover;
      this._coverAnimation.To = (double)cover;
      this._coverStoryboard.Begin();
    }
    public void MoveNext()
    {
      int next = this.CurrentlyBeingMovedTo + 1;
      if( next >= this._covers.Count )
      {
        next = this._covers.Count - 1;
      }
      this.MoveTo(next);
    }
    public void MovePrevious()
    {
      int next = this.CurrentlyBeingMovedTo - 1;
      if( next < 0 )
      {
        next = 0;
      }
      this.MoveTo(next);
    }
  }
}



再次感谢.



Thanks again.


这篇关于像Itunes一样的图像流控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆