我是通过以下方式完成的:我采用了两个变量(图像和字符串)一个带有弹出窗口的 div,有拖曳按钮。验证图像后,我display:block
从服务器设置为 div。
在单击 ye 按钮时,我正在保存它。
<div id="dvPopup" class="popup" runat="server" style="display: none">
<asp:Panel ID="pnlpopup" runat="server" Style="display: block; position: absolute; width:400px;
margin: auto" CssClass="modalConfirmation">
<div style="width: 400px; height: 30px;" class="MessageHeaderError">
<div class="modalHeader">
Confirmation
</div>
</div>
<br />
<div style="color: Black">
<span runat="server" id="spnMessge" style="font-weight:bold">Picture is smaller than 1024 x 768 and will be stretched.</span>
</div>
<div class="small">
</div>
<div>
<div style="display: table-cell; height: 40px; padding-left: 80px; vertical-align: middle;
width: 80px;">
<asp:ImageButton ID="btnYes" ImageUrl="~/images/correct.png" runat="server" AlternateText="YES"
ToolTip="Yes" OnClick="btnYes_Click" />
</div>
<div style="display: table-cell; height: 40px; vertical-align: middle;">
<asp:ImageButton ID="btnNo" ImageUrl="~/images/delete.png" runat="server" AlternateText="NO"
ToolTip="No" Style="margin-left: 100px;" OnClick="btnNo_Click" />
</div>
在.cs
文件中:
private bool ValidateImageSize(System.Drawing.Image imgPopup, string strSource)
{
//Messure height & width and show popup;
if ((strSource == "MainPopup") && (imgPopup.Height > 768 || imgPopup.Width > 1024))
{
return true;
}
else if (strSource == "SmallPopup" && imgPopup.Height > 300 || imgPopup.Width > 400)
{
return true;
}
return false;
}