Category: WinForms

Mind Mate: Taking Notes with rich text support

Mind Mate: Taking Notes with rich text support

(for background on Mind Mate, click here) Today, I released a new version (0.4) of Mind Mate on GitHub. The chief improvement is the rich text editing capabilities for notes as demonstrated below. When the focus is inside Note Editor, the ribbon switches to following Contextual tab. If the cursor is inside a table, ‘Table…

Read More Read More

Mind Mate: Mind Mapping on Windows 7 and 8

Mind Mate: Mind Mapping on Windows 7 and 8

(for background on Mind Mate, click here) I have been developing Mind Mate on Windows 10 machine, so wasn’t sure how it is going to behave on earlier versions of OS. Today, I tested it on Windows 7 and 8 using VMs made available by Microsoft. Mind Mate worked perfectly on Windows 8 but encountered…

Read More Read More

MouseHover event in Windows Forms .Net – Generating it repeatedly

MouseHover event in Windows Forms .Net – Generating it repeatedly

MouseHover Event When mouse is stationary for some time over a Windows Forms control, Mouse Hover event is generated. This event is generated only once during mouse’s stay and movement over a control. If mouse leaves and re-enters the control, system again starts tracking for Mouse Hover and will generate the event accordingly. A common…

Read More Read More

Async / Await and SynchronicationContext (C# .Net)

Async / Await and SynchronicationContext (C# .Net)

Following innocuous looking async / await code will cause deadlock. To understand why, lets go into what await does in the above case. 1 Execution starts when the button is clicked and button1_Click event is fired on the UI thread. 2 The method, named LongRunningProcess, is invoked. 3 The lamda expression passed to Task.Run() executes in…

Read More Read More

Creating and Consuming Async methods (C# .Net)

Creating and Consuming Async methods (C# .Net)

The code we want to run asynchronously could either be CPU-bound or IO-bound. CPU-bound code keeps the CPU busy, requiring intensive processing, calculations etc. On the other hand, IO-bound code frees up the CPU while waiting for an IO operation to complete, for instance, get some data from a web service. Both kinds of asynchronous…

Read More Read More

Keeping UI Responsive (C# .Net)

Keeping UI Responsive (C# .Net)

The User Interface (UI) becomes unresponsive when a time taking operation is executed during an event. Consider the following button click event where I have simulated a time taking operation by calling Sleep method. In a real scenario, it could be some processing which produces the result to be shown back on the user interface.…

Read More Read More

Developed Custom .Net Font Dialog

Developed Custom .Net Font Dialog

Developed a Custom FontDialog as an alternative to the standard .Net FontDialog. Key advantage of CustomFontDialog is the full control over look and feel as it is open source. Source and binary files are available at sourceforge. CustomFontDialog avoids ‘This is not a True Type Font’ exception that affects the standard dialog in some cases. Most probably the exception…

Read More Read More

Quick and dirty way of creating Numeric TextBox in .Net (C#)

Quick and dirty way of creating Numeric TextBox in .Net (C#)

Handle KeyDown event of the TextBox and set the e.Handled property to true if the character is not numeric.   Switch cases list all desired characters which will be displayed, rest of the characters are ignored. If additional characters are required, they may be included as switch cases. For instance, negative sign may be allowed…

Read More Read More

Handle arrow key events in Windows Forms .Net (C#)

Handle arrow key events in Windows Forms .Net (C#)

Pressing of a key is detected and handled in Windows Form using KeyPress, KeyDown or similar events. But these events does not fire when arrow keys are pressed. One way to get around it is to set KeyPreview as true for your Form. In many cases, this also doesn’t work, for instance, when you have…

Read More Read More