点击画布绘图问题 [英] Canvas drawing problem on click

查看:86
本文介绍了点击画布绘图问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在画布上画画时遇到了问题。



当用户点击画布时,我通过jQuery获取坐标并传递它们在代码背后。



接收参数的方法必须是静态的,因此我正在将绘图代码开发到另一个返回类型为StringBuilder的方法中。因此,从接收坐标的静态方法,我实例化类I; m工作并调用该方法但仍然没有在画布上绘制。我尝试使用按钮完美地工作。

谢谢!



< br /> 
< pre lang =cs> public void add(int xPosition,int yPosition)< br />
{< br />
StringBuilder sb = new StringBuilder();< / pre>< br />
//code..<br />
< br />
ClientScript.RegisterStartupScript(this.GetType(),TestScript,sb .ToString());< br />
}< br />





 < pre lang =cs> [WebMethod]< br /> 
public static void mousedown(int xc,int yc)< br />
{< br />
创建cm = cm.Button1_Click(null,null);< br />
返回new Create()。add(xc,yc);< br />
< br />
}< / pre>< br />

解决方案

无法为此找到解决方案。

Hi, I'm having problems drawing on my canvas.

When the user clicks on the canvas, I'm getting the coordinates through jQuery and passing them in the code behind.

The method that is receiving the parameters has to be static therefore I'm developing the drawing code into another method which has a return type of StringBuilder. So from the static method that is receiving the coordinates, I'm instantiating the class I;m working in and calling that method but still nothing is drawn on the canvas. I tried it using a button and worked perfectly.
Thanks!

<br />
<pre lang="cs">public void add(int xPosition, int yPosition)<br />
       {<br />
           StringBuilder sb = new StringBuilder();</pre><br />
//code..<br />
<br />
ClientScript.RegisterStartupScript(this.GetType(), "TestScript", sb.ToString());<br />
}<br />



<pre lang="cs">[WebMethod]<br />
        public static void mousedown(int xc, int yc)<br />
        {<br />
            Create cm = cm.Button1_Click(null, null);<br />
            return new Create().add(xc, yc);<br />
<br />
        }</pre><br />

解决方案

Can't find a solution for this.


这篇关于点击画布绘图问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