Пример #1
0
    protected void btnShowPictures_Click(object sender, EventArgs e)
    {
        ServiceInterface server = new ServiceInterface();
        List<WebPicture> pics = server.GetAllPicturesByPath(cbPicturePath.SelectedValue);
        int width; int height;
        Utils.GetThumbDimensions(out width, out height);
        foreach (WebPicture pic in pics)
        {
          Image thumb = new Image();
          thumb.ImageUrl = Utils.GetStreamURL()+"/PictureStreamer.aspx?thumb=" + Server.UrlEncode(pic.file);
          thumb.ImageAlign = ImageAlign.Top;
          thumb.AlternateText = System.IO.Path.GetFileNameWithoutExtension(pic.file) + Environment.NewLine + pic.taken.ToString();
          thumb.BorderStyle = BorderStyle.Outset;
          thumb.BorderWidth = new Unit(1);

          thumb.Width = new Unit(width);
          thumb.Height = new Unit(height);
          thumb.Attributes.Add("hspace", "4");
          thumb.Attributes.Add("vspace", "4");
          thumb.Attributes.Add("onclick", "window.open('"+Utils.GetStreamURL()+"/PictureViewer.aspx?picture=" + Server.UrlEncode(pic.file) + "');");
          thumb.Style.Add("cursor", "hand");
          picBox.Controls.Add(thumb);
        }
    }