<?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>Fri, 01 May 2026 00:38:48 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="#code019de0f94f7273cdab307ece1e942a08" 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('code019de0f94f7273cdab307ece1e942a08Js'); 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="code019de0f94f7273cdab307ece1e942a08Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Drawing;
using System.Collections.ObjectModel;

// The 'text' parameter will contain the text from the:
//   - Current Clipboard when run by HotKey
//   - History Item when run from the History Menu
// The returned string will be:
//   - Placed directly on the Clipboard when run as a Macro
//   - Ignored by ClipboardFusion if it is 'null'
//   - Passed along to the next action in a Trigger (null changed to an empty string)
public static class ClipboardFusionHelper
{
    /// &lt;summary&gt;
    /// Enum &lt;c&gt;OutputQouteType&lt;/c&gt; contains the different types of qoutes that can be used.
    /// &lt;/summary&gt;
    public enum OutputQouteType
    {
        QoutedDouble,
        QoutedSingle,
        QoutedBacktick,
        Unqouted,
    }

    /// &lt;summary&gt;
    /// Dictionary &lt;c&gt;OutputQouteTypeDictionary&lt;/c&gt; contains the values for the different types of qoutes that can be used.
    /// &lt;/summary&gt;
    public static readonly ReadOnlyDictionary&lt;OutputQouteType, string&gt; OutputQouteTypeDictionary =
        new ReadOnlyDictionary&lt;OutputQouteType, string&gt;(
            new Dictionary&lt;OutputQouteType, string&gt;
            {
                { OutputQouteType.QoutedDouble, "\"" },
                { OutputQouteType.QoutedSingle, "'" },
                { OutputQouteType.QoutedBacktick, "`" },
                { OutputQouteType.Unqouted, "" },
            }
        );

    /// &lt;summary&gt;
    /// Enum &lt;c&gt;OutputDelimiterType&lt;/c&gt; contains the different types of delimiters that can be used.
    /// &lt;/summary&gt;
    public enum OutputDelimiterType
    {
        Space,
        Dot,
        Comma,
        Tab,
        NewLine,
        Semicolon,
        Colon,
        None,
    };

    /// &lt;summary&gt;
    /// Dictionary &lt;c&gt;OutputDelimiterTypeDictionary&lt;/c&gt; contains the values for the different types of delimiters that can be used.
    /// &lt;/summary&gt;
    public static readonly ReadOnlyDictionary&lt;
        OutputDelimiterType,
        string
    &gt; OutputDelimiterTypeDictionary = new ReadOnlyDictionary&lt;OutputDelimiterType, string&gt;(
        new Dictionary&lt;OutputDelimiterType, string&gt;
        {
            { OutputDelimiterType.Space, " " },
            { OutputDelimiterType.Dot, "." },
            { OutputDelimiterType.Comma, "," },
            { OutputDelimiterType.Tab, "\t" },
            { OutputDelimiterType.NewLine, "\n" },
            { OutputDelimiterType.Semicolon, ";" },
            { OutputDelimiterType.Colon, ":" },
            { OutputDelimiterType.None, "" },
        }
    );

    /// &lt;summary&gt;
    /// Enum &lt;c&gt;OutputCaseType&lt;/c&gt; contains the different types of cases that can be used.
    /// &lt;/summary&gt;
    public enum OutputCaseType
    {
        /// &lt;summary&gt;The first letter of each word is capitalized, and the rest of the word is lower case.&lt;/summary&gt;
        TitleCase,

        /// &lt;summary&gt;All letters are capitalized.&lt;/summary&gt;
        UpperCase,

        /// &lt;summary&gt;All letters are lower case.&lt;/summary&gt;
        LowerCase,

        /// &lt;summary&gt;The first letter of the first word is lower case, and the rest of the word is lower case.&lt;/summary&gt;
        SentenceCase,

        /// &lt;summary&gt;Each word is randomly capitalized.&lt;/summary&gt;
        MemeCase,
    };

    /// &lt;summary&gt;
    /// Method &lt;c&gt;ProcessText&lt;/c&gt; Creates a window with comboboxes with options for each type of title setting to apply and a button to paste the text.
    /// &lt;/summary&gt;
    ///
    public static string ProcessText(string text)
    {
        string input = text ?? BFS.Clipboard.GetText();
        string output = input;
        // Create window with comboboxes with options for each type and a button to paste

        // Create an array of the Types of Emnms to loop through
        Type[] types = new Type[]
        {
            typeof(OutputQouteType),
            typeof(OutputDelimiterType),
            typeof(OutputCaseType),
        };

        // Create a new form
        Form form = new Form();
        // Make the form size automatically fit the controls and be non-resizable
        form.AutoSize = true;
        form.AutoSizeMode = AutoSizeMode.GrowAndShrink;
        form.FormBorderStyle = FormBorderStyle.FixedDialog;
        // Set the form title
        form.Text = "Name Reformater";
        // Set no Icon
        form.Icon = null;

        // Add TableLayoutPanel to the form to allow for the controls to be centered with 3 columns and 4 rows where
        // Row 1 is for comboboxes for the different types of title settings
        // Row 2 is for Paste button
        // Row 3 is for the current text
        // Row 4 is for the preview text
        TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();
        // Set the number of columns
        tableLayoutPanel.ColumnCount = 3;
        // Set the number of rows
        tableLayoutPanel.RowCount = 4;
        // Make the form size automatically fit the controls and fill itself
        tableLayoutPanel.AutoSize = true;
        tableLayoutPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
        tableLayoutPanel.Dock = DockStyle.Fill;
        // Add the TableLayoutPanel to the form
        form.Controls.Add(tableLayoutPanel);

        // Add the current text to the table layout panel on the first row and the first column
        Label currentLabel = new Label();
        currentLabel.Text = "Current Text:";
        tableLayoutPanel.Controls.Add(currentLabel, 0, 2);
        // Add the current text to the table layout panel on the first row and spanning the second and third column
        Label currentTextLabel = new Label();
        currentTextLabel.Text = input;
        currentTextLabel.AutoSize = true;
        currentTextLabel.Dock = DockStyle.Fill;
        tableLayoutPanel.Controls.Add(currentTextLabel, 1, 2);
        tableLayoutPanel.SetColumnSpan(currentTextLabel, 2);

        // Add the preview text to the table layout panel on the second row and the first column
        Label previewLabel = new Label();
        previewLabel.Text = "Preview Text:";
        tableLayoutPanel.Controls.Add(previewLabel, 0, 3);
        // Add the preview text to the table layout panel on the second row and spanning the second and third column
        Label previewTextLabel = new Label();
        previewTextLabel.Text = input;
        previewTextLabel.AutoSize = true;
        previewTextLabel.Dock = DockStyle.Fill;
        tableLayoutPanel.Controls.Add(previewTextLabel, 1, 3);
        tableLayoutPanel.SetColumnSpan(previewTextLabel, 2);

        // Add ComboBoxes to the table layout panel on the third row
        ComboBox[] comboBoxes = new ComboBox[types.Length];
        for (int i = 0; i &lt; types.Length; i++)
        {
            // Create a new combobox
            ComboBox comboBox = new ComboBox();
            // Add items to the combobox from the enum values converted to strings
            comboBox.DataSource = Enum.GetValues(types[i]);
            // Stop the value from being changed
            comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            // Set the combobox size to automatically be as wide as possible
            comboBox.AutoSize = true;
            comboBox.Dock = DockStyle.Fill;
            // Add the combobox to the array
            comboBoxes[i] = comboBox;
            // Add the combobox to the table layout panel on the first row and the current column
            tableLayoutPanel.Controls.Add(comboBox, i, 0);
            // Add evemt handler to the combobox to update the output text when the value is changed
            comboBox.SelectedIndexChanged += (sender, e) =&gt;
            {
                ProcessOutput(ref output, ref previewTextLabel, input, comboBoxes);
            };
        }
        // Create a new button
        Button pasteButton = new Button();
        // Set the button size to automatically be as wide as possible
        pasteButton.AutoSize = true;
        pasteButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
        pasteButton.Dock = DockStyle.Fill;
        // Set the button text
        pasteButton.Text = "Paste";
        // Add dialog result to the button
        pasteButton.DialogResult = DialogResult.OK;
        // Make button the default button
        form.AcceptButton = pasteButton;
        // Add the button to the table layout panel on the second row and spanning all columns
        tableLayoutPanel.Controls.Add(pasteButton, 0, 2);
        tableLayoutPanel.SetColumnSpan(pasteButton, 3);
        // Set the form start position type to manual
        form.StartPosition = FormStartPosition.Manual;
        // Set the initial Location of the form to the current mouse position
        // (Divide dimmensions of form by 2 to center it on the cursor position)
        form.Location = new Point(
            Cursor.Position.X - (form.Width / 2),
            Cursor.Position.Y - (form.Height / 2)
        );
        // Ensure form is ontop of all other windows
        form.TopMost = true;
        // Refresh the form when the form is shown
        form.Shown += (sender, e) =&gt;
        {
            ProcessOutput(ref output, ref previewTextLabel, input, comboBoxes);
        };

        // Show the form
        form.ShowDialog();
        if (form.DialogResult != DialogResult.OK)
        {
            return null;
        }
        ProcessOutput(ref output, ref previewTextLabel, input, comboBoxes);

        // Paste the output to the clipboard
        BFS.Clipboard.PasteText(output);
        // Return
        return output;
    }

    private static void ProcessOutput(
        ref string output,
        ref Label previewTextLabel,
        string input,
        ComboBox[] comboBoxes
    )
    {
        // Get the selected Enums from the comboboxes
        OutputQouteType qouteType = (OutputQouteType)comboBoxes[0].SelectedItem;
        OutputDelimiterType delimiterType = (OutputDelimiterType)comboBoxes[1].SelectedItem;
        OutputCaseType caseType = (OutputCaseType)comboBoxes[2].SelectedItem;
        // Split the input into an array of words using any non leter or number as a delimiter, and remove any empty strings
        string[] words = Regex
            .Split(input, "[^a-zA-Z0-9]")
            .Where(x =&gt; !string.IsNullOrEmpty(x))
            .ToArray();
        // Convert the words to the specified case
        ToCase(ref words, caseType);
        // Join the words with the specified delimiter and add the specified qoutes
        output =
            OutputQouteTypeDictionary[qouteType]
            + string.Join(OutputDelimiterTypeDictionary[delimiterType], words)
            + OutputQouteTypeDictionary[qouteType];
        // Set the preview text to the output
        previewTextLabel.Text = output;
    }

    /// &lt;summary&gt;
    /// Method &lt;c&gt;ToCase&lt;/c&gt; converts the words in the array to the specified case as if they were a sentence.
    /// &lt;/summary&gt;
    /// &lt;param name="words"&gt;The array of words to convert.&lt;/param&gt;
    /// &lt;param name="caseType"&gt;The case to convert the words to.&lt;/param&gt;
    private static void ToCase(ref string[] words, OutputCaseType caseType)
    {
        switch (caseType)
        {
            case OutputCaseType.TitleCase:
                words = words
                    .Select(x =&gt; x.Substring(0, 1).ToUpper() + x.Substring(1).ToLower())
                    .ToArray();
                break;
            case OutputCaseType.UpperCase:
                words = words.Select(x =&gt; x.ToUpper()).ToArray();
                break;
            case OutputCaseType.LowerCase:
                words = words.Select(x =&gt; x.ToLower()).ToArray();
                break;
            case OutputCaseType.SentenceCase:
                words = words.Select(x =&gt; x.ToLower()).ToArray();
                words[0] = words[0].Substring(0, 1).ToUpper() + words[0].Substring(1);
                break;
            case OutputCaseType.MemeCase:
                Random random = new Random();
                // For each letter in each word, randomly capitalize it
                words = words
                    .Select(
                        x =&gt;
                            x.Select(
                                    y =&gt;
                                        random.Next(0, 2) == 0
                                            ? y.ToString().ToUpper()
                                            : y.ToString().ToLower()
                                )
                                .Aggregate((a, b) =&gt; a + b)
                    )
                    .ToArray();
                break;
        }
    }
}</pre><textarea id="code019de0f94f7273cdab307ece1e942a08" name="code019de0f94f7273cdab307ece1e942a08" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
</channel>
</rss>