ImageSlider 是當鼠標hover時會出現有兩個單擊導航元素的圖像瀏覽控件。
要顯示圖像ImageSlider, 添加圖像到 ImageSlider.Images collection.
private void MainForm_Load(object sender, EventArgs e)
{
//Populate ImageSlider with images
mySlider.Images.Add(Image.FromFile(@"d:\data\1.jpg"));
mySlider.Images.Add(Image.FromFile(@"d:\data\2.jpg"));
mySlider.Images.Add(Image.FromFile(@"d:\data\3.jpg"));
mySlider.Images.Add(Image.FromFile(@"d:\data\4.jpg"));
//增加滑動圖像間隔 (default is 700 ms) 設置爲1200毫秒
mySlider.AnimationTime = 1200;
//Display images at the center of ImageSlider in their original size
mySlider.LayoutMode = DevExpress.Utils.Drawing.ImageLayoutMode.MiddleCenter;
//...
//Slide to the next image
mySlider.SlideNext();
}
mySlider.AllowLooping = true; // 允許循環 即播放到最後一張next爲第一張
mySlider.LayoutMode = DevExpress.Utils.Drawing.ImageLayoutMode.ZoomInside;//圖像縮放到Slider大小 如果爲ZoomOutsize,則圖像放大到自然
以下爲示例
Image appearance within an ImageSlider can be tuned via the ImageSlider.LayoutMode property. The ImageSlider.CurrentImageproperty specifies the currently displayed image. Image navigation via code is managed by the SliderBase.SlideNext andSliderBase.SlidePrev inherited methods. The SliderBase.AnimationTime property specifies the duration of the image sliding animation.
This control provides built-in touch-input device support.
The ImageSlider supports dynamic image upload. See the Virtual Mode topic to learn more.
The example demonstrates how to create and customize an ImageSlider control.
|
||||||
|