<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: задание фона в ListView]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10532&amp;type=atom" />
	<updated>2015-03-29T12:19:43Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10532</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92843#p92843" />
			<content type="html"><![CDATA[<p>А понял, авто-размер столбов. Спасибо</p>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-03-29T12:19:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92843#p92843</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92842#p92842" />
			<content type="html"><![CDATA[<p>В данном конкретном случае не нужна, а, например:<br /></p><div class="codebox"><pre><code>#SingleInstance,Force
Gui, +LastFound
Gui, Add, ListView, x5 y5 w200 h200 vLV_Sample hwndlv,Номер|День|Месяц
lv:=new ListView(lv)
LV.Add(&quot;&quot;,1,&quot;Понедельник&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,2,&quot;Вторник&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,3,&quot;Среда&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,4,&quot;Четверг&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,5,&quot;Пятница&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,6,&quot;Субота&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,7,&quot;Воскресенье&quot;,&quot;Сентябрь&quot;)
Gui,Show, w210 h210

lv.Color(1,0xA8FFFF,0xC030FF)

lv.Color(3,0xA8FFFF,0xA8FF84)

WinSet,Redraw,,A
Return 
GuiClose:
GuiEscape:
Exitapp
class ListView{
    static list:=[]
    __New(hwnd){
        this.list[hwnd]:=this
        OnMessage(0x4e,&quot;WM_NOTIFY&quot;)
        this.hwnd:=hwnd
        this.control:=[]
    }
    add(options,items*){
        Gui,ListView,% this.hwnd
        for a,b in items{
            if A_Index=1
                item:=LV_Add(options,b)
            Else
                LV_Modify(item,&quot;col&quot; A_Index,b)
        }
    }
    clear(){
        this.control:=[]
    }
    Color(item,fore=&quot;&quot;,back=&quot;&quot;){
        LV_GetText(text,item)
        if fore!=&quot;&quot;
            this.Control[text,&quot;fore&quot;]:=fore
        if Back!=&quot;&quot;
            this.Control[text,&quot;back&quot;]:=back
    }
}
WM_NOTIFY(Param*){
    Critical
    control:=
    if (this:=ListView.list[NumGet(Param.2)])&amp;&amp;(NumGet(Param.2,2*A_PtrSize,&quot;int&quot;)=-12){
        stage:=NumGet(Param.2,3*A_PtrSize,&quot;uint&quot;)
        if (stage=1)
            return 0x20 ;sets CDRF_NOTIFYITEMDRAW
        if (stage=0x10001){ ;NM_CUSTOMDRAW &amp;&amp; Control is in the list
            index:=numget(Param.2,A_PtrSize=4?9*A_PtrSize:7*A_PtrSize,&quot;uint&quot;)
            LV_GetText(text,index+1)
            info:=this.Control[text]
            if info.fore!=&quot;&quot;
                NumPut(info.fore,Param.2,A_PtrSize=4?12*A_PtrSize:10*A_PtrSize,&quot;int&quot;) ;sets the foreground
            if info.back!=&quot;&quot;
                NumPut(info.back,Param.2,A_PtrSize=4?13*A_PtrSize:10.5*A_PtrSize,&quot;int&quot;) ;sets the background
        }
    }
}</code></pre></div><p>и<br /></p><div class="codebox"><pre><code>#SingleInstance,Force
Gui, +LastFound
Gui, Add, ListView, x5 y5 w200 h200 vLV_Sample hwndlv,Номер|День|Месяц
lv:=new ListView(lv)
LV.Add(&quot;&quot;,1,&quot;Понедельник&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,2,&quot;Вторник&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,3,&quot;Среда&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,4,&quot;Четверг&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,5,&quot;Пятница&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,6,&quot;Субота&quot;,&quot;Сентябрь&quot;)
LV.Add(&quot;&quot;,7,&quot;Воскресенье&quot;,&quot;Сентябрь&quot;)
LV_ModifyCol(2,&quot;AutoHdr&quot;)
Gui,Show, w210 h210

lv.Color(1,0xA8FFFF,0xC030FF)

lv.Color(3,0xA8FFFF,0xA8FF84)

WinSet,Redraw,,A
Return 
GuiClose:
GuiEscape:
Exitapp
class ListView{
    static list:=[]
    __New(hwnd){
        this.list[hwnd]:=this
        OnMessage(0x4e,&quot;WM_NOTIFY&quot;)
        this.hwnd:=hwnd
        this.control:=[]
    }
    add(options,items*){
        Gui,ListView,% this.hwnd
        for a,b in items{
            if A_Index=1
                item:=LV_Add(options,b)
            Else
                LV_Modify(item,&quot;col&quot; A_Index,b)
        }
    }
    clear(){
        this.control:=[]
    }
    Color(item,fore=&quot;&quot;,back=&quot;&quot;){
        LV_GetText(text,item)
        if fore!=&quot;&quot;
            this.Control[text,&quot;fore&quot;]:=fore
        if Back!=&quot;&quot;
            this.Control[text,&quot;back&quot;]:=back
    }
}
WM_NOTIFY(Param*){
    Critical
    control:=
    if (this:=ListView.list[NumGet(Param.2)])&amp;&amp;(NumGet(Param.2,2*A_PtrSize,&quot;int&quot;)=-12){
        stage:=NumGet(Param.2,3*A_PtrSize,&quot;uint&quot;)
        if (stage=1)
            return 0x20 ;sets CDRF_NOTIFYITEMDRAW
        if (stage=0x10001){ ;NM_CUSTOMDRAW &amp;&amp; Control is in the list
            index:=numget(Param.2,A_PtrSize=4?9*A_PtrSize:7*A_PtrSize,&quot;uint&quot;)
            LV_GetText(text,index+1)
            info:=this.Control[text]
            if info.fore!=&quot;&quot;
                NumPut(info.fore,Param.2,A_PtrSize=4?12*A_PtrSize:10*A_PtrSize,&quot;int&quot;) ;sets the foreground
            if info.back!=&quot;&quot;
                NumPut(info.back,Param.2,A_PtrSize=4?13*A_PtrSize:10.5*A_PtrSize,&quot;int&quot;) ;sets the background
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-03-29T10:49:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92842#p92842</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92840#p92840" />
			<content type="html"><![CDATA[<p>В оригинальном скрипте автора используется вот такая функция <strong>LV_ModifyCol</strong>. Для чего она? я её в своем примере убрал так, как вроде нечего не изменилось.</p>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-03-29T09:51:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92840#p92840</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92836#p92836" />
			<content type="html"><![CDATA[<p>yalanne, спасибо. То, что доктор прописал <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[equipment66]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27128</uri>
			</author>
			<updated>2015-03-29T07:02:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92836#p92836</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92828#p92828" />
			<content type="html"><![CDATA[<p>О, не знал! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-03-28T23:27:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92828#p92828</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92826#p92826" />
			<content type="html"><![CDATA[<p>Можно!<br />Вот пожалуйста:<br /></p><div class="codebox"><pre><code>#SingleInstance,Force
Gui, +LastFound
Gui, Add, ListView, x5 y5 w200 h200 vLV_Sample hwndlv,Номер|День
lv:=new ListView(lv)
LV.Add(&quot;&quot;,1,&quot;Понедельник&quot;)
LV.Add(&quot;&quot;,2,&quot;Вторник&quot;)
LV.Add(&quot;&quot;,3,&quot;Среда&quot;)
LV.Add(&quot;&quot;,4,&quot;Четверг&quot;)
LV.Add(&quot;&quot;,5,&quot;Пятница&quot;)
LV.Add(&quot;&quot;,6,&quot;Субота&quot;)
LV.Add(&quot;&quot;,7,&quot;Воскресенье&quot;)
Gui,Show,x50 y50 w210 h210

lv.Color(1,0xA8FFFF,0xC030FF)

lv.Color(3,0xA8FFFF,0xA8FF84)

WinSet,Redraw,,A
Return 
GuiClose:
GuiEscape:
Exitapp
class ListView{
    static list:=[]
    __New(hwnd){
        this.list[hwnd]:=this
        OnMessage(0x4e,&quot;WM_NOTIFY&quot;)
        this.hwnd:=hwnd
        this.control:=[]
    }
    add(options,items*){
        Gui,ListView,% this.hwnd
        for a,b in items{
            if A_Index=1
                item:=LV_Add(options,b)
            Else
                LV_Modify(item,&quot;col&quot; A_Index,b)
        }
    }
    clear(){
        this.control:=[]
    }
    Color(item,fore=&quot;&quot;,back=&quot;&quot;){
        LV_GetText(text,item)
        if fore!=&quot;&quot;
            this.Control[text,&quot;fore&quot;]:=fore
        if Back!=&quot;&quot;
            this.Control[text,&quot;back&quot;]:=back
    }
}
WM_NOTIFY(Param*){
    Critical
    control:=
    if (this:=ListView.list[NumGet(Param.2)])&amp;&amp;(NumGet(Param.2,2*A_PtrSize,&quot;int&quot;)=-12){
        stage:=NumGet(Param.2,3*A_PtrSize,&quot;uint&quot;)
        if (stage=1)
            return 0x20 ;sets CDRF_NOTIFYITEMDRAW
        if (stage=0x10001){ ;NM_CUSTOMDRAW &amp;&amp; Control is in the list
            index:=numget(Param.2,A_PtrSize=4?9*A_PtrSize:7*A_PtrSize,&quot;uint&quot;)
            LV_GetText(text,index+1)
            info:=this.Control[text]
            if info.fore!=&quot;&quot;
                NumPut(info.fore,Param.2,A_PtrSize=4?12*A_PtrSize:10*A_PtrSize,&quot;int&quot;) ;sets the foreground
            if info.back!=&quot;&quot;
                NumPut(info.back,Param.2,A_PtrSize=4?13*A_PtrSize:10.5*A_PtrSize,&quot;int&quot;) ;sets the background
        }
    }
}</code></pre></div><p>Взято от <a href="http://www.autohotkey.com/board/topic/104869-listview-custom-colors-ahk-11">сюда.</a><br />и 16й код цвета можно подобрать&nbsp; <a href="http://www.mathsisfun.com/hexadecimal-decimal-colors.html">тут.</a></p>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-03-28T20:57:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92826#p92826</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92825#p92825" />
			<content type="html"><![CDATA[<p>Спасибо</p>]]></content>
			<author>
				<name><![CDATA[equipment66]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27128</uri>
			</author>
			<updated>2015-03-28T20:51:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92825#p92825</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92824#p92824" />
			<content type="html"><![CDATA[<p>Нельзя.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-03-28T20:45:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92824#p92824</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: задание фона в ListView]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92823#p92823" />
			<content type="html"><![CDATA[<p>Доброе время суток,</p><p>Есть ли возможность в ListView задать фон разного цвета для строк или столбцов (для лучшей читаемости)?</p>]]></content>
			<author>
				<name><![CDATA[equipment66]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27128</uri>
			</author>
			<updated>2015-03-28T20:41:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92823#p92823</id>
		</entry>
</feed>
