当前位置: 首页 > 文档资料 > ExtJS 入门教程 >

Rectangle

优质
小牛编辑
116浏览
2023-12-01

此类型用于创建矩形的绘图形状。

语法 (Syntax)

以下是添加矩形的简单语法。

xtype: 'draw',
type: 'rect'

例子 (Example)

以下是一个显示用法的简单示例。

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" 
         rel = "stylesheet" />
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/packages/charts/classic/charts.js"></script>
      <script type = "text/javascript">
         Ext.onReady(function() {
            Ext.create('Ext.draw.Component', {
               sprites: [{
                  type: 'rect',
                  height : 200,
                  width: 600,
                  fill: 'red'
               }],
               height:150,
               width:300,
               renderTo:Ext.getBody()
            });
         }); 
      </script>
   </head>
   <body>
   </body>
</html>