资源简介
这个类是C# WPF功能的轮播图,只有一个类,简单。 用的时候 直接实例化,然后将需要轮播的List传进去,是参考网上的一个Demo,但是那个Demo耗内存,我修改了一下
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
namespace KthSelfDataServiceClient
{
public class ActiveImageAutoScroll : UserControl
{
private static List ScrollImages;
private Image imgAdvertPic = new Image()
{
Stretch = Stretch.Uniform
};
public Grid MainGrid = new Grid()
{
HorizontalAlignment = HorizontalAlignment.Stretch
VerticalAlignment = VerticalAlignment.Stretch
};
public WrapPanel btnPanel = new WrapPanel();
DoubleAnimation doubleAnimation = new DoubleAnimation(); //创建双精度动画对象
public static DependencyProperty advertPicList = DependencyProperty.Register(“advertPicList“
typeof(List) typeof(ActiveImageAutoScroll)
new Propertymetadata(new PropertyChangedCallback(ScrollImagesCreateActive)));
public static DependencyProperty advertPicStayTime = DependencyProperty.Register(“advertPicStayTime“
typeof(List) typeof(ActiveImageAutoScroll)
new Propertymetadata(new PropertyChangedCallback(loadAdvertStayTime)));
public static DependencyProperty isShowPageNumBtn = DependencyProperty.Register(“isShowPageNumBtn“
typeof(bool) typeof(ActiveImageAutoScroll)
new Propertymetadata(new PropertyChangedCallback(showPageNum)));
public List AdvertPicStayTime
{
get { return (List)GetValue(advertPicStayTime); }
set { SetValue(advertPicStayTime value); }
}
public List AdvertPicList
{
get { return (List)GetValue(advertPicList); }
set { SetValue(advertPicList value); }
}
public bool IsShowPageNumBtn
{
get { return (bool)GetValue(isShowPageNumBtn); }
set {
SetValue(isShowPageNumBtn value);
if (!IsShowPageNumBtn)
{
btnPanel.Visibility = Visibility.Collapsed;
}
else
{
btnPanel.Visibility = Visibility.Visible;
}
}
}
private static void ScrollImagesCreateActive(Dependencyobject sender DependencyPropertyChangedEventArgs e)
{
ActiveImageAutoScroll advertPicControl = (ActiveImageAutoScroll)sender;
if (e.Property == advertPicList)
{
advertPicControl.AdvertPicList = (List)e.NewValue;
ScrollImages = advertPicControl.AdvertPicList;
}
}
private static void loadAdvertStayTim
相关资源
- c#自定义透明按钮控件
- [c#]B+树的C#实现-BPlusTreePrototype
- 用C# 模仿 WINDOWS计算器 编写的 计算器
- WInform LED 时钟显示源码及Dll C#控件
- C# 通过COM端口读取数据
- C#桌面右下角弹出提示窗
- C#利用Remoting实现文件上传
- C#实现MQTT协议
- c#winform开发仓库管理系统,vs2010,m
- C#中DataSet的用法很详细
- C# 职员管理系统
- C#实现增删改查 学生管理系统
- C# 远程连接RDPdemo
- C#版winform中使用的ToggleButton
- CLR Via C#(第4版) 完整源代码
- WPF导入导出Excel
- 计算机图形学 扫描线种子填充算法
- C# 利用反射动态创建对象
- c#下post multipart/form-data和JSON
- C# OracleHelper
- c#微信企业号推送消息,亲测通过__(
- 自定义的ListView(C#) 可以在任意列
- C# 后台HTML代码拼接工具
- 基于C#的FTP客户端的实现(网络编程课
- c#获取系统和指定进程的CPU和内存占用
- 用WPF实现的加载数据的Loading动画...
- udp打洞源码服务端和客户端C# 实现
- [c#]wince平台下的GPIO接口使用测试程序
- C#中使用ACCESS数据库进行查询WinForm程
- 放大,缩小,图形显示C#+ARCENGINE.rar
评论
共有 条评论