我想使用asp.net将多个画布保存到一个图像中.我试着用两幅画布,但它没有保存.
帆布:
<div style="position:relative; width:456px; padding:0px; margin:0px;">
<canvas id="boardcanvas" width="456" height="480" style="position: absolute; left: 0; top: -220px; z-index: 0;"></canvas>
<canvas id="layer2" width="456" height="480" style="position: absolute;left: 0; top:-220px; z-index: 1;"></canvas>
</div>
<input type="button" id="btnSave" style="width:150px ; text-align:center;height:30px" name="btnSave" value="Save as Image!" />
Run Code Online (Sandbox Code Playgroud)
jQuery的:
<script type="text/javascript">
// Send the canvas image to the server.
$(function () {
$("#btnSave").click(function () {
can1 = document.getElementById("broadcanvas");
ctx1 = can1.getContext("2d");
var coll = document.getElementById("layer2");
ctx1.drawImage(coll, 0, 0);
var image = can1.toDataURL("image/png");
alert(image);
image = image.replace('data:image/png;base64,', ''); …Run Code Online (Sandbox Code Playgroud) 我们可以在foreach中使用多个变量吗?
foreach (var item1 in collection1;var items2 in collection2)
{
}
Run Code Online (Sandbox Code Playgroud)
我想这样做是因为我需要从数据库中获取两个集合并将它们都附加到ComboBox.