|
<%@ Page Language="C#" Trace="false" %>
<%@ Register TagPrefix="PhilipSoft" TagName="ThumbList" Src="ThumbList.ascx" %>
<%@ import Namespace="System.Configuration" %>
<script runat="server">
int width,height;
protected void Page_Load(Object sender, EventArgs e)
{
String path,filter;
if(!IsPostBack) {
// create thumbnail-size combo data
ArrayList arSizes = new ArrayList();
for(int i=50; i<=500; i+=50)
arSizes.Add(String.Format("{0}x{1}",i,i));
cbThumbSize.DataSource=arSizes;
cbThumbSize.DataBind();
// create columns combo data
ArrayList arCols = new ArrayList();
for(int i=1; i<=10; i++)
arCols.Add(i.ToString());
cbColumns.DataSource=arCols;
cbColumns.DataBind();
// initial properties
cbThumbSize.SelectedIndex=3; cbColumns.SelectedIndex=3;
chkSaveThumbs.Checked = (ConfigurationSettings.AppSettings["DefaultSaveThumbnails"]=="true");
txtPath.Text = Request.ApplicationPath.TrimEnd('/')+"/images/";
txtFilter.Text = ConfigurationSettings.AppSettings["DefaultFilter"];
if(txtFilter.Text=="") txtFilter.Text = "*.*";
chkStretch.Checked = (ConfigurationSettings.AppSettings["DefaultAllowStretch"]=="true");
int pagesize; try {
pagesize = int.Parse(ConfigurationSettings.AppSettings["DefaultPageSize"]);
} catch(ArgumentNullException ex) { pagesize=10; }
txtPagesize.Text = pagesize.ToString();
chkUseCOMobj.Checked = (ConfigurationSettings.AppSettings["EnableThumbnailCOMobject"]=="true");
} // if not postback
String sSize = cbThumbSize.SelectedItem.Text;
int pos = sSize.IndexOf('x');
width = int.Parse(sSize.Substring(0,pos));
height = int.Parse(sSize.Substring(pos+1));
// set properties of thumbnail control
ThumbList1.VPath=txtPath.Text;
ThumbList1.Filter=txtFilter.Text;
ThumbList1.SaveThumbnails = chkSaveThumbs.Checked;
ThumbList1.Width = width;
ThumbList1.Height = height;
ThumbList1.HeaderTitle =
"<h3>Thumbnail images of directory " + ThumbList1.VPath + "</h3>";
ThumbList1.Columns = int.Parse(cbColumns.SelectedItem.Text);
ThumbList1.ShowFilenames = chkShowFiles.Checked;
ThumbList1.Sort = chkSort.Checked;
ThumbList1.AllowPaging = chkPaging.Checked;
ThumbList1.PageSize = int.Parse(txtPagesize.Text);
//ThumbList1.HideNavBar = true; ThumbList1.CurPage=1; // test
ThumbList1.AllowStretch = chkStretch.Checked;
ThumbList1.UseCOMobj = chkUseCOMobj.Checked;
ThumbList1.Bevel = chkBevel.Checked;
ThumbList1.ItemBackColor = System.Drawing.Color.White;
// new properties
ThumbList1.ShowComments = chkShowComments.Checked;
ThumbList1.AllowEdit = chkAllowEdit.Checked;
//
} //page_load
void chkPaging_CheckedChanged(Object sender, EventArgs e) {
txtPagesize.Enabled = chkPaging.Checked;
}
</script>
<html>
<head>
<title>PhilipSoft Thumbnail control test page</title>
</head>
<body style="FONT: 9pt verdana">
<form runat="server">
<p>
</p>
<h1>.NET ThumbList control test page
</h1>
<p>
<br />
Path:<asp:TextBox id="txtPath" runat="server" Width="251px" BackColor="Linen"></asp:TextBox>
Filter:<asp:TextBox id="txtFilter" runat="server" Width="93px" BackColor="Linen"></asp:TextBox>
<br />
<br />
Select thumbnail size:
<asp:DropDownList id="cbThumbSize" runat="server" BackColor="Linen"></asp:DropDownList>
Columns:
<asp:DropDownList id="cbColumns" runat="server" BackColor="Linen"></asp:DropDownList>
</p>
<p>
<asp:CheckBox id="chkSaveThumbs" runat="server" Text="Save thumbnails"></asp:CheckBox>
<asp:CheckBox id="chkShowFiles" runat="server" Text="Show filenames" AutoPostBack="True"></asp:CheckBox>
<asp:CheckBox id="chkSort" runat="server" Text="Sort" AutoPostBack="True"></asp:CheckBox>
<asp:CheckBox id="chkPaging" runat="server" Text="Allow paging" AutoPostBack="True" Checked="True" OnCheckedChanged="chkPaging_CheckedChanged"></asp:CheckBox>
Pagesize:
<asp:TextBox id="txtPagesize" runat="server" Width="37px" BackColor="Linen">3</asp:TextBox>
</p>
<p>
<asp:CheckBox id="chkStretch" runat="server" Text="Stretch thumbnails" AutoPostBack="True"></asp:CheckBox>
<asp:CheckBox id="chkBevel" runat="server" Text="Beveled" AutoPostBack="True"></asp:CheckBox>
<asp:CheckBox id="chkUseCOMobj" runat="server" Text="Use COM object" AutoPostBack="True"></asp:CheckBox>
<p>
<asp:CheckBox id="chkShowComments" runat="server" Text="Show Comments" Checked="True" AutoPostBack="True"></asp:CheckBox>
<asp:CheckBox id="chkAllowEdit" runat="server" Text="Allow editing" Checked="True" AutoPostBack="True"></asp:CheckBox>
<asp:Button id="cmdShow" runat="server" Width="156px" Text="Regenerate thumbnails"></asp:Button>
</p>
<br />
<PhilipSoft:ThumbList id="ThumbList1" runat="server"></PhilipSoft:ThumbList>
<br />
</form>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software developer and Microsoft Trainer, Athens, Greece (MCT, MCSD.net, MCSE 2003, MCDBA 2000,MCTS, MCITP, MCIPD).