<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[פקד colorpicker מובנה של ווינדוס ב-C#]]></title><description><![CDATA[<p dir="rtl">רציתי מכמה טעמים לקרוא לcolorpicker של חלונות מתוך C#<br />
מצו"ב הקוד שגיבבתי מפה ומשם:<br />
עריכה: מסתבר שסתם בזבזתי זמן ומתוך רשלנות שחכתי לבדוק אם דבר כזה כבר קיים ראה להלן בהמשך השרשור</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace SystemColorPicker
{
    public class ColorPicker
    {
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
        public struct CHOOSECOLOR
        {
            public int lStructSize;
            public IntPtr hwndOwner;
            public IntPtr hInstance;
            public uint rgbResult;
            public IntPtr lpCustColors;
            public uint flags;
            public IntPtr lCustData;
            public IntPtr lpfnHook;
            [MarshalAs(UnmanagedType.LPTStr)]
            public string lpTemplateName;
        }

        [DllImport("comdlg32.dll", CharSet = CharSet.Auto)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ChooseColor(ref CHOOSECOLOR lpcc);

        public static bool GetColor(ref uint col)
        {
            CHOOSECOLOR CS = new CHOOSECOLOR();
            int structSize = Marshal.SizeOf(CS);
            CS.lStructSize = structSize;
            CS.hwndOwner = IntPtr.Zero;
            CS.flags = 0x1 | 0x2;
            CS.lpCustColors = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(uint)) * 16);
            CS.rgbResult = col;
            CS.hInstance = IntPtr.Zero;

            bool result = ChooseColor(ref CS);
            if (!result)
                return false;

            col = CS.rgbResult;

            Marshal.FreeCoTaskMem(CS.lpCustColors);
            return true;
        }
    }
}


</code></pre>
<p dir="rtl">וצורת השימוש בו היא</p>
<pre><code> uint color = 0;
 ColorPicker.GetColor(ref color);
</code></pre>
<p dir="rtl">האמת היא שאני מבין רק חלק מהקוד אשמח לקבל הצעות לשיפור ממי שבאמת מבין מה הולך פה</p>
]]></description><link>https://tchumim.com/topic/16277/פקד-colorpicker-מובנה-של-ווינדוס-ב-c</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 03:36:02 GMT</lastBuildDate><atom:link href="https://tchumim.com/topic/16277.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 May 2024 07:32:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to פקד colorpicker מובנה של ווינדוס ב-C# on Tue, 07 May 2024 08:04:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dovid" aria-label="Profile: dovid">@<bdi>dovid</bdi></a><br />
<img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f602.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--joy" style="height:23px;width:auto;vertical-align:middle" title=":joy:" alt="😂" /> <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f602.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--joy" style="height:23px;width:auto;vertical-align:middle" title=":joy:" alt="😂" /> <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f602.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--joy" style="height:23px;width:auto;vertical-align:middle" title=":joy:" alt="😂" /> <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f602.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--joy" style="height:23px;width:auto;vertical-align:middle" title=":joy:" alt="😂" /> <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f602.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--joy" style="height:23px;width:auto;vertical-align:middle" title=":joy:" alt="😂" /> <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f923.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--rolling_on_the_floor_laughing" style="height:23px;width:auto;vertical-align:middle" title=":rolling_on_the_floor_laughing:" alt="🤣" /> <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f923.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--rolling_on_the_floor_laughing" style="height:23px;width:auto;vertical-align:middle" title=":rolling_on_the_floor_laughing:" alt="🤣" /> <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f923.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--rolling_on_the_floor_laughing" style="height:23px;width:auto;vertical-align:middle" title=":rolling_on_the_floor_laughing:" alt="🤣" /> <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f923.png?v=cf1b4e11576" class="not-responsive emoji emoji-android emoji--rolling_on_the_floor_laughing" style="height:23px;width:auto;vertical-align:middle" title=":rolling_on_the_floor_laughing:" alt="🤣" /></p>
<p dir="rtl">כל כך התרגלתי שאין לי את הפקדים שאני צריך  ששחכתי לבדוק אם במקרה הזה יש אותו כבר מובנה.</p>
<p dir="rtl">אל דאגה זה לא לקח לי הרבה זמן לעשות קצת העתק הדבק וזהו<br />
הנטייה שלי למחוק את הפוסט למנוע את הפדיחות<br />
אבל אז אמרתי שיישאר ואולי מישהו אחר ייקח לקח לבדוק לפני.....</p>
]]></description><link>https://tchumim.com/post/162143</link><guid isPermaLink="true">https://tchumim.com/post/162143</guid><dc:creator><![CDATA[pcinfogmach]]></dc:creator><pubDate>Tue, 07 May 2024 08:04:05 GMT</pubDate></item><item><title><![CDATA[Reply to פקד colorpicker מובנה של ווינדוס ב-C# on Tue, 07 May 2024 06:35:39 GMT]]></title><description><![CDATA[<p dir="rtl">זה שונה מזה:</p>
<pre><code>new ColorDialog().ShowDialog();
</code></pre>
<p dir="auto">?</p>
]]></description><link>https://tchumim.com/post/162141</link><guid isPermaLink="true">https://tchumim.com/post/162141</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Tue, 07 May 2024 06:35:39 GMT</pubDate></item></channel></rss>