public static Font FromSystemDrawingFont(System.Drawing.Font sdFont, System.Drawing.Color sdColor) { Font font = new Font(); font.Family = new FontFamily(sdFont.FontFamily.Name); font.Style = sdFont.Italic ? FontStyles.Italic : FontStyles.Normal; font.Weight = sdFont.Bold ? FontWeights.Bold : FontWeights.Regular; font.TextDecorations = new TextDecorationCollection(); if (sdFont.Underline) { font.TextDecorations.Add(System.Windows.TextDecorations.Underline); } if (sdFont.Strikeout) { font.TextDecorations.Add(System.Windows.TextDecorations.Strikethrough); } font.Size = sdFont.Size; font.Color = sdColor.Convert(); return(font); }
public static void GetHSL(this System.Drawing.Color color, out float hue, out float saturation, out float lightness) { color.Convert().GetHSL(out hue, out saturation, out lightness); }