Skip to content

Instantly share code, notes, and snippets.

View MatthewKing's full-sized avatar

Matthew King MatthewKing

View GitHub Profile
@MatthewKing
MatthewKing / TypeExtensions.cs
Created July 22, 2012 12:49
Extension method to get a user-friendly string representation of a specified Type's name.
// Copyright Matthew King 2012.
// Boost Software License - Version 1.0 - August 17th, 2003
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
@MatthewKing
MatthewKing / EquatableTemplate.cs
Created July 23, 2012 08:40
Template implementation of IEquatable.
/// <summary>
/// Determines whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns>
/// true if the current object is equal to the specified object; otherwise, false.
/// </returns>
public bool Equals(T other)
{
if (Object.ReferenceEquals(other, null)) return false;
@MatthewKing
MatthewKing / ListViewHelper.cs
Created November 16, 2012 06:22
Provides methods to (properly) enable and disable double buffering on a ListView control.
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
/// <summary>
/// Provides methods to (properly) enable and disable double buffering on a ListView control.
/// Based on Giovanni Montrone's article on CodeProject at
/// <see cref="http://www.codeproject.com/KB/list/listviewxp.aspx"/>,
/// and on the StackOverflow answer at
/// <see cref="http://stackoverflow.com/a/162770/286936"/>.
// Copyright Matthew King 2011-2013.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
using System;
using System.Globalization;
using System.Linq.Expressions;
using System.Reflection;
/// <summary>
@MatthewKing
MatthewKing / WinFormExtensions.cs
Last active April 26, 2021 10:29
Extension methods for classes in the System.Windows.Forms namespace.
// Copyright Matthew King 2012-2015.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
using System;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System;
using System.Reflection;
using System.Windows.Forms;
/// <summary>
/// Extension methods for System.Windows.Forms.PropertyGrid.
/// </summary>
public static class PropertyGridExtensions
{
/// <summary>
@MatthewKing
MatthewKing / AssemblyExtensions.cs
Last active December 21, 2015 18:49
Extension methods for System.Reflection.Assembly.* Returns the DateTime represented by the linker timestamp in the specified assembly.
using System;
using System.IO;
using System.Reflection;
/// <summary>
/// Extension methods for the Assembly class.
/// </summary>
internal static class AssemblyExtensions
{
/// <summary>
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// Provides additional icon-related functionality.
/// </summary>
public static class IconEx
{
@MatthewKing
MatthewKing / CueTextBox.cs
Last active June 14, 2017 18:16
A WinForms TextBox that has support for cue banners.
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
/// <summary>
/// A Windows text box control with a cue banner.
/// </summary>
public class CueTextBox : TextBox
{
/// <summary>
@MatthewKing
MatthewKing / ListViewWithoutFocus.cs
Last active August 29, 2015 13:56
ListViewWithoutFocus.cs
// Copyright Matthew King 2014.
// Licensed under the Boost Software License, Version 1.0.
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
/// <summary>
/// Extends the System.Windows.Forms.ListView class, removing the focus indicators.
/// </summary>