WPF图片浏览,滚动,拖拽控件
整理图片拖拽浏览,滚动控件
不多说,上图
可以单独定义图片大小,显示透明度,等,都提供给外部调用
public List<WpfEToolkits.MutiImages.syPoImage> sls = new List<syPoImage>();
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q1.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q2.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q3.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q4.jpg", "150"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q1.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q2.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q3.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q4.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q1.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q2.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q3.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q4.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q1.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q2.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q3.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q4.jpg"));
esImages.Width = 600;
esImages.ImagesSource = sls;
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q2.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q3.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q4.jpg", "150"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q1.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q2.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q3.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q4.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q1.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q2.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q3.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q4.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q1.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q2.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q3.jpg"));
sls.Add(new syPoImage(Environment.CurrentDirectory + "\\images\\q4.jpg"));
esImages.Width = 600;
esImages.ImagesSource = sls;
提供一个特殊事件,鼠标悬停在某张图片后3秒触发
代码如下
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
private void Window_Loaded(object sender, RoutedEventArgs e)
{
esImages.eventTimer += new MutiImage.eventTime(esImages_eventTimer);
//30为 3秒,单位为0.1秒
esImages.eTimerStart(30);
}
//事件
void esImages_eventTimer(Image imgCurr)
{
MessageBox.Show("test image : " + imgCurr.Source.ToString());
}
//还有鼠标拖拽事件
private void Window_MouseMove(object sender, MouseEventArgs e)
{
esImages.tsUnSeorcs(e);
}
//别忘了析构
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
esImages.eTimerStop();
}
{
esImages.eventTimer += new MutiImage.eventTime(esImages_eventTimer);
//30为 3秒,单位为0.1秒
esImages.eTimerStart(30);
}
//事件
void esImages_eventTimer(Image imgCurr)
{
MessageBox.Show("test image : " + imgCurr.Source.ToString());
}
//还有鼠标拖拽事件
private void Window_MouseMove(object sender, MouseEventArgs e)
{
esImages.tsUnSeorcs(e);
}
//别忘了析构
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
esImages.eTimerStop();
}