'c#' tag RSS

We use batch files for... well, pretty much everything. From simple files that simple optimize modified graphics, to the tendril-like files that build our software. For some time now, I've been using cecho.exe from a CodeProject article so that I highlight errors and successes. Sadly this tool doesn't output anything if a console window isn't in use (for example from a CI server) and so I created a quick C# version for a direct replacement.

Continue Reading

The ColorGrid control is a fairly useful control for selecting from a predefined list of colours. However, it can take up quite a bit of screen real estate depending on how many colours it contains. This article describes how you can host a ColorGrid in a standard ToolStrip control, providing access to both the ColorGrid and the ColorPickerDialog, with some custom painting to show the active colour on the button to round it off.

Continue Reading

I was recently using a ComboBox control with the DropDownStyle set to Simple, effectively turning into a combined text box and list box.

However, when I wanted an action to occur on double clicking an item in the list I found that the control doesn't actually offer double click support. I suppose I should have just ripped out the combo box at that point and went with dedicated controls but instead I decided to extend ComboBox to support double clicks.

Continue Reading

Occasionally I need to embed HTML in my applications. If it is just to display some simple layout with basic interactions, I might use a basic component that doesn't need the weight of Internet Explorer. In most cases however, I need a more complex layout, JavaScript or I might want to display real pages from the internet - in which case I'm lumbered with the WebBrowser control.

This control annoys me in myriad ways, but it does get the job done. One of the things that occasionally frustrates me is that by default it is essentially an embedded version of Internet Explorer 7 - or enabling Compatibility Mode in a modern IE session. Not so good as more and more sites use HTML5 and other goodies.

This article provides a helper class to easily set the browser emulation version from your C# applications.

Continue Reading

The ImageBox control is already a versatile little control and I use it for all sorts of tasks. One of the features I recently wanted was to allow users to be able to select a source region, then adjust this as needed. The control already allows you to draw a selection region, but if you need to adjust that ... well, you can't. You can only draw a new region.

This article describes how to extend the ImageBox to include the ability to resize the selection region. A older demonstration which shows how to drag the selection around has also been incorporated, in a more tidy fashion than the demo.

Continue Reading