你这不是wpf。。或者siverlight方面的吗?。。怎么发到这来了

解决方案 »

  1.   

    https://developer.mozilla.org/en/Canvas_tutorial/Applying_styles_and_colors 看下这个
      

  2.   

    很多问题都和上下文相关,问个问题不贴demo真浪费时间
      

  3.   

            ctx.strokeStyle = 'rgb(x,x,x)';  
            ctx.beginPath();  
            画图形的代码
            ctx.stroke();
    这样试试
      

  4.   

    ctx.strokeStyle = "red";
    ctx.strokeRect(0,0,20,20);我这样写是可以的,还有可能就是浏览器问题,我在chrome下测试的,网上说目前chrome对html5的支持最好
      

  5.   


    var canvas = window.document.getElementById("canvas");
    var cxt = canvas.getContext("2d");
    cxt.fillStyle = null
    console.log(cxt.fillStyle)
    通过以上代码可以推测,凡是不合乎style定义的字符串赋值后,style都会变成#000000,即黑色。
      

  6.   


    var canvas = window.document.getElementById("canvas");
    var cxt = canvas.getContext("2d");
    cxt.fillStyle = null
    console.log(cxt.fillStyle)//#000000通过以上代码可以推测,凡是不合乎style定义的字符串赋值后,style都会变成#000000,即黑色。