0
其實我想圓角的圖像,然後在updatePanel中顯示它... 沒有圓角函數它工作得很好......但是當我運行圓角圖像的函數時,它給出文件未找到錯誤()從陣列的UpdatePanel圖像
我的代碼
protected void Timer1_Tick(object sender, EventArgs e)
{
NameValueCollection MyImgList = new NameValueCollection();
MyImgList.Add("Img1", "~/MyImages/Picture1.jpg");
MyImgList.Add("Img2", "~/MyImages/Picture2.jpg");
MyImgList.Add("img3", "~/MyImages/Picture3.jpg");
Random Rnd = new Random();
int Indx = Rnd.Next(0, 4);
path = MyImgList[Indx].ToString();
//LtrImg.Text = "<img src='" + Page.ResolveUrl(path) + "' alt=''/>";
using (System.Drawing.Image imgin = System.Drawing.Image.FromFile(path))
{
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(imgin.Width, imgin.Height);
Graphics g = Graphics.FromImage(bitmap);
g.Clear(Color.White);
Brush brush = new System.Drawing.TextureBrush(imgin);
FillRoundedRectangle(g, new Rectangle(0, 0, imgin.Width, imgin.Height), roundedDia, brush);
// done with drawing dispose graphics object.
g.Dispose();
// Stream Image to client.
Response.Clear();
Response.ContentType = "image/pjpeg";
bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
Response.End();
// dispose bitmap object.
bitmap.Dispose(); /* May be Here */
}
LtrImg.Text = "<img src='" + Page.ResolveUrl(path) + "' alt=''/>";
}
感謝導向管..
可以分享的aspx –