1

Тема: AHK: Перетаскивание GUI интерфейса

Gui, Parent: New, ,Example Custom Gui
Gui, Parent: -DPIScale 
Gui, Parent: Margin, 0, 0
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, Parent: Add, ActiveX, w598 h435 vWB, about:<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
WB.document.write(html)
WB.document.getElementById("myImage").src := StrReplace(A_ScriptDir . "\sh.png", "\", "/")
WB.document.getElementById("bu2").addEventListener("mouseup", Func("OnBu1"))
Gui, Parent: Show
Return

Как сделать этого GUI интерфейса перетаскивание

Post's attachments

hyXHtqag.jpg 17.1 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

2

Re: AHK: Перетаскивание GUI интерфейса

Переместить своё Gui окно можно так:

OnMessage(0x201, "WM_LBUTTONDOWN")	; Установить перехват зажима ЛКМ.

Gui, Parent: New, ,Example Custom Gui
Gui, Parent: -DPIScale 
Gui, Parent: Margin, 0, 0
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, Parent: Add, ActiveX, w598 h435 vWB, about:<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
WB.document.write(html)
WB.document.getElementById("myImage").src := StrReplace(A_ScriptDir . "\sh.png", "\", "/")
WB.document.getElementById("bu2").addEventListener("mouseup", Func("OnBu1"))
Gui, Parent: Show
Return

; Переместить окно:
WM_LBUTTONDOWN(wParam, lParam, msg, hwnd){
 PostMessage, 0xA1, 2,,, A
}
Win10x64, AHK v1.1.37.01 (Unicode 64-bit) | AHK-Wiki | Переменные и выражения | RegEx101

3

Re: AHK: Перетаскивание GUI интерфейса

ilaseshatov931 пишет:
WB.document.write(html)

А где html-то?

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

4

Re: AHK: Перетаскивание GUI интерфейса

__Михаил__
Не работает

5

Re: AHK: Перетаскивание GUI интерфейса

teadrinker


html =
(
<!DOCTYPE html>
<html>
 <head>
  <style>
	html, body
	{
	margin: 0px;
	background-color: #afafaf;
	}


.button1
	{
	position: absolute;
	top: 452px;
	left: 50px;
	}
	
.btn {
	display: inline-block;
	color: transparent;
	background-color: transparent;
	text-align: center;
	font-size: 17px;
	border-radius: 5px;
	width: 100px;
	height: 30px;
	box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.15);
	outline: none; 
	padding: none;
	border: 1px solid transparent;
	transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
 }


.bu2
{
	background-color: #0569b2;
	color: #061e37;
	font-family: Raleway;
	position: absolute;
	bottom: 80px;
}

.bu2:hover 
{
	color: #f87d01;
	background-color: #0569b2;
	border-color: #f87d01;
}
 
.bu2:active 
{
	color: #f87d01;
	background-color: #0569b2;
	border-color: #f87d01;
}




  </style>
 </head>
<body>
<div class="bgded" id="bgimg"> 
	<div class="menu">
	<img id="myImage">
	<div class="button1">
	<button type="button" class="btn bu2" id="bu2">Меню UH</button>
		</div>
	</div>
</div>
</body>
</html>
)

OnEgypt() {

global WBEgypt

html =
(
<!DOCTYPE html>
<html>
	<head>
		<style>
		.btn {
			display: inline-block;
			color: transparent;
			background-color: transparent;
			text-align: center;
			font-size: 18px;
			border-radius: 5px;
			width: 150px;
			height: 55px;
			box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.15);
			outline: none;
			padding: none;
			border: 1px solid transparent;
			transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
		}

		.Confirm
		{
			display: block;
			color: #237976;
			font-family: Raleway;
			font-weight: bold;
			position: relative;
			margin-left: auto;
			margin-right: auto;
			margin-top: 10`%;
			font-size: 20.85px;
			border-color: #237976;
		}

		.Confirm:hover 
		{
			color: #FFFFFF;
			background-color: #237976;
			border-color: transparent;
		}

		.Confirm:active 
		{
			color: #FFFFFF;
			background-color: #237976;
			border-color: transparent;
		}
		
		h1 
		{
			font-family: Raleway;
			font-weight: 600;
			font-size: 27px;
			margin: 25px; 
			outline: none; 
			padding: none;
		}
		
		.sText
		{
			text-align: left;
		}
		
		body
		{
			text-align: center;
		}
		
		html
		{
			width: 500px;
			height: 300px;
		}
		</style>
	</head>
	<body>
		<h1>Египетский</h1>
		<div class="sText">
		<h1 id="st"></h1>
		</div>
		<button type="button" id="ex" class="btn Confirm">OK</button>
	</body>
</html>
)

Gui, Egypt: New, , Египетский
Gui, Egypt: Margin, 0, 0
Gui, Egypt: Add, ActiveX, w500 h300 vWBEgypt, about:<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
WBEgypt.document.write(html)
WBEgypt.document.getElementById("ex").addEventListener("mouseup", Func("OnClose"))
WBEgypt.document.getElementById("st").innerHTML := ("Счетчик: " . Counts " <br> Время: " . ElapsedTime3 . " min, " . ElapsedTime4 . " sec")
Gui, Egypt: Show
return

EgyptGuiClose:
Gui, Destroy
return
}

OnErr() {

global WBErr

html =
(
<!DOCTYPE html>
<html>
	<head>
		<style>
		.btn {
			display: inline-block;
			color: transparent;
			background-color: transparent;
			text-align: center;
			font-size: 18px;
			border-radius: 5px;
			width: 150px;
			height: 55px;
			box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.15);
			outline: none;
			padding: none;
			top: 50px;
			border: 1px solid transparent;
			transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
		}

		.Confirm
		{
			display: block;
			color: #237976;
			font-family: Raleway;
			font-weight: bold;
			position: relative;
			margin-left: auto;
			margin-right: auto;
			margin-top: 10`%;
			font-size: 20.85px;
			border-color: #237976;
		}

		.Confirm:hover 
		{
			color: #FFFFFF;
			background-color: #237976;
			border-color: transparent;
		}

		.Confirm:active 
		{
			color: #FFFFFF;
			background-color: #237976;
			border-color: transparent;
		}
		
		h1 
		{
			font-family: Raleway;
			font-weight: 600;
			font-size: 27px;
			margin: 25px; 
			outline: none; 
			padding: none;
			text-align: center;
		}
		
		.sText
		{
			text-align: left;
		}
		
		body
		{
			text-align: center;
		}
		
		html
		{
			width: 300px;
			height: 300px;
		}
		</style>
	</head>
	<body>
		<h1>Ошибка</h1>
		<div class="sText">
		<h1 id="li"></h1>
		<h1>
		Ошибка</h1>
		</div>
		<button type="button" id="ex" class="btn Confirm">OK</button>
	</body>
</html>
)

Gui, Err: New, , Ошибка
Gui, Err: Margin, 0, 0
Gui, Err: Add, ActiveX, w300 h300 vWBErr, about:<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
WBErr.document.write(html)
WBErr.document.getElementById("ex").addEventListener("mouseup", Func("OnClose"))
Gui, Err: Show
return

ErrGuiClose:
Gui, Destroy
return
}

