复式公寓装修效果图,重庆市市委书记,灵溪风景区
实现的功能以及效果如下:
样式代码:
.divtable { display: table; border-collapse: collapse; border-spacing: 0; margin-right: auto; margin-left: auto; width: 100%; } .divth, .divtr { display: table-row; vertical-align: middle; height: 20px; padding-left: 2px; padding-right: 2px; } .divth { background-color: #efebde; text-align: center; } .divtd { display: table-cell; border: 1px solid #c0c0c0; }
前端asp.net 代码:
<div class="divtable" > <div class="divtr"> <div class="divtd"> 内容 </div> <div class="divtd" > <asp:textbox id="textboxqrcode" runat="server" width="500" textmode="multiline" rows="20"></asp:textbox> </div> </div> <div class="divtr" style="line-height:40px;" > <div class="divtd"> 尺寸 </div> <div class="divtd"> 宽度:<asp:textbox id="textboxwidth" runat="server" text="300"></asp:textbox>高度:<asp:textbox id="textboxheight" runat="server" text="300"></asp:textbox> </div> </div> <div class="divtr" style="line-height:40px;" > <div class="divtd"> </div> <div class="divtd"> <asp:button id="buttongenerate" runat="server" text="生成" onclick="buttongenerate_click" /> </div> </div> <div class="divtr" style="line-height:120px;" > <div class="divtd"> 二维码 </div> <div class="divtd"> <asp:placeholder id="placeholderbarcode" runat="server" /> </div> </div> </div>
把qrcoder.dll类库引入bin目录中去:
然后在aspx.cs引用命名空间:
using qrcoder; using system.io; using system.drawing;
onclick事件:
protected void buttongenerate_click(object sender, eventargs e) { string code = this.textboxqrcode.text; qrcodegenerator qrgenerator = new qrcodegenerator(); qrcodegenerator.qrcode qrcode = qrgenerator.createqrcode(code, qrcodegenerator.ecclevel.q); system.web.ui.webcontrols.image imagebarcode = new system.web.ui.webcontrols.image(); imagebarcode.height = string.isnullorempty(this.textboxheight.text.trim()) ? 300 : convert.toint32(this.textboxheight.text.trim()); imagebarcode.width = string.isnullorempty(this.textboxwidth.text.trim()) ? 300 : convert.toint32(this.textboxwidth.text.trim()); using (bitmap bitmap = qrcode.getgraphic(20)) { using (memorystream ms = new memorystream()) { bitmap.save(ms, system.drawing.imaging.imageformat.png); byte[] byteimage = ms.toarray(); imagebarcode.imageurl = "data:image/png;base64," + convert.tobase64string(byteimage); } this.placeholderbarcode.controls.add(imagebarcode); } }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论