API version 1

- ‐

コンストラクタ

コンストラクタ

呼出形式一覧

呼出形式

説明

new Color()

Colorオブジェクトをデフォルト値で生成します。

new Color(CRS::Common::UI::Color color)

Colorオブジェクトをコピー生成します。

new Color(CRS::Common::UI::Brush brush)

brushの持つcolorからコピー生成します。

new Color(string colorName)

ColorオブジェクトをWebカラー名から生成します。

new Color(integer argb)

Colorオブジェクトを32ビット値(ARGB)、または色定数から生成します。

定数値

説明

STD

0x00000000:標準色

標準色を表す特別な色定数です。 この色を指定した場合、オブジェクトの持つ標準色が選択されます。

BLACK

0xff000000:黒

WHITE

0xffffffff:白

DGRAY

0xff808080:暗い灰色

LGRAY

0xffc0c0c0:灰色

DRED

0xff800000:暗い赤

RED

0xffff0000:赤

DYELLOW

0xff808000:暗い黄色

YELLOW

0xffffff00:黄色

DGREEN

0xff008000:暗い緑

GREEN

0xff00ff00:緑

DCYAN

0xff008080:暗い水色

CYAN

0xff00ffff:水色

DBLUE

0xff000080:暗い青

BLUE

0xff0000ff:青

DMAGENTA

0xff800080:暗い紫

MAGENTA

0xffff00ff:紫

TRANSPARENT

0x00ffffff:透明

new Color(integer r, integer g, integer b[, integer a])

Colorオブジェクトを赤、青、緑、アルファ値から生成します。

戻り値一覧

戻り値

説明

void

なし

引数一覧

引数

説明

color

コピー元Colorオブジェクト

brush

コピー元Brushオブジェクト

colorName

Webカラー名

argb

32ビット色値(0x00000000~0xffffffff)

r

赤成分値(0~255)

g

緑成分値(0~255)

b

青成分値(0~255)

a

アルファ値(0~255)

省略時は255(不透明)とみなします。

例外

識別子

説明

CRS::Common::UI::Color-1:1

無効な色名称です

関連項目

abgr プロパティ



使用例 CRSダウンロード

Form Coloruse {
   x = 0;
   y = 0;
   width = 800;
   height = 600;
   TextBox textbox1 {
           x = 104;
           y = 144;
           width = 168;
           height = 48;
   }
   /* 文字入力後にボタンクリック */
   Button button1 {
           x = 104;
           y = 216;
           width = 160;
           height = 48;
           Title = "開始の数字を入れて\r\nクリック(0~16)" ;

           bgColor = new Brush("#ffffaa7f", Brush.SOLID);
           font = new Font("メイリオ", 12);
           function onTouch(e) {
                   var eventName ="UserEvent" ;
                   var userEvent1 =
                           new Event( eventName )  {
                                   String data ;
                           }
                   userEvent1.data.Value = ^.TextBox1.Value;
                   PostEvent(userEvent1) ;
           }
   }

   /* マウスONの後でクリック */
   function OnUserEvent(e) {
           //.MessageBox(e.data.Value) ;
           print(e.from) ;
           Chart chart1 {
                   x = 50;
                   y = 10;
                   width = 400;
                   height = 300;
                   Number it = e.data.Value ;
                   print("var it =",it) ;
                   title = "click me " ;
                   plotBgColor = new Brush("#ff000000", Brush.NOBRUSH);
                   function onMouseEnter(e) {
                           print(it,"-on chart mouse ") ;
                           var co = new Color() ;

                           /* --- setNameによるセット --->> */
                           co.setName("lime") ;
                           bgColor = co ;
                           var cc = co.getHsv() ;
                           var ss = co.getName() ;
                           print("h= ",cc.h," s= ",cc.s," v= ",cc.v," a= ",cc.a , "name= ",ss) ;
                   }
                   function onClicked(e) {
                           array col(0x00000000,0xff000000,0xffffffff,0xff808080,0xffc0c0c0,0xff800000,
                                                   0xffff0000,0xff808000,0xffffff00,0xff008000,0xff00ff00, 0xff008080,
                                                   0xff00ffff ,0xff000080 ,0xff0000ff, 0xff800080 ,0xffff00ff) ;
                           array set("標準","黒","白","暗灰色","灰色","暗赤","赤","暗黄色","黄色",
                                       "暗緑","緑","暗水色","水色","暗青","青","暗紫","紫","透明") ;

                           print(it,"-on click ",set[it]) ;
                           bgColor =  col[it] ;
                           it = it+1 ;
                           if (it > 17)  title = "おわり " ;
                   }
           }
   }
}