|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
语言是不是不是最重要的?<%@PageLanguage="c#"Debug="true"Trace="true"%>
<%@ImportNamespace="System.IO"%>
<%@ImportNamespace="System.Drawing"%>
<%@ImportNamespace="System.Drawing.Imaging"%>
<html>
<scriptrunat=server>
voidUploadBtn_Click(Objectsender,EventArgse){
Stringfilename;
Stringfilename1;
String[]filename2;
intq;
filename=UploadFile.PostedFile.FileName;
filename2=filename.Split(newChar[]{});
q=filename2.GetUpperBound(0);
filename1=filename2[q];
dis.Text="上传文件名:"+filename1+"<br>";
UploadFile.PostedFile.SaveAs(Server.MapPath(filename1));
ImageEditor.Visible=true;
dis.Text+="文件巨细:"+UploadFile.PostedFile.ContentLength+"字节数";
Image1.Src=filename1;
}
voidUpdateBtn_Click(Objectsender,EventArgse){
Stringfilename1;
filename1=Image1.Src;
System.Drawing.Imageimage=System.Drawing.Image.FromFile(Server.MapPath(filename1));
System.Drawing.Imagenewimage=newBitmap(image.Width,image.Height,PixelFormat.Format32bppRGB);
Graphicsg=Graphics.FromImage(newimage);
g.DrawImage(image,0,0,image.Width,image.Height);
Fontf=newFont(FontType.SelectedItem.Text,Int32.Parse(FontSize.SelectedItem.Text));
Brushb=newSolidBrush(Color.Red);
g.DrawString(Caption.Text,f,b,10,140);
g.Dispose();
System.Drawing.ImagethumbImage=newimage.GetThumbnailImage(Int32.Parse(Width.Text),Int32.Parse(Height.Text),null,0);
image.Dispose();
thumbImage.Save(Server.MapPath(filename1),ImageFormat.JPEG);
Image1.Src=filename1;
Caption.Text="";
}
</script>
<body>
<asp:labelid="dis"runat=server/>
<formenctype="multipart/form-data"runat=server>
<h3>
SelectFileToUpload:<inputid="UploadFile"type=filerunat=server>
<asp:buttonText="UploadMe!"runat=server/>
<hr>
<asp:panelid="ImageEditor"Visible=falserunat=server>
<h3>
ImageWidth:<asp:textboxid="Width"runat=server/>
ImageHeight:<asp:textboxid="Height"runat=server/><br>
TextCaption:<asp:textboxid="Caption"runat=server/>
CaptionSize:<asp:dropdownlistid="FontSize"runat=server>
<asp:listitem>14</asp:listitem>
<asp:listitem>18</asp:listitem>
<asp:listitem>26</asp:listitem>
<asp:listitem>36</asp:listitem>
<asp:listitem>48</asp:listitem>
<asp:listitem>62</asp:listitem>
</asp:dropdownlist>
CaptionFont:<asp:dropdownlistid="FontType"runat=server>
<asp:listitem>黑体</asp:listitem>
<asp:listitem>仿宋</asp:listitem>
<asp:listitem>隶书</asp:listitem>
<asp:listitem>楷书</asp:listitem>
<asp:listitem>朴直姚体</asp:listitem>
<asp:listitem>汉文彩云</asp:listitem>
</asp:dropdownlist>
<asp:buttonText="UpdateImage"runat=server/>
</h3>
</asp:panel>
</form>
</body>
</htm
[img=1border=0style=,1src=]http://www.ckuyun.com/[/img]
可怜的程序员,还是逃不出移植的命运! |
|