当前位置: 代码迷 >> .NET组件控件 >> C#中的图片显示,该如何解决
  详细解决方案

C#中的图片显示,该如何解决

热度:127   发布时间:2016-05-04 23:21:45.0
C#中的图片显示
我有一组图片想让他在一个窗口中滚动显示出来,请问有没有例子可以参考的,或者详细的步骤?

效果跟js特效那样
------解决方案--------------------
可以通过定位picture组件的loaction
this.pictureBox1.Location
或者drawimage将图片动态绘制在界面上
------解决方案--------------------
水平滚动图片显示实例
//ListView绑定图片显示
 <asp:ListView ID="lvPhoto" runat="server" GroupItemCount="4" DataKeyNames="ID" >
        <LayoutTemplate>
            <div ID="divPhoto" runat="server" align="center" 
                style="width:650px; height:0px; margin:8px 0px 2px 10px; padding:8px 0px 2px 10px; text-align:center">
                <div ID="groupPlaceholder" runat="server">
                </div>
            </div>            
        </LayoutTemplate>
        <GroupTemplate>
            <div ID="tr" style="width:100%;text-align:center">
                <div ID="itemPlaceholder" runat="server">
                </div>
            </div>
            <div ID="div1" style="height:5px"></div>
            <div ID="div2" style="height:20px; line-height:20px;"></div>
        </GroupTemplate>
        <ItemTemplate>
            <div style="width:158px;float:left">
                <div style="width:155px; height:119px; background-image:url(images/001_07.gif);">
                    <div style="width:100%; height:10px; line-height:10px;"></div>
                    <asp:LinkButton ID="lkbImg" runat="server" CommandArgument='<%# Eval("Url")%>' CommandName='<%# Eval("Descript")%>' oncommand="lkbImg_Command">
                        <img src='UpSmall/<%# Eval("Url")%>' alt='<%# Eval("Descript")%>' style="border-width:0px" width="133px" height="100px"/>
                    </asp:LinkButton> 
                </div>//CodeGo.net/
                <div align="center" style="width:100%">
                    <%# Eval("Title")%>    
                    <br />                              
                </div>
            </div>
        </ItemTemplate>
    </asp:ListView>
//触发播放图片功能事件描述等
 public int categoryID = -1;
    public string categoryName = string.Empty;
    Album am = new Album();
    //Page_PreRender事件,能防止单击两次按钮(这里指的是播放图片的按钮)来激发事件
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (Request.Params["CategoryID"] != null)
        {
            categoryID = Int32.Parse(Request.Params["CategoryID"].ToString());
            Session["categoryID"] = Request.Params["CategoryID"].ToString();
            if (Request.Params["CategoryName"] != null)
            {
                categoryName = lb_Cname.Text = Request.Params["CategoryName"].ToString();
  相关解决方案