<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; HTA: Перетаскивание окна не за заголовок]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=877&amp;type=atom" />
	<updated>2007-11-23T07:51:08Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=877</id>
		<entry>
			<title type="html"><![CDATA[HTA: Перетаскивание окна не за заголовок]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=6324#p6324" />
			<content type="html"><![CDATA[<p>Если возникает желание убрать заголовок окна HTA приложения (чтобы он не занимал места), можно поставить <strong>caption=no</strong> и получить желаемый эффект. После этого необходимо обеспечить возможность перетакскивания окна мышью за любое место окна. Решение:<br /></p><div class="codebox"><pre><code>&lt;html&gt;
&lt;hta:application
maximizeButton=no
border=no
scroll=no
selection=no
contextMenu=no
caption=no
showInTaskBar=no
singleinstance=yes
version=1.0
&gt;
&lt;body&gt;Move: Right Click&lt;br&gt;Close: Alt+F4&lt;/body&gt;
&lt;script&gt;
window.resizeTo(200, 300);

var x0, y0;

document.onmousemove=function () {
    if ((event.button!=0)&amp;&amp;(event.button!=1)){
    //if (event.button!=0){
        window.moveBy(event.x-x0, event.y-y0);
        return false;
    }
    document.body.style.cursor=&quot;auto&quot;;
}

document.onmousedown=function () {
    if (event.button!=1){
        document.body.style.cursor=&quot;move&quot;;
        x0=event.x; y0=event.y;
    }
}

&lt;/script&gt;
&lt;/html&gt;</code></pre></div><p>Даное окно можно перетаскивать за любое место любой клавишей мыши, кроме первой (левой). Можно перетаскивать окно и вообще любой клавишей мыши (см. закомментированную строку в коде), но на многих системах перетаскивание левой клавишей мыши может приводить к ошибке &quot;Отказано в доступе&quot;.<br />Авторы решения - <strong>wisgest</strong> и <strong>mozers</strong>.</p>]]></content>
			<author>
				<name><![CDATA[The gray Cardinal]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=2</uri>
			</author>
			<updated>2007-11-23T07:51:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=6324#p6324</id>
		</entry>
</feed>
