为 Canvas 设置边框 [英] Giving a border to Canvas

查看:108
本文介绍了为 Canvas 设置边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Flex 中,我使用

In Flex, I am using

var canvasEdit:Canvas = new Canvas();
canvasEdit.setStyle("borderColor", 0x0134FF);
canvasEdit.setStyle("borderThickness", 3);

但我无法在 Canvas 的两侧放置边框.

But I am not able to put border on the sides of the Canvas.

推荐答案

尝试添加以下行:

canvasEdit.setStyle("borderStyle","solid");

...例如,这是一个完整的应用程序文件示例:

...for example, here is a full application file example:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
    <mx:Script>
        <![CDATA[

            protected function init():void
            {
                canvasEdit.setStyle("borderStyle","solid");
                canvasEdit.setStyle("borderColor","#000000");
                canvasEdit.setStyle("borderThickness","5");
            }
        ]]>
    </mx:Script>
    <mx:Canvas width="200" height="200" x="0" y="0" id="canvasEdit"/>
</mx:Application>

这篇关于为 Canvas 设置边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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