A short article on at least one possible cause for the very unhelpful `DEP0001 : Unexpected Error: -1988945902` error when trying to deploy a UWP application to a physical Windows Mobile phone.
One of the nice things about the Visual Studio WinForms designers are the guidelines it draws onto design surfaces, aiding you in perfectly positioning your controls. These guidelines are known internally as snap lines, and by default each visual component inheriting from `Control` gets four of these, representing the values of the control's `Margin` property. However, this default designer doesn't include an implementation for the `BaseLine` snap line, which is used to align controls via their contained text. This article shows how to create a custom designer to allow your controls to easily include this alignment option.
In several of my applications, I need to be able to line up text, be it blocks of text using different fonts, or text containers of differing heights. As far as I'm aware, there isn't a way of doing this natively in .NET, however with a little platform invoke we can get the information we need to do it ourselves as this short article demonstrates.
A short article on using command line tools for backing up databases hosted using Azure's SQL Database SaaS offering, and restoring them onto local SQL Server instances.
Some weeks ago I was trying to make parts of WebCopy's UI a little bit simpler via the expedient of hiding some of the more advanced (and consequently less used) options. And to do this, I created a basic toggle panel control. This worked rather nicely, and while writing it I thought I'd write a short article on adding keyboard support to WinForm controls.
One of the things that frequently annoys me about third party controls (including those built into the .NET Framework) are properties that either aren't `virtual`, or don't have corresponding change events / virtual methods. Quite often I find myself wanting to perform an action when a property is changed, and if neither of those are present I end up having to create a custom version of the property, and as a rule, I don't like using the `new` keyword unless there is no other alternative.
As a result of this, whenever I add properties to my WinForm controls, I tend to ensure they have a change event, and most often they are also virtual as I have a custom code snippet to build the boilerplate. That can mean some controls have an awful lot of events, many of which are rarely used.
This article describes how you can explicitly implement events to reduce the amount of memory your types take.
A cautionary tale about performance issues that can arise when the types of parameters used in stored procedures don't match the types of underlying columns when such parameters are being used in WHERE clauses, causing implicit conversions and the 'Type conversion in expression (CONVERT_IMPLICIT()) may affect "CardinalityEstimate"' warning to be displayed in query plans.
Recently I was updating a library that contains two keyed collection classes. These collections aren't the usual run-of-the-mill collections as they need to be able to support duplicate keys. Normally I'd inherit from `KeyedCollection` but as with most collection implementations, duplicate keys are not permitted in this class. This article describes how I used T4 templates to dynamically generate my custom collection classes without requiring a public base class.
Normally when I load textures in OpenGL, I have a PNG file which I load into a `System.Drawing.Bitmap` and from there I pull out the bytes and pass to `glTexImage2D`. It works, but seems a bit silly having to create the bitmap in the first place. For this reason, I was toying with the idea of creating a very simple image format so I could just read the data directly when I came across a simple format named farbfeld. This article describes a basic encoder/decoder for C# along with my own thoughts.
I've recently been working on a number of small test programs for the different sections which make up a game I'm planning on writing. One of these test systems involved a series of polyominoes which I needed to rotate. Internally, the data for these shapes are stored as a simple boolean array, which I access as though it were two dimensions. This article and corresponding source code download describe how to rotate 2D rectangular arrays (or 1D arrays that masquerade as 2D) in 90° intervals clockwise or anti-clockwise.