免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2690 | 回复: 6

给大家推荐一个语言 - 虾 [复制链接]

论坛徽章:
27
水瓶座
日期:2014-08-22 21:06:34程序设计版块每日发帖之星
日期:2015-11-25 06:20:0015-16赛季CBA联赛之新疆
日期:2015-12-19 19:05:48IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:3315-16赛季CBA联赛之上海
日期:2016-04-15 19:51:31程序设计版块每日发帖之星
日期:2016-04-17 06:23:29程序设计版块每日发帖之星
日期:2016-04-23 06:20:00程序设计版块每日发帖之星
日期:2016-05-26 06:20:00每日论坛发贴之星
日期:2016-05-26 06:20:0015-16赛季CBA联赛之辽宁
日期:2017-02-16 23:59:47
发表于 2013-04-20 19:05 |显示全部楼层
本帖最后由 shijiang1130 于 2013-04-20 19:06 编辑

Gambas
http://sourceforge.net/projects/gambas/reviews/?source=navbar

论坛徽章:
27
水瓶座
日期:2014-08-22 21:06:34程序设计版块每日发帖之星
日期:2015-11-25 06:20:0015-16赛季CBA联赛之新疆
日期:2015-12-19 19:05:48IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:3315-16赛季CBA联赛之上海
日期:2016-04-15 19:51:31程序设计版块每日发帖之星
日期:2016-04-17 06:23:29程序设计版块每日发帖之星
日期:2016-04-23 06:20:00程序设计版块每日发帖之星
日期:2016-05-26 06:20:00每日论坛发贴之星
日期:2016-05-26 06:20:0015-16赛季CBA联赛之辽宁
日期:2017-02-16 23:59:47
发表于 2013-04-20 19:09 |显示全部楼层
  1. ' Gambas class file

  2. '***********Analog Clock Example Program************************
  3. '***********By: Ahmad Kamal <eng_ak@Link.net>******************
  4. '***********Written for Gambas: gambas.sourceforge.net**********
  5. '***********V1.0: 22-July-2003***************************************
  6. '***********V1.1: 24-July-2003  Optimized by Benoit himself ;)*****

  7. Private $iLast As Integer
  8. Private $dNow As Date

  9. ' Fixed coordinate system
  10. ' We use the transformation matrix for scaling
  11. Private Const W As Integer = 1024
  12. Private Const H As Integer = 1024

  13. Public Sub TimerClk_Timer()

  14.   If Second(Now) = $iLast Then Return
  15.   $dNow = Now

  16.   dwgArea.Refresh

  17. End

  18. ' Main routine that updates the clock

  19. Public Sub DrawClock()

  20.   Dim angle As Float
  21.   Dim dNow As Date
  22.   Dim eScale As Float
  23.   Dim sTime As String
  24.   
  25.   eScale = Min(dwgArea.Width / W, dwgArea.Height / H)

  26.   Paint.Translate(dwgArea.W / 2, dwgArea.H / 2)
  27.   Paint.Scale(eScale, eScale)

  28.   dNow = $dNow
  29.   $iLast = Second(dNow)

  30.   Paint.Brush = Paint.Color(&HDCDCDC&)    'Light gray color
  31.   Paint.Arc(0, 0, W / 2)
  32.   Paint.Fill
  33.   Paint.Brush = Paint.Color(dwgArea.Background)
  34.   Paint.Arc(0, 0, W / 2 * 0.9)
  35.   Paint.Fill
  36.   
  37.   sTime = Format(dNow, "hh:nn:ss")
  38.   
  39.   Paint.Font.Bold = True
  40.   Paint.Font.Size = 60
  41.   Paint.Brush = Paint.Color(Color.Black)
  42.   Paint.Text(sTime, - W / 2, - H * 0.4, W, H * 0.1, Align.Top)
  43.   Paint.Fill

  44.   ' Draw seconds
  45.   angle = Second(dNow) / 60 * Pi(2) - Pi(0.5)   'The angle that the arm makes, with a line from clock center to 12O'clock
  46.   
  47.   Paint.Brush = Paint.Color(Color.SetAlpha(Color.Red, 128))
  48.   Paint.LineWidth = 6
  49.   Paint.MoveTo(0, 0)
  50.   Paint.LineTo(Cos(angle) * W / 2, Sin(angle) * H / 2)
  51.   Paint.Stroke
  52.   
  53.   ' Draw minutes
  54.   angle = CFloat(Time(dNow)) * 24 * Pi(2) - Pi(0.5)
  55.   
  56.   Paint.Brush = Paint.Color(Color.SetAlpha(Color.Black, 128))
  57.   Paint.MoveTo(Cos(angle) * W * 0.45, Sin(angle) * H * 0.45)
  58.   Paint.LineTo(Sin(angle) * W * 0.05, - Cos(angle) * H * 0.05)
  59.   Paint.LineTo(- Sin(angle) * W * 0.05, Cos(angle) * H * 0.05)
  60.   Paint.Fill
  61.   
  62.   ' Draw hours
  63.   angle = CFloat(Time(dNow)) * 2 * Pi(2) - Pi(0.5)
  64.   
  65.   Paint.Brush = Paint.Color(Color.SetAlpha(Color.Black, 128))
  66.   Paint.MoveTo(Cos(angle) * W * 0.35, Sin(angle) * H * 0.35)
  67.   Paint.LineTo(Sin(angle) * W * 0.05, - Cos(angle) * H * 0.05)
  68.   Paint.LineTo(- Sin(angle) * W * 0.05, Cos(angle) * H * 0.05)
  69.   Paint.Fill
  70.   
  71.   ' Draw circle on the center of the clock to hide the arms intersection
  72.   
  73.   Paint.Brush = Paint.Color(Color.Black)
  74.   Paint.Arc(0, 0, 0.1 * W)
  75.   Paint.Fill
  76.   
  77.   DrawFrame
  78.   
  79. End

  80. ' Draw the clock frame

  81. Public Sub DrawFrame()

  82.   Dim I As Integer
  83.   Dim angle As Float
  84.   
  85.   Paint.Brush = Paint.Color(Color.SetAlpha(Color.Black, 64))
  86.   
  87.   For I = 0 To 59
  88.     If I % 5 = 0 Then
  89.       Paint.LineWidth = 12
  90.     Else
  91.       Paint.LineWidth = 2
  92.     Endif
  93.     angle = Pi(2) * I / 60
  94.     Paint.MoveTo(Cos(angle) * 0.45 * W, Sin(angle) * 0.45 * H)
  95.     Paint.LineTo(Cos(angle) * W / 2, Sin(angle) * H / 2)
  96.     Paint.Stroke
  97.   Next

  98. End


  99. Public Sub MenuAbout_Click()

  100.   Dim AboutMessage As String
  101.   AboutMessage = "Analog Clock Example Program for Gambas\nWritten by: Ahmad Kamal <eng_ak@Link.Net> and Benoît Minisini"
  102.   
  103.   Message.info(AboutMessage)

  104. End


  105. Public Sub MenuExit_Click()

  106.   Me.Close  

  107. End


  108. Public Sub DwgArea_Menu()

  109.   MenuPopUp.popup

  110. End

  111. Public Sub DwgArea_Draw()

  112.   DrawClock

  113. End

  114. Public Sub Form_Open()

  115.   TimerClk_Timer

  116. End
复制代码

论坛徽章:
5
丑牛
日期:2014-01-21 08:26:26卯兔
日期:2014-03-11 06:37:43天秤座
日期:2014-03-25 08:52:52寅虎
日期:2014-04-19 11:39:48午马
日期:2014-08-06 03:56:58
发表于 2013-04-24 15:19 |显示全部楼层
虾语言这是

论坛徽章:
0
发表于 2013-04-25 08:01 |显示全部楼层
佩服,佩服!

论坛徽章:
0
发表于 2013-04-25 10:07 |显示全部楼层
这不是 VB 吗?

论坛徽章:
27
水瓶座
日期:2014-08-22 21:06:34程序设计版块每日发帖之星
日期:2015-11-25 06:20:0015-16赛季CBA联赛之新疆
日期:2015-12-19 19:05:48IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:3315-16赛季CBA联赛之上海
日期:2016-04-15 19:51:31程序设计版块每日发帖之星
日期:2016-04-17 06:23:29程序设计版块每日发帖之星
日期:2016-04-23 06:20:00程序设计版块每日发帖之星
日期:2016-05-26 06:20:00每日论坛发贴之星
日期:2016-05-26 06:20:0015-16赛季CBA联赛之辽宁
日期:2017-02-16 23:59:47
发表于 2013-04-25 11:06 |显示全部楼层
回复 5# Perlvim
:wink: 什么时候你也出个语言

论坛徽章:
0
发表于 2013-04-25 13:18 |显示全部楼层
我不出新的语言,只学习旧的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP