我是asp.net新手,有这么个问题
我建了个简单的网站,只有一个defaul.aspx
protected void Page_Load(object sender, EventArgs e)
{
System.Drawing.Image img = Bitmap.FromFile("C://222.bmp");
Response.ContentType = "image/png";
System.IO.MemoryStream MS = new System.IO.MemoryStream();
img.Save(MS, System.Drawing.Imaging.ImageFormat.Jpeg);
img.Dispose();
byte[] buffer = MS.ToArray();
Response.BinaryWrite(buffer); }
这段代码可使主页面返回一个图片222.bmp而我在defaul.aspx.cs中设计的按钮,image控件等,就看不见了我连这个defaul.aspx.cs也贴出来:<head runat="server">
<title>三维</title>
<style type="text/css">
#form1
{
height: 290px;
width: 256px;
}
.style1
{
width: 100%;
height: 314px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ImageButton ID="ImageButton2" runat="server"
ImageUrl="~/PNG/back_alt.png"
style="z-index: 1; top: 53px; position: absolute; width: 28px; height: 33px; right: 479px;" />
<asp:Image ID="Image1" runat="server" Height="285px" Width="252px"
onload="Image1_Load" />
</form>
</body>
现在的奇怪问题是,我显示出图片后,设计好的image和imagebutton都看不见了,若是把显示图片的代码注释掉,当然这些控件就出来了。图片很小,不至于把空间盖住,所以不是盖住的原因。
我建了个简单的网站,只有一个defaul.aspx
protected void Page_Load(object sender, EventArgs e)
{
System.Drawing.Image img = Bitmap.FromFile("C://222.bmp");
Response.ContentType = "image/png";
System.IO.MemoryStream MS = new System.IO.MemoryStream();
img.Save(MS, System.Drawing.Imaging.ImageFormat.Jpeg);
img.Dispose();
byte[] buffer = MS.ToArray();
Response.BinaryWrite(buffer); }
这段代码可使主页面返回一个图片222.bmp而我在defaul.aspx.cs中设计的按钮,image控件等,就看不见了我连这个defaul.aspx.cs也贴出来:<head runat="server">
<title>三维</title>
<style type="text/css">
#form1
{
height: 290px;
width: 256px;
}
.style1
{
width: 100%;
height: 314px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ImageButton ID="ImageButton2" runat="server"
ImageUrl="~/PNG/back_alt.png"
style="z-index: 1; top: 53px; position: absolute; width: 28px; height: 33px; right: 479px;" />
<asp:Image ID="Image1" runat="server" Height="285px" Width="252px"
onload="Image1_Load" />
</form>
</body>
现在的奇怪问题是,我显示出图片后,设计好的image和imagebutton都看不见了,若是把显示图片的代码注释掉,当然这些控件就出来了。图片很小,不至于把空间盖住,所以不是盖住的原因。
解决方案 »
- 怎样发现在datalist中的Repeater控件?
- "分享到。。。"插件,如何把它的JS下到本地调试
- 一个小问题,请各位同志们帮帮忙
- DataGrid的问题
- 一个关于xml和xlst的问题
- [100分],请问“document.all.xxx.detachEvent”“event.srcElement.tagName ”这是什么技术或语言,我想学,请问该看什么书?
- 2003server加入域后,无法获得注册表的读写权限:
- ~~~在DataGrid中如何取checkbox的checked和value?用VB~~~
- 生成一个Web Service,为什么例子 Hello World无发执行?
- 求教如何将listbox中的值用更新到数据库表中?
- 显示不同tab之间图片不同切换
- UltraWebGrid控件某列调用JS问题
Response.ContentType = "image/png";
晕,上面bmp,下面png
Response.ContentType = "image/png";
System.IO.MemoryStream MS = new System.IO.MemoryStream();
img.Save(MS, System.Drawing.Imaging.ImageFormat.Jpeg);
img.Dispose();
byte[] buffer = MS.ToArray();
Response.BinaryWrite(buffer);这样default.aspx里就可以看见按钮了,而且image上还能显示“图像来源”里的图像;现在我点default.aspx页面上的按钮,需要实现更换图像,而且“图像来源”是从网络上另一台机器远程调来的,所以是动态的。问题在哪里呢?调试的时候,我每次点按钮,地址栏始终是http://localhost:3192/WebSite/Default.aspx,也就是说页面控制权在default,但同时我可以看到状态栏在显示:“正在下载http://localhost:3192/WebSite/Default2.aspx…………”“……”代表的是参数,也就是此时正在从default2下载以填充image,当然这样是正常的,但效果上,是在我按下按钮和default2的图像下载完之间的空隙时间,整个页面时白的,因此两张图呈现之间的跳跃性非常大,而我要的是要连续的效果,最好是在图像下载完之前,原来的图像不要消失,等defautl2从网络另一台机器调过来图片,填充default中的image控件的imageURL之后,再替换不知道我有没有说清楚,汗一个!!!再次谢谢各位高手了