<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>ClipboardFusion RSS: Just an FYI: If the builtin Dialog options are sometimes too limiting for what you are trying to do, you can use Windows Form.</title>
<atom:link href="https://www.clipboardfusion.com/Discussions/RSS/?TopicID=d6826fca-52ff-44c6-857b-131224d329a4" rel="self" type="application/rss+xml" />
<link>https://www.clipboardfusion.com/Discussions/RSS/?TopicID=d6826fca-52ff-44c6-857b-131224d329a4</link>
<description>ClipboardFusion RSS: Just an FYI: If the builtin Dialog options are sometimes too limiting for what you are trying to do, you can use Windows Form.</description>
<lastBuildDate>Thu, 22 Oct 2026 23:36:25 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.clipboardfusion.com/Discussions/RSS/?TopicID=d6826fca-52ff-44c6-857b-131224d329a4</generator>
<item>
<title>Just an FYI: If the builtin Dialog options are sometimes too limiting for what you are trying to do, you can use Windows Form.</title>
<link>https://www.clipboardfusion.com/Discussions/View/just-an-fyi-if-the-builtin-dialog-options-are-sometimes-too-limiting-for-what-you-are-trying-to-do-you-can-use-windows-form/?ID=d6826fca-52ff-44c6-857b-131224d329a4</link>
<pubDate>Thu, 30 Mar 2023 14:13:36 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/just-an-fyi-if-the-builtin-dialog-options-are-sometimes-too-limiting-for-what-you-are-trying-to-do-you-can-use-windows-form/?ID=d6826fca-52ff-44c6-857b-131224d329a4</guid>
<category>ClipboardFusion</category>
<description><![CDATA[Just posting this here incase anyone was wondering.
Seems to work pretty well, you can tab around to the various controls, force it to the top, have a default button etc.
Example macro (Name Formatter) I made using this knowledge as someone who doesn't use C# very frequently.
A spoiler tag wou...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Just posting this here incase anyone was wondering.<br/>
<br/>
Seems to work pretty well, you can tab around to the various controls, force it to the top, have a default button etc.<br/>
<br/>
Example macro (Name Formatter) I made using this knowledge as someone who doesn't use C# very frequently.<br/>
<br/>
A spoiler tag would probably be ideal for this.<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code01a165f917b574e79873285f55dbb122" class="ClipboardCopyControl"><img src="https://www.clipboardfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code01a165f917b574e79873285f55dbb122Js'); return false;"><img src="https://www.clipboardfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code01a165f917b574e79873285f55dbb122Js" name="code01a165f917b574e79873285f55dbb122Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%;min-height:75px">using System;&#xA;using System.Linq;&#xA;using System.Collections.Generic;&#xA;using System.Text.RegularExpressions;&#xA;using System.Windows.Forms;&#xA;using System.Drawing;&#xA;using System.Collections.ObjectModel;&#xA;&#xA;// The &#x27;text&#x27; parameter will contain the text from the:&#xA;//   - Current Clipboard when run by HotKey&#xA;//   - History Item when run from the History Menu&#xA;// The returned string will be:&#xA;//   - Placed directly on the Clipboard when run as a Macro&#xA;//   - Ignored by ClipboardFusion if it is &#x27;null&#x27;&#xA;//   - Passed along to the next action in a Trigger (null changed to an empty string)&#xA;public static class ClipboardFusionHelper&#xA;{&#xA;    /// &amp;lt;summary&amp;gt;&#xA;    /// Enum &amp;lt;c&amp;gt;OutputQouteType&amp;lt;/c&amp;gt; contains the different types of qoutes that can be used.&#xA;    /// &amp;lt;/summary&amp;gt;&#xA;    public enum OutputQouteType&#xA;    {&#xA;        QoutedDouble,&#xA;        QoutedSingle,&#xA;        QoutedBacktick,&#xA;        Unqouted,&#xA;    }&#xA;&#xA;    /// &amp;lt;summary&amp;gt;&#xA;    /// Dictionary &amp;lt;c&amp;gt;OutputQouteTypeDictionary&amp;lt;/c&amp;gt; contains the values for the different types of qoutes that can be used.&#xA;    /// &amp;lt;/summary&amp;gt;&#xA;    public static readonly ReadOnlyDictionary&amp;lt;OutputQouteType, string&amp;gt; OutputQouteTypeDictionary =&#xA;        new ReadOnlyDictionary&amp;lt;OutputQouteType, string&amp;gt;(&#xA;            new Dictionary&amp;lt;OutputQouteType, string&amp;gt;&#xA;            {&#xA;                { OutputQouteType.QoutedDouble, &quot;\&quot;&quot; },&#xA;                { OutputQouteType.QoutedSingle, &quot;&#x27;&quot; },&#xA;                { OutputQouteType.QoutedBacktick, &quot;`&quot; },&#xA;                { OutputQouteType.Unqouted, &quot;&quot; },&#xA;            }&#xA;        );&#xA;&#xA;    /// &amp;lt;summary&amp;gt;&#xA;    /// Enum &amp;lt;c&amp;gt;OutputDelimiterType&amp;lt;/c&amp;gt; contains the different types of delimiters that can be used.&#xA;    /// &amp;lt;/summary&amp;gt;&#xA;    public enum OutputDelimiterType&#xA;    {&#xA;        Space,&#xA;        Dot,&#xA;        Comma,&#xA;        Tab,&#xA;        NewLine,&#xA;        Semicolon,&#xA;        Colon,&#xA;        None,&#xA;    };&#xA;&#xA;    /// &amp;lt;summary&amp;gt;&#xA;    /// Dictionary &amp;lt;c&amp;gt;OutputDelimiterTypeDictionary&amp;lt;/c&amp;gt; contains the values for the different types of delimiters that can be used.&#xA;    /// &amp;lt;/summary&amp;gt;&#xA;    public static readonly ReadOnlyDictionary&amp;lt;&#xA;        OutputDelimiterType,&#xA;        string&#xA;    &amp;gt; OutputDelimiterTypeDictionary = new ReadOnlyDictionary&amp;lt;OutputDelimiterType, string&amp;gt;(&#xA;        new Dictionary&amp;lt;OutputDelimiterType, string&amp;gt;&#xA;        {&#xA;            { OutputDelimiterType.Space, &quot; &quot; },&#xA;            { OutputDelimiterType.Dot, &quot;.&quot; },&#xA;            { OutputDelimiterType.Comma, &quot;,&quot; },&#xA;            { OutputDelimiterType.Tab, &quot;\t&quot; },&#xA;            { OutputDelimiterType.NewLine, &quot;\n&quot; },&#xA;            { OutputDelimiterType.Semicolon, &quot;;&quot; },&#xA;            { OutputDelimiterType.Colon, &quot;:&quot; },&#xA;            { OutputDelimiterType.None, &quot;&quot; },&#xA;        }&#xA;    );&#xA;&#xA;    /// &amp;lt;summary&amp;gt;&#xA;    /// Enum &amp;lt;c&amp;gt;OutputCaseType&amp;lt;/c&amp;gt; contains the different types of cases that can be used.&#xA;    /// &amp;lt;/summary&amp;gt;&#xA;    public enum OutputCaseType&#xA;    {&#xA;        /// &amp;lt;summary&amp;gt;The first letter of each word is capitalized, and the rest of the word is lower case.&amp;lt;/summary&amp;gt;&#xA;        TitleCase,&#xA;&#xA;        /// &amp;lt;summary&amp;gt;All letters are capitalized.&amp;lt;/summary&amp;gt;&#xA;        UpperCase,&#xA;&#xA;        /// &amp;lt;summary&amp;gt;All letters are lower case.&amp;lt;/summary&amp;gt;&#xA;        LowerCase,&#xA;&#xA;        /// &amp;lt;summary&amp;gt;The first letter of the first word is lower case, and the rest of the word is lower case.&amp;lt;/summary&amp;gt;&#xA;        SentenceCase,&#xA;&#xA;        /// &amp;lt;summary&amp;gt;Each word is randomly capitalized.&amp;lt;/summary&amp;gt;&#xA;        MemeCase,&#xA;    };&#xA;&#xA;    /// &amp;lt;summary&amp;gt;&#xA;    /// Method &amp;lt;c&amp;gt;ProcessText&amp;lt;/c&amp;gt; Creates a window with comboboxes with options for each type of title setting to apply and a button to paste the text.&#xA;    /// &amp;lt;/summary&amp;gt;&#xA;    ///&#xA;    public static string ProcessText(string text)&#xA;    {&#xA;        string input = text ?? BFS.Clipboard.GetText();&#xA;        string output = input;&#xA;        // Create window with comboboxes with options for each type and a button to paste&#xA;&#xA;        // Create an array of the Types of Emnms to loop through&#xA;        Type[] types = new Type[]&#xA;        {&#xA;            typeof(OutputQouteType),&#xA;            typeof(OutputDelimiterType),&#xA;            typeof(OutputCaseType),&#xA;        };&#xA;&#xA;        // Create a new form&#xA;        Form form = new Form();&#xA;        // Make the form size automatically fit the controls and be non-resizable&#xA;        form.AutoSize = true;&#xA;        form.AutoSizeMode = AutoSizeMode.GrowAndShrink;&#xA;        form.FormBorderStyle = FormBorderStyle.FixedDialog;&#xA;        // Set the form title&#xA;        form.Text = &quot;Name Reformater&quot;;&#xA;        // Set no Icon&#xA;        form.Icon = null;&#xA;&#xA;        // Add TableLayoutPanel to the form to allow for the controls to be centered with 3 columns and 4 rows where&#xA;        // Row 1 is for comboboxes for the different types of title settings&#xA;        // Row 2 is for Paste button&#xA;        // Row 3 is for the current text&#xA;        // Row 4 is for the preview text&#xA;        TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();&#xA;        // Set the number of columns&#xA;        tableLayoutPanel.ColumnCount = 3;&#xA;        // Set the number of rows&#xA;        tableLayoutPanel.RowCount = 4;&#xA;        // Make the form size automatically fit the controls and fill itself&#xA;        tableLayoutPanel.AutoSize = true;&#xA;        tableLayoutPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;&#xA;        tableLayoutPanel.Dock = DockStyle.Fill;&#xA;        // Add the TableLayoutPanel to the form&#xA;        form.Controls.Add(tableLayoutPanel);&#xA;&#xA;        // Add the current text to the table layout panel on the first row and the first column&#xA;        Label currentLabel = new Label();&#xA;        currentLabel.Text = &quot;Current Text:&quot;;&#xA;        tableLayoutPanel.Controls.Add(currentLabel, 0, 2);&#xA;        // Add the current text to the table layout panel on the first row and spanning the second and third column&#xA;        Label currentTextLabel = new Label();&#xA;        currentTextLabel.Text = input;&#xA;        currentTextLabel.AutoSize = true;&#xA;        currentTextLabel.Dock = DockStyle.Fill;&#xA;        tableLayoutPanel.Controls.Add(currentTextLabel, 1, 2);&#xA;        tableLayoutPanel.SetColumnSpan(currentTextLabel, 2);&#xA;&#xA;        // Add the preview text to the table layout panel on the second row and the first column&#xA;        Label previewLabel = new Label();&#xA;        previewLabel.Text = &quot;Preview Text:&quot;;&#xA;        tableLayoutPanel.Controls.Add(previewLabel, 0, 3);&#xA;        // Add the preview text to the table layout panel on the second row and spanning the second and third column&#xA;        Label previewTextLabel = new Label();&#xA;        previewTextLabel.Text = input;&#xA;        previewTextLabel.AutoSize = true;&#xA;        previewTextLabel.Dock = DockStyle.Fill;&#xA;        tableLayoutPanel.Controls.Add(previewTextLabel, 1, 3);&#xA;        tableLayoutPanel.SetColumnSpan(previewTextLabel, 2);&#xA;&#xA;        // Add ComboBoxes to the table layout panel on the third row&#xA;        ComboBox[] comboBoxes = new ComboBox[types.Length];&#xA;        for (int i = 0; i &amp;lt; types.Length; i&#x2B;&#x2B;)&#xA;        {&#xA;            // Create a new combobox&#xA;            ComboBox comboBox = new ComboBox();&#xA;            // Add items to the combobox from the enum values converted to strings&#xA;            comboBox.DataSource = Enum.GetValues(types[i]);&#xA;            // Stop the value from being changed&#xA;            comboBox.DropDownStyle = ComboBoxStyle.DropDownList;&#xA;            // Set the combobox size to automatically be as wide as possible&#xA;            comboBox.AutoSize = true;&#xA;            comboBox.Dock = DockStyle.Fill;&#xA;            // Add the combobox to the array&#xA;            comboBoxes[i] = comboBox;&#xA;            // Add the combobox to the table layout panel on the first row and the current column&#xA;            tableLayoutPanel.Controls.Add(comboBox, i, 0);&#xA;            // Add evemt handler to the combobox to update the output text when the value is changed&#xA;            comboBox.SelectedIndexChanged &#x2B;= (sender, e) =&amp;gt;&#xA;            {&#xA;                ProcessOutput(ref output, ref previewTextLabel, input, comboBoxes);&#xA;            };&#xA;        }&#xA;        // Create a new button&#xA;        Button pasteButton = new Button();&#xA;        // Set the button size to automatically be as wide as possible&#xA;        pasteButton.AutoSize = true;&#xA;        pasteButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;&#xA;        pasteButton.Dock = DockStyle.Fill;&#xA;        // Set the button text&#xA;        pasteButton.Text = &quot;Paste&quot;;&#xA;        // Add dialog result to the button&#xA;        pasteButton.DialogResult = DialogResult.OK;&#xA;        // Make button the default button&#xA;        form.AcceptButton = pasteButton;&#xA;        // Add the button to the table layout panel on the second row and spanning all columns&#xA;        tableLayoutPanel.Controls.Add(pasteButton, 0, 2);&#xA;        tableLayoutPanel.SetColumnSpan(pasteButton, 3);&#xA;        // Set the form start position type to manual&#xA;        form.StartPosition = FormStartPosition.Manual;&#xA;        // Set the initial Location of the form to the current mouse position&#xA;        // (Divide dimmensions of form by 2 to center it on the cursor position)&#xA;        form.Location = new Point(&#xA;            Cursor.Position.X - (form.Width / 2),&#xA;            Cursor.Position.Y - (form.Height / 2)&#xA;        );&#xA;        // Ensure form is ontop of all other windows&#xA;        form.TopMost = true;&#xA;        // Refresh the form when the form is shown&#xA;        form.Shown &#x2B;= (sender, e) =&amp;gt;&#xA;        {&#xA;            ProcessOutput(ref output, ref previewTextLabel, input, comboBoxes);&#xA;        };&#xA;&#xA;        // Show the form&#xA;        form.ShowDialog();&#xA;        if (form.DialogResult != DialogResult.OK)&#xA;        {&#xA;            return null;&#xA;        }&#xA;        ProcessOutput(ref output, ref previewTextLabel, input, comboBoxes);&#xA;&#xA;        // Paste the output to the clipboard&#xA;        BFS.Clipboard.PasteText(output);&#xA;        // Return&#xA;        return output;&#xA;    }&#xA;&#xA;    private static void ProcessOutput(&#xA;        ref string output,&#xA;        ref Label previewTextLabel,&#xA;        string input,&#xA;        ComboBox[] comboBoxes&#xA;    )&#xA;    {&#xA;        // Get the selected Enums from the comboboxes&#xA;        OutputQouteType qouteType = (OutputQouteType)comboBoxes[0].SelectedItem;&#xA;        OutputDelimiterType delimiterType = (OutputDelimiterType)comboBoxes[1].SelectedItem;&#xA;        OutputCaseType caseType = (OutputCaseType)comboBoxes[2].SelectedItem;&#xA;        // Split the input into an array of words using any non leter or number as a delimiter, and remove any empty strings&#xA;        string[] words = Regex&#xA;            .Split(input, &quot;[^a-zA-Z0-9]&quot;)&#xA;            .Where(x =&amp;gt; !string.IsNullOrEmpty(x))&#xA;            .ToArray();&#xA;        // Convert the words to the specified case&#xA;        ToCase(ref words, caseType);&#xA;        // Join the words with the specified delimiter and add the specified qoutes&#xA;        output =&#xA;            OutputQouteTypeDictionary[qouteType]&#xA;            &#x2B; string.Join(OutputDelimiterTypeDictionary[delimiterType], words)&#xA;            &#x2B; OutputQouteTypeDictionary[qouteType];&#xA;        // Set the preview text to the output&#xA;        previewTextLabel.Text = output;&#xA;    }&#xA;&#xA;    /// &amp;lt;summary&amp;gt;&#xA;    /// Method &amp;lt;c&amp;gt;ToCase&amp;lt;/c&amp;gt; converts the words in the array to the specified case as if they were a sentence.&#xA;    /// &amp;lt;/summary&amp;gt;&#xA;    /// &amp;lt;param name=&quot;words&quot;&amp;gt;The array of words to convert.&amp;lt;/param&amp;gt;&#xA;    /// &amp;lt;param name=&quot;caseType&quot;&amp;gt;The case to convert the words to.&amp;lt;/param&amp;gt;&#xA;    private static void ToCase(ref string[] words, OutputCaseType caseType)&#xA;    {&#xA;        switch (caseType)&#xA;        {&#xA;            case OutputCaseType.TitleCase:&#xA;                words = words&#xA;                    .Select(x =&amp;gt; x.Substring(0, 1).ToUpper() &#x2B; x.Substring(1).ToLower())&#xA;                    .ToArray();&#xA;                break;&#xA;            case OutputCaseType.UpperCase:&#xA;                words = words.Select(x =&amp;gt; x.ToUpper()).ToArray();&#xA;                break;&#xA;            case OutputCaseType.LowerCase:&#xA;                words = words.Select(x =&amp;gt; x.ToLower()).ToArray();&#xA;                break;&#xA;            case OutputCaseType.SentenceCase:&#xA;                words = words.Select(x =&amp;gt; x.ToLower()).ToArray();&#xA;                words[0] = words[0].Substring(0, 1).ToUpper() &#x2B; words[0].Substring(1);&#xA;                break;&#xA;            case OutputCaseType.MemeCase:&#xA;                Random random = new Random();&#xA;                // For each letter in each word, randomly capitalize it&#xA;                words = words&#xA;                    .Select(&#xA;                        x =&amp;gt;&#xA;                            x.Select(&#xA;                                    y =&amp;gt;&#xA;                                        random.Next(0, 2) == 0&#xA;                                            ? y.ToString().ToUpper()&#xA;                                            : y.ToString().ToLower()&#xA;                                )&#xA;                                .Aggregate((a, b) =&amp;gt; a &#x2B; b)&#xA;                    )&#xA;                    .ToArray();&#xA;                break;&#xA;        }&#xA;    }&#xA;}</pre><textarea id="code01a165f917b574e79873285f55dbb122" name="code01a165f917b574e79873285f55dbb122" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
</channel>
</rss>