<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Прозрачный GUI с библиотекой GdiP]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16266&amp;type=atom" />
	<updated>2021-04-17T01:22:46Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16266</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Прозрачный GUI с библиотекой GdiP]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147379#p147379" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong></p><p>Ну если убрать всё лишнее и использовать только сам принцип использования, то код можно уместить и в 15 строчек кода.<br />Ведь Gdip библиотека, сама по себе, тоже хранит достаточно много строчек кода.</p><p>Поэтому не вижу в этом особой проблемы, в угоду хорошего дизайна и больших возможностей, как для того же Радиального меню, когда нужно сделать красивое развёртывание интерфейса.</p>]]></content>
			<author>
				<name><![CDATA[Clannad5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39853</uri>
			</author>
			<updated>2021-04-17T01:22:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147379#p147379</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Прозрачный GUI с библиотекой GdiP]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147378#p147378" />
			<content type="html"><![CDATA[<p>Пример конечно хороший, но на мой взгляд много строк.<br />Легче использовать вариант по стандарту и без библиотеки: <a href="http://forum.script-coding.com/viewtopic.php?pid=147337#p147337">ссылка</a>. У него плюс в том, что можно самому указать цвет прозрачного цвета, минус в том, что только один.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2021-04-16T16:50:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147378#p147378</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Прозрачный GUI с библиотекой GdiP]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147369#p147369" />
			<content type="html"><![CDATA[<p>Данный скрипт демонстрирует GUI окно с прозрачными краями, при помощи обычной Png/Bmp картинки с Альфа-каналом.</p><div class="codebox"><pre><code>
; Code from http://www.autohotkey.com/board/topic/80924-make-windows-background-transparent-but-not-its-content/?p=514404
#SingleInstance, Force
#NoEnv
detecthiddenwindows on
SetBatchLines, -1

onexit exit_

#include gdip.ahk    ;download http://www.autohotkey.com/forum/topic32238.html 

If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}


Gui, 1:  -Caption +E0x80000 +LastFound +OwnDialogs +Owner +alwaysontop
Gui, 1: Show, NA
gui +lastfound
hwnd := WinExist()


sFile=%a_scriptdir%\BG.bmp

pBitmap:=Gdip_CreateBitmapFromFile(sFile)
Gdip_GetDimensions(pBitmap, w, h)

hbm := CreateDIBSection(w,h)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
pGraphics := Gdip_GraphicsFromHDC(hdc)


Gdip_DrawImage(pGraphics, pBitmap,0,0,w,h)
UpdateLayeredWindow(hwnd, hdc, (A_ScreenWidth-w)//2, (A_ScreenHeight-h)//2, w,h)

OnMessage(0x201, &quot;WM_LBUTTONDOWN&quot;)
return



WM_LBUTTONDOWN()
{
	PostMessage, 0xA1, 2
}


esc::
exit_:
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(pGraphics)
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
ExitApp
</code></pre></div><p>Скриншот с примером:</p><p><span class="postimg"><img src="https://i.imgur.com/JBcmwxe.png" alt="https://i.imgur.com/JBcmwxe.png" /></span></p><p>Используется библиотека Gdip: <a href="http://www.autohotkey.com/forum/topic32238.html">http://www.autohotkey.com/forum/topic32238.html</a><br />Код взять отсюда: <a href="http://www.autohotkey.com/board/topic/80924-make-windows-background-transparent-but-not-its-content/?p=514404">http://www.autohotkey.com/board/topic/8 … /?p=514404</a></p>]]></content>
			<author>
				<name><![CDATA[Clannad5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39853</uri>
			</author>
			<updated>2021-04-16T13:11:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147369#p147369</id>
		</entry>
</feed>
