import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add(
button={cls="button";text="gdip绘图";left=275;top=380;right=429;bottom=429;z=2};
plus={cls="plus";left=135;top=17;right=587;bottom=340;repeat="scale";z=1}
)
/*}}*/
//aardio的gdip简单绘图实例
import gdip;
//winform.show(); //无函调用先显示窗体
winform.button.oncommand = function(id,event){
//画板
var graphics = gdip.graphics(winform.plus)
//画板尺寸
var left,top,right,bottom = 1,1,120*3,115*3; //图形矩形
var leftText,topText,rightText,bottomText = 1,bottom*0.8,right,bottom; //文字矩形
//画图: 图形填充,如截屏或gpid.bitmap位图
import gdip.snap;
var bmp = gdip.snap(); //截屏
//var bmp = gdip.bitmap("D:\图片\5be2ace5cc0e2.jpg"); //位图
graphics.drawImageRect(bmp,left,top,right,bottom);
//画线
var pen = gdip.pen(0XFFFF0000,1); //pen笔,颜色:红色,宽度,单位:像素
//颜色: 第一个0xff表示透明度100%
//红:0xffff0000 绿:0xff00ff00 蓝:0xff0000ff
//黄色=绿色+红色:0xffffff00
//青色=绿色+蓝色:0xff00ffff
//品红=红色+蓝色:0xffff00ff
graphics.drawLine(pen,left,bottom*0.8,right,bottom*0.8); //80%高度位置
//文字
var text = "aardio 你好"
var sbrush = gdip.solidBrush(0XFFFF0000); //笔刷:红色
var fontFamily = gdip.family("宋体");
var font = fontFamily.createFont(15,2/*_FontStyleItalic*/,2/*_UnitPixel*/);
//fontFamily.createFont(字体大小,样式4种,单位1种:像素)
//样式: gdip名字空间 intellisense()
//样式 1/*_FontStyleBold 粗体*/ 2/*_FontStyleItalic 正常*/
//样式 4/*_FontStyleUnderline 下划线*/ 8/*_FontStyleStrikeout 删除线*/
var strformat = gdip.stringformat(); //文本格式对象
graphics.drawString(text,font,::RECTF(leftText,topText,rightText,bottomText),strformat,sbrush)
}
winform.show();
win.loopMessage();