• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

ShotGraph普通的画图的原理

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 33次 | 进入软件测试论坛讨论

领测软件测试网 ShotGraph 能在以下的环境中使用:
  • Visual Basic
  • VBScript
  • Visual Basic for applications (VBA), Word, Excel, etc.
  • Active Server Pages (ASP) engine with Internet Information Server
  • Perl for Windows
  • others

ShotGraphCOOL代码:

我们来先来简单的:

Step by step

  1. 首先建立一个对象 "shotgraph.image".
  2. 使用 方法。
  3. 使用 方法一次或者多次来定义画图要使用的颜色。
  4. 清除你图区中的所有内容,必要时使用 普遍认为方法.
  5. 使用有效的方法画图.
  6. 使用 函数. 你的图画就完成了!
下面的是一个简单的例子来说怎样用 shotgraph画图。

The size of the image is 201x201.
VBScript 中的代码:
@#Creating the objectset obj=CreateObject("shotgraph.image")size=201@#Calling the CreateImage methodobj.CreateImage size,size,4@#Set 4 colors for drawingobj.SetColor 0,255,255,255obj.SetColor 1,0,0,0obj.SetColor 2,255,108,0obj.SetColor 3,0,0,204@#Crearing the painting area with color 0obj.SetBgColor 0obj.FillRect 0,0,size-1,size-1@#Color 0 will be used for drawingobj.SetDrawColor 1@#Drawing the lineobj.Line size-1,0,0,size-1@#Color 2 will be used for fillingobj.SetBgColor 2@#Draw the big circleobj.Ellipse 5,5,size-6,size-6@#Color 2 will be used for fillingobj.SetBgColor 3@#Draw the small circleobj.Ellipse 5,(size-5)/4,size/2,(size-5)*3/4@#Create the image file named test.gifobj.GifImage 0,1,"test.gif"
下面是在ASP和PERL中的代码:
ASPPerl
Response.ContentType="image/gif"set obj=Server.CreateObject("shotgraph.image")size=201obj.CreateImage size,size,4obj.SetColor 0,255,255,255obj.SetColor 1,0,0,0obj.SetColor 2,255,108,0obj.SetColor 3,0,0,204obj.SetBgColor 0obj.FillRect 0,0,size-1,size-1obj.SetDrawColor 1obj.Line size-1,0,0,size-1obj.SetBgColor 2obj.Ellipse 5,5,size-6,size-6obj.SetBgColor 3obj.Ellipse 5,(size-5)/4,size/2,(size-5)*3/4img=obj.GifImage(0,1,"")Response.BinaryWrite img
$obj=CreateObject("shotgraph.image")$size=201$obj->CreateImage($size,$size,4)$obj->SetColor(0,255,255,255)$obj->SetColor(1,0,0,0)$obj->SetColor(2,255,108,0)$obj->SetColor(3,0,0,204)$obj->SetBgColor(0)$obj->FillRect(0,0,$size-1,$size-1)$obj->SetDrawColor(1)$obj->Line($size-1,0,0,$size-1)$obj->SetBgColor(2)$obj->Ellipse(5,5,$size-6,$size-6)$obj->SetBgColor(3)$obj->Ellipse(5,($size-5)/4,$size/2,($size-5)*3/4)$obj->GifImage(0,1,"test.gif")

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网