tianlong 发表于 2010-5-11 00:19:59

关于快捷键问题[已解决]

本帖最后由 tianlong 于 2010-5-11 09:38 编辑

:face (13):又遇到麻烦了
先看下代码
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("超级漩涡", 445, 252, 335, 307)
$Checkbox1 = GUICtrlCreateCheckbox("开始漩涡", 160, 56, 81, 57)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd


HotKeySet("{Esc}", "xit")

Dim $flPI = 3.14159

Dim $iTime = 360 * 10, $iAngleStep = 5, $iR = 300, $iX, $iY

Dim $iCenterX = @DesktopWidth / 2, $iCenterY = @DesktopHeight / 2



For $i = 0 To $iTime Step $iAngleStep

      $iX = Cos(($i + 90) / 360 * 2 * $flPI) * $iR

      $iY = Sin(($i + 90) / 360 * 2 * $flPI) * $iR



      $iR = Sin((90 - $iAngleStep) / 360 * 2 * $flPI) * $iR / Sin(90 / 360 * 2 * $flPI)

      MouseMove($iX + $iCenterX, $iY + $iCenterY, 1)

Next
Func xit()
      Exit
EndFunc
为什么加上图形界面后就不运行了?(鼠标画漩涡那部分没图形界面可以运行)
怎么设置一个控制它的快捷键?
我的理想目的为勾选“开始漩涡”后再按设置好的快捷键那么开始运行此程序!希望高手帮忙写出源码,谢谢了!!!

afan 发表于 2010-5-11 00:29:21

那个帖子别人帮你解决了,你声都不吭一声?也不改标题?

tianlong 发表于 2010-5-11 00:32:41

我正找呢啊,怎么改标题啊,我新手多多包涵!

tianlong 发表于 2010-5-11 00:41:42

回复 2# afan


改为已解决了,还是请高手解决下我这个帖子的问题:face (27):

afan 发表于 2010-5-11 01:06:39

HotKeySet("{Esc}", "Swirl")
GUICreate("超级漩涡", 445, 252, 335, 307)
$Checkbox1 = GUICtrlCreateCheckbox("开始漩涡", 160, 56, 81, 57)
GUISetState()

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit

        EndSwitch
WEnd

Func Swirl()
        If GUICtrlRead($Checkbox1) = 4 Then Return
        Local $flPI = 3.14159
        Local $iTime = 360 * 10, $iAngleStep = 5, $iR = 300, $iX, $iY
        Local $iCenterX = @DesktopWidth / 2, $iCenterY = @DesktopHeight / 2
        For $i = 0 To $iTime Step $iAngleStep
                $iX = Cos(($i + 90) / 360 * 2 * $flPI) * $iR
                $iY = Sin(($i + 90) / 360 * 2 * $flPI) * $iR
                $iR = Sin((90 - $iAngleStep) / 360 * 2 * $flPI) * $iR / Sin(90 / 360 * 2 * $flPI)
                MouseMove($iX + $iCenterX, $iY + $iCenterY, 1)
        Next
EndFunc   ;==>Swirl

tianlong 发表于 2010-5-11 09:39:36

:face (36):回复 5# afan
:face (36):太感谢afan版主了!!!

menfan1 发表于 2010-5-11 10:41:20

呵呵,走过路过

C.L 发表于 2010-5-11 11:15:21

增加个5#的山寨版,可自定义旋转圈数,可自定义鼠标移动快慢
HotKeySet("{Esc}", "Swirl")
GUICreate("超级漩涡", 445, 252, 335, 307)
$Checkbox1 = GUICtrlCreateCheckbox("开始漩涡", 160, 150, 81, 57)
$lable1 = GUICtrlCreateLabel("圈数(一半圈数向内旋,一半圈数向外旋):",160,30,250,25)
$lable2 = GUICtrlCreateLabel("移动快慢(1为最慢):",160,90,150,25)
$Input1 = GUICtrlCreateInput("15",160,50,50,25)
$Input2 = GUICtrlCreateInput("8",160,120,50,25)
$button = GUICtrlCreateButton ("开始运行",250,170)
GUISetState()

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit
                Case $button
                        Swirl()
        EndSwitch
WEnd

Func Swirl()
        If GUICtrlRead($Checkbox1) = 4 Then Return
        $round = GUICtrlRead ($Input1)
        $step = GUICtrlRead ($input2)
      _Circle(@DesktopWidth / 2, @DesktopHeight / 2, 200,$round,$step)
EndFunc   ;==>Swirl

Func _Circle($iCenterX, $iCenterY, $iRadius, $iRound = 20, $iStep = 5, $pi = 3.14159265358979)
        Local $iMouseX, $iMouseY,$iend = $iRound *360,$iR = $iRadius
        For $i = 1 To $iend Step $iStep
                $iMouseX = $iCenterX + $iR * Cos($i * $pi / 180)
                $iMouseY = $iCenterY + $iR * Sin($i * $pi / 180)
                $iR -= ($iRadius/($iRound/2)/(360/$iStep))
                MouseMove($iMouseX, $iMouseY, 1)
        Next
EndFunc   ;==>_Circle

Func _Exit()
      Exit
EndFunc   ;==>_Exit

tianlong 发表于 2010-5-11 16:12:30

好贴,学习中······
页: [1]
查看完整版本: 关于快捷键问题[已解决]