article

Capturing screenshots using C# and p/invoke

I was recently updating some documentation and wanted to programmatically capture some screenshots of the application in different states. This article describes how you can easily capture screenshots in your own applications using the `BitBlt` Win32 API call.

avatar
Richard Moss
article

Writing custom Markdig extensions

Markdig is an extensible Markdown processor built with performance in mind. This article details how to create a simple Markdig extension to extend the parsing functionality to create inline links for MantisBT issue numbers (or GitHub or similar).

avatar
Richard Moss
article

Announcing MantisSharp, a .NET client for using the MantisBT REST API

I've released a new open source project named MantisSharp, a simple .NET client for working with the recently introduced REST API for Mantis Bug Tracker.

avatar
Richard Moss
article

Translating text with Azure cognitive services

Some time ago, I used the Bing Translator API to help create localization for some of our products. As Microsoft recently retired the Data Market used to provide this service it was high time to migrate to the replacement Cognitive Services API hosted on Azure. This article covers using the basics of Azure cognitive services to translate text using simple HTTP requests.

avatar
Richard Moss
article

Using custom type converters with C# and YamlDotNet, part 2

Recently I discussed using type converters to perform custom serialization of types in YamlDotNet. In this post I'll concentrate on expanding the type converter to support deserialization as well.

avatar
Richard Moss
article

Using custom type converters with C# and YamlDotNet, part 1

One of our internal tools eschews XML or JSON configuration files in favour of something more human readable - YAML using YamlDotNet. For the most part the serialisation and deserialisation of YAML documents in .NET objects is as straight forward as using libraries such as JSON.net but when I was working on some basic serialisation there were a few issues. This article describes how to use the `IYamlTypeConverter` interface to handle custom YAML serialisation functionality.

avatar
Richard Moss
article

Writing Microsoft RIFF Palette (pal) files with C#

A short follow up which demonstrates how to write a RIFF palette with ease.

avatar
Richard Moss
article

Loading Microsoft RIFF Palette (pal) files with C#

At the start of 2014, I published an article describing how to read colour palettes from BBM/LBM files. At the end of that article I noted that Microsoft palette files used a similar format, but I didn't investigate that at the time. Since then I followed up with articles on reading and writing Adobe's Color Swatch and Color Exchange format files and I posted code for working with JASC, Gimp and other palette formats. Now, finally, I decided to complete the collection and present an article on reading Microsoft's palette files.

avatar
Richard Moss
article

Finding nearest colors using Euclidean distance

I've recently been updating our series on dithering to include ordered dithering. However, in order to fully demonstrate this I also updated the sample to include basic color quantizing with a fixed palette. While color reduction and dithering are related, I didn't want to cover both topics in a single blog post, therefore this post covers finding the nearest color via Euclidean distance.

avatar
Richard Moss
article

Error "DEP0001 : Unexpected Error: -1988945902" when deploying to Windows Mobile 10

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.

avatar
Richard Moss
article

Displaying multi-page tiff files using the ImageBox control and C#

A brief article showing how to display individual pages from a multi-page tiff file in the ImageBox control.

avatar
Richard Moss
article

Aligning Windows Forms custom controls to text baselines using C#

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.

avatar
Richard Moss