绿色风's Blog
专注AutoIT(Au3)
  • 首页
  • 流●年
  • 笔●记
    • 学习随记
    • 源码示例
  • 脚●本
    • UDF(收集)
    • 工作室UDF
    • 工具●教程
    • 教程之GDI
  • 作●品
  • 下●载
  • 情怀ExcelTip
9月142023

有点意思的代码-画个五角星

作者:绿色风   发布:2023-9-14 1:46 Thursday   分类:源码示例   阅读:3483次   评论:0条  

;================================= * = * = * = * = * = * ===========================================================
#NoTrayIcon
SRandom(@AutoItPID)

WinMinimizeAll ()
HotKeySet("{ESC}", "OntSnap"); ==  *   *   *  == To stop the program
$lengte = 450
Dim $x0ne, $yone, $xtwo, $ytwo, $line, $Slaap, $LineColor, $LineWidth
While "Creating the Stars"
$Slaap = Random(1, 1000, 1)
    $lengte = Random(50, 450, 1)
    $LineWidth = Random(2, 20, 1)
    $x0ne = Random(10, @DesktopWidth - $lengte / 3, 1)
    Sleep($Slaap)
    $yone = Random(-1, @DesktopHeight - $lengte / 3, 1)
    $xtwo = $x0ne + $lengte * .328
    $ytwo = $yone + $lengte * .955
    $LineColor = Random(0x000000, 0xFFFFFF, 1)
    DrawALine()
    $x0ne = $x0ne - $lengte * .507
    $yone = $yone + $lengte * .373
    Sleep($Slaap)
    DrawALine()
    $xtwo = $xtwo + $lengte * .164
    $ytwo = $ytwo - $lengte * .582
    Sleep($Slaap)
    DrawALine()
    $x0ne = $x0ne + $lengte * .179
    $yone = $yone + $lengte * .582
    Sleep($Slaap)
    DrawALine()
    $xtwo = $xtwo - $lengte * .492
    $ytwo = $ytwo - $lengte * .373
    Sleep($Slaap)
    DrawALine()
    Sleep($Slaap)
WEnd
Func DrawALine()
    $hnd = DllCall("user32.dll", "int", "GetDC", "hwnd", 0)
    $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", $LineWidth, "int", $LineColor)
    DllCall("gdi32.dll", "int", "SelectObject", "int", $hnd[0], "int", $pen[0])
    DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hnd[0], "int", $x0ne, "int", $yone, "int", 0)
    DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hnd[0], "int", $xtwo, "int", $ytwo)
    DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $hnd[0])
EndFunc   ;==>DrawALine
Func OntSnap()
    WinMinimizeAllUndo ( )
    Exit
EndFunc   ;==>OntSnap
;================================= * = * = * = * = * = * ===========================================================




本文固定链接: http://www.jianyiit.com/post-413.html

blogger
该日志由 绿色风 于2023-9-14 1:46 Thursday发表在 源码示例 分类下。
版权所有:《绿色风's Blog》 → 《有点意思的代码-画个五角星》;
除特别标注,本博客很多文章均为原创. 互联分享,尊重版权,转载请以链接形式标明本文地址;
本文标签:

扫描二维码,在手机上阅读
上一篇::有点意思的代码-模拟混沌单摆
下一篇:有点意思的代码-起动能量

热门文章

相关文章

  • Au3按钮上带图片
  • 黑客帝国特效
  • Au3中文内码转换UDF,方便调用
  • AU3拼图游戏
  • AU3高级目录文件遍历
取消回复

发表评论

亲,头像对么?

26 + 51 =

提交中,请稍候……


木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!


    站点统计
    • 运行时间: 20254 天
    • 日志总数: 365 篇
    • 评论数量: 7223 条
    • 微语数量: 6 条
    • 附件总量: 388 件
  • 逝出的青春

  • 打赏"绿色风"



      扫码关注本站公众号 可搜本站内容

  • Autoit V3 脚本交流群

      常驻群1:905774875
      常驻群2:40672266


  • 链接

    • AU3中文论坛
    • Excel资料库
    • 完美者博客
    • 顺网小哥'S Blog
    • 猛牛哥的博客
    • 网吧系统下载
  • 分类

    • 流●年(66)
    • 笔●记(0)
    • 脚●本(0)
    • 作品(21)
    • 学习随记(51)
    • 源码示例(68)
    • UDF(收集)(26)
    • 工作室UDF(30)
    • 工具●教程(62)
    • 教程之GDI(24)
Copyright © 2013 绿色风's Blog. Powered by emlog. Theme by 射雕天龙. 鄂ICP备2021011689号-1 鄂公网安备42102302000078号 sitemap