如何在面板中设置图像的高度和宽度 [英] How to set height and width of image in panel
本文介绍了如何在面板中设置图像的高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我想在点击上传按钮时显示具有特定高度和宽度的图像。我已经指定如下,但图像显示其原始高度和宽度。
你能否建议我如何显示指定高度和宽度的图像。 />
< asp:面板 ID = pnlCrop runat = server 可见 = false 宽度 = 100px < span class =code-attribute> 高度 = 100px >
< div id = divImg style = width:100px;高度:100px runat = 服务器 >
< asp:图像 ID < span class =code-keyword> = imgCrop runat = server / >
< / div >
< b r / >
< / asp:Panel >
CodeBehind:点击上传按钮
< pre lang =cs> imgCrop.ImageUrl = 〜/ Images / + Session [ WorkingImage]。ToString();
imgCrop.Width = 100px;
imgCrop.Height = 100px;
解决方案
imgCrop.ImageUrl = 〜/ Images / + Session [ WorkingImage]。ToString();
imgCrop.Width = 100 ; // 单位小计(100单位)
imgCrop.Height = 100 跨度>; // 单位指标(100单位)
>
Hello,
I want to display image with specific height and width on clicking upload button. I have specified like below but Image is displaying with its original height and width.
Can you please suggest me how can I display image with specified height and width.
<asp:Panel ID="pnlCrop" runat="server" Visible="false" Width="100px" Height="100px">
<div id="divImg" style="width: 100px; height: 100px" runat=server>
<asp:Image ID="imgCrop" runat="server" />
</div>
<br />
</asp:Panel>
CodeBehind: On clicking upload button
imgCrop.ImageUrl = "~/Images/" + Session["WorkingImage"].ToString();
imgCrop.Width = "100px";
imgCrop.Height = "100px";
解决方案
imgCrop.ImageUrl = "~/Images/" + Session["WorkingImage"].ToString(); imgCrop.Width = 100; // unit measure (100 unit) imgCrop.Height = 100; //unit measure (100 unit)
这篇关于如何在面板中设置图像的高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文