OnBu1() {

global WBBu1

html =
(
<!DOCTYPE html>
<html>
	<head>
		<style>
		.btn {
			display: inline-block;
			color: transparent;
			background-color: transparent;
			text-align: center;
			font-size: 18px;
			border-radius: 5px;
			width: 150px;
			height: 55px;
			box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.15);
			outline: none;
			padding: none;
			border: 1px solid transparent;
			transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
		}

		.Confirm
		{
			display: block;
			color: #237976;
			font-family: Raleway;
			font-weight: bold;
			position: relative;
			margin-left: auto;
			margin-right: auto;
			margin-top: 10`%;
			font-size: 20.85px;
			border-color: #237976;
		}

		.Confirm:hover 
		{
			color: #FFFFFF;
			background-color: #237976;
			border-color: transparent;
		}

		.Confirm:active 
		{
			color: #FFFFFF;
			background-color: #237976;
			border-color: transparent;
		}
		
		h1 
		{
			font-family: Raleway;
			font-weight: 600;
			font-size: 27px;
			margin: 25px; 
			outline: none; 
			padding: none;
			text-align: center;
		}
		
		.sText
		{
			text-align: left;
		}
		
		body
		{
			text-align: center;
		}
		
		html
		{
			width: 300px;
			height: 300px;
		}
		</style>
	</head>
	<body>
		<h1>BUTTON</h1>
		<div class="sText">
		<h1 id="li">BUTTONS</h1>
		</div>
		<button type="button" id="ex" class="btn Confirm">OK</button>
	</body>
</html>
)

Gui, Bu1: New, , Button
Gui, Bu1: Margin, 0, 0
Gui, Bu1: Add, ActiveX, w300 h300 vWBBu1, about:<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
WBBu1.document.write(html)
WBBu1.document.getElementById("ex").addEventListener("mouseup", Func("OnClose"))
Gui, Bu1: Show
return

Bu1GuiClose:
Gui, Destroy
return
}

OnButton() {
   MsgBox, Hi
   return
}

OnReelect() {
	Msgbox, hi
	return
}

OnClose() {
	Gui Err: Destroy
	Gui Bu1: Destroy
	Gui Egypt: Destroy
	return
}

6

Re: AHK: Перетаскивание GUI интерфейса

ilaseshatov931
Не работает.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

7 (изменено: ilaseshatov931, 2021-02-07 20:13:21)

Re: AHK: Перетаскивание GUI интерфейса

Если убриаю Gui, -Caption -Border то работает
снизу код без Gui, -Caption -Border
Может кто нибудь оптимизировать мой код

#NoEnv
#include Forun.ahk
CoordMode, mouse
SetWorkingDir %A_ScriptDir%
SetWinDelay, -1
global hGui1, hB1, hB2
global Counts := ""
global ElapsedTime := ""
global ElapsedTime2 := ""
global ElapsedTime3 := ""
global ElapsedTime4 := ""

gamewin = 
posX1 := ""
posX2 := ""
posX3 := ""

Gui, Parent: New, ,Example Custom Gui
Gui, Parent: -DPIScale 
Gui, Parent: Margin, 0, 0
Gui, Parent: Add, ActiveX, w598 h435 vWB, about:<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
WB.document.write(html)
WB.document.getElementById("myImage").src := StrReplace(A_ScriptDir . "\sh.png", "\", "/")
WB.document.getElementById("bu2").addEventListener("mouseup", Func("OnBu1"))
Gui, Parent: Show

Return


GuiClose:
   ExitApp
   
F12::ExitApp

Это инклуд HTML


html =
(
<!DOCTYPE html>
<html>
 <head>
  <style>
	html, body
	{
	margin: 0px;
	background-color: #afafaf;
	}


.button1
	{
	position: absolute;
	top: 452px;
	left: 50px;
	}
	
.btn {
	display: inline-block;
	color: transparent;
	background-color: transparent;
	text-align: center;
	font-size: 17px;
	border-radius: 5px;
	width: 100px;
	height: 30px;
	box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.15);
	outline: none; 
	padding: none;
	border: 1px solid transparent;
	transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
 }


.bu2
{
	background-color: #0569b2;
	color: #061e37;
	font-family: Raleway;
	position: absolute;
	bottom: 80px;
}

.bu2:hover 
{
	color: #f87d01;
	background-color: #0569b2;
	border-color: #f87d01;
}
 
.bu2:active 
{
	color: #f87d01;
	background-color: #0569b2;
	border-color: #f87d01;
}




  </style>
 </head>
<body>
<div class="bgded" id="bgimg"> 
	<div class="menu">
	<img id="myImage">
	<div class="button1">
	<button type="button" class="btn bu2" id="bu2">Меню UH</button>
		</div>
	</div>
</div>
</body>
</html>
)



OnBu1() {

global WBBu1

html =
(
<!DOCTYPE html>
<html>
	<head>
		<style>
		.btn {
			display: inline-block;
			color: transparent;
			background-color: transparent;
			text-align: center;
			font-size: 18px;
			border-radius: 5px;
			width: 150px;
			height: 55px;
			box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.15);
			outline: none;
			padding: none;
			border: 1px solid transparent;
			transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
		}

		.Confirm
		{
			display: block;
			color: #237976;
			font-family: Raleway;
			font-weight: bold;
			position: relative;
			margin-left: auto;
			margin-right: auto;
			margin-top: 10`%;
			font-size: 20.85px;
			border-color: #237976;
		}

		.Confirm:hover 
		{
			color: #FFFFFF;
			background-color: #237976;
			border-color: transparent;
		}

		.Confirm:active 
		{
			color: #FFFFFF;
			background-color: #237976;
			border-color: transparent;
		}
		
		h1 
		{
			font-family: Raleway;
			font-weight: 600;
			font-size: 27px;
			margin: 25px; 
			outline: none; 
			padding: none;
			text-align: center;
		}
		
		.sText
		{
			text-align: left;
		}
		
		body
		{
			text-align: center;
		}
		
		html
		{
			width: 300px;
			height: 300px;
		}
		</style>
	</head>
	<body>
		<h1>BUTTON</h1>
		<div class="sText">
		<h1 id="li">BUTTONS</h1>
		</div>
		<button type="button" id="ex" class="btn Confirm">OK</button>
	</body>
</html>
)

Gui, Bu1: New, , Button
Gui, Bu1: Margin, 0, 0
Gui, Bu1: Add, ActiveX, w300 h300 vWBBu1, about:<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
WBBu1.document.write(html)
WBBu1.document.getElementById("ex").addEventListener("mouseup", Func("OnClose"))
Gui, Bu1: Show
return

Bu1GuiClose:
Gui, Destroy
return
}

OnButton() {
   MsgBox, Hi
   return
}

OnReelect() {
	Msgbox, hi
	return
}

OnClose() {
	Gui Err: Destroy
	Gui Bu1: Destroy
	Gui Egypt: Destroy
	return
}

8 (изменено: teadrinker, 2021-02-07 20:16:22)

Re: AHK: Перетаскивание GUI интерфейса

ilaseshatov931, если хотите получить ответ на конкретный вопрос, нужно выложить наиболее простой код, демонстрирующий проблему, который сразу можно запустить. Не стоит выкладывать простыню на 100500 строк, никому не охота будет в ней разбираться.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

9

Re: AHK: Перетаскивание GUI интерфейса

teadrinker
ну вы просто скажите можно ли GUI перетаскать когда есть Gui, -Caption -Border

10

Re: AHK: Перетаскивание GUI интерфейса

ilaseshatov931, предложения должны начинаться с заглавной буквы и заканчиваться знаками препинания. Исправьте здесь и в этой теме.

11

Re: AHK: Перетаскивание GUI интерфейса

ilaseshatov931, можно. Но может зависеть от того, какой элемент в фокусе. Поясню, когда оформление исправите.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

12

Re: AHK: Перетаскивание GUI интерфейса

исправилteadrinker

13

Re: AHK: Перетаскивание GUI интерфейса

Что-то не вижу, что исправили.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

14

Re: AHK: Перетаскивание GUI интерфейса

ilaseshatov931 О, знакомый код).

GD