Что нового

[GUI] Размер окна

SNAK

SNAK
Сообщения
59
Репутация
0
Как изменить размер активного окна ?
Допустим есть 3 кнопки 1 размер ,2 размер и 3
Код:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $sStart = 1

$long = @DesktopWidth
$short = @DesktopHeight
$xsenter = $long/2
$ysenter = $short/2
$razmer = 3

$tochka = GUICreate("", $razmer, $razmer, $xsenter-1, $ysenter+11, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_COMPOSITED)
GUISetBkColor(0xFF0000)
GUICtrlSetColor(1, 0xFF0000)
WinSetOnTop($tochka,"",1)
GUISetState(0)

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

  Func _Check()
    if $sStart = 1 Then
If GUICtrlRead ($Radio1) = 1 Then $razmer = 1
If GUICtrlRead ($Radio2) = 1 Then $razmer = 2
If GUICtrlRead ($Radio3) = 1 Then $razmer = 3
    EndIf
 EndFunc
 WEnd
 
A

Alofa

Гость
SNAK предоставьте работоспособный код.
 
Автор
SNAK

SNAK

SNAK
Сообщения
59
Репутация
0
Alofa сказал(а):
SNAK предоставьте работоспособный код.
Код:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $sStart = 1

$long = @DesktopWidth
$short = @DesktopHeight
$xsenter = $long/2
$ysenter = $short/2
$razmer = 3


$Form1 = GUICreate("FK Sight", 278, 104, 229, 260)
GUISetFont(8, 400, 0, "ObelixPro")
GUISetBkColor(0x808080)
$Group1 = GUICtrlCreateGroup("размер", 8, 8, 161, 57)
$Radio7 = GUICtrlCreateRadio("1", 16, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
$Radio8 = GUICtrlCreateRadio("2", 40, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
$Radio9 = GUICtrlCreateRadio("3", 64, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio10 = GUICtrlCreateRadio("4", 88, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
$Radio11 = GUICtrlCreateRadio("5", 112, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
$Radio12 = GUICtrlCreateRadio("6", 136, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("цвет", 176, 8, 89, 57)
$Radio1 = GUICtrlCreateRadio("к", 184, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetBkColor(-1, 0xFF0000)
$Radio2 = GUICtrlCreateRadio("ч", 208, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
GUICtrlSetBkColor(-1, 0x000000)
$Radio3 = GUICtrlCreateRadio("з", 232, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO,$BS_PUSHLIKE))
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("on", 8, 72, 75, 25)
$Button2 = GUICtrlCreateButton("off", 192, 72, 75, 25)
GUISetState(@SW_SHOW)

$tochka = GUICreate("", $razmer, $razmer, $xsenter-1, $ysenter+11, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_COMPOSITED)
GUISetBkColor(0xFF0000)
GUICtrlSetColor(1, 0xFF0000)
WinSetOnTop($tochka,"",1)
GUISetState(0)

While 1
   _Check()
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		 Case $Button1
			GUISetState(1,$tochka)
		 Case $Button2
			GUISetState(0,$tochka)
	EndSwitch
 WEnd

  Func _Check()
    if $sStart = 1 Then
If GUICtrlRead ($Radio1) = 1 Then GUISetBkColor(0xFF0000,$tochka)
If GUICtrlRead ($Radio2) = 1 Then GUISetBkColor(0x000000,$tochka)
If GUICtrlRead ($Radio3) = 1 Then GUISetBkColor(0x00FF00,$tochka)
If GUICtrlRead ($Radio7) = 1 Then $razmer = 1
If GUICtrlRead ($Radio8) = 1 Then $razmer = 2
If GUICtrlRead ($Radio9) = 1 Then $razmer = 3
If GUICtrlRead ($Radio10) = 1 Then $razmer = 4
If GUICtrlRead ($Radio11) = 1 Then $razmer = 5
If GUICtrlRead ($Radio12) = 1 Then $razmer = 6
    EndIf
 EndFunc
 
A

Alofa

Гость
Код:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $sStart = 1

$long = @DesktopWidth
$short = @DesktopHeight
$xsenter = $long / 2
$ysenter = $short / 2
; $razmer = 3
Local $aTochka[][2] = [[0, 3], [0, 6], [0, 9], [0, 12], [0, 15], [0, 18]]
Local $aRadio[][2] = [[0, 0xFF0000], [0, 0x000000], [0, 0x00FF00]]


$Form1 = GUICreate("FK Sight", 278, 104, 229, 260)
GUISetFont(8, 400, 0, "ObelixPro")
GUISetBkColor(0x808080)
$Group1 = GUICtrlCreateGroup("размер", 8, 8, 161, 57)
$aTochka[0][0] = GUICtrlCreateRadio("1", 16, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
$aTochka[1][0] = GUICtrlCreateRadio("2", 40, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
$aTochka[2][0] = GUICtrlCreateRadio("3", 64, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
GUICtrlSetState(-1, $GUI_CHECKED)
$aTochka[3][0] = GUICtrlCreateRadio("4", 88, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
$aTochka[4][0] = GUICtrlCreateRadio("5", 112, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
$aTochka[5][0] = GUICtrlCreateRadio("6", 136, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("цвет", 176, 8, 89, 57)
$aRadio[0][0] = GUICtrlCreateRadio("к", 184, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
GUICtrlSetState(-1, $GUI_CHECKED)
$aRadio[1][0] = GUICtrlCreateRadio("ч", 208, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
$aRadio[2][0] = GUICtrlCreateRadio("з", 232, 32, 25, 25, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("on", 8, 72, 75, 25)
$Button2 = GUICtrlCreateButton("off", 192, 72, 75, 25)
GUISetState(@SW_SHOW)

$tochka = GUICreate("", $aTochka[0][1], $aTochka[0][1], $xsenter - 1, $ysenter + 11, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_COMPOSITED)
GUISetBkColor(0xFF0000)
GUICtrlSetColor(1, 0xFF0000)
WinSetOnTop($tochka, "", 1)
GUISetState(0)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			GUISetState(1, $tochka)
		Case $Button2
			GUISetState(0, $tochka)
		Case $aRadio[0][0] To $aRadio[2][0]
			$j = $nMsg - $aRadio[0][0]
			GUISetBkColor($aRadio[$j][1], $tochka)
		Case $aTochka[0][0] To $aTochka[5][0]
			$i = $nMsg - $aTochka[0][0]
			WinMove($tochka, '', Default, Default, $aTochka[$i][1], $aTochka[$i][1])
	EndSwitch
WEnd
 
Верх