/// <summary> /// Converts a <see cref="CFM"/> constant to a <see cref="FontStyle"/> /// </summary> /// <param name="dwMask">The <see cref="CFM"/> to convert</param> /// <returns>A <see cref="FontStyle"/></returns> public static FontStyle CFM_ToFontStyle(CFM dwMask) { FontStyle fontStyle = 0; if ((dwMask & CFM.BOLD) == CFM.BOLD) { fontStyle |= FontStyle.Bold; } if ((dwMask & CFM.ITALIC) == CFM.ITALIC) { fontStyle |= FontStyle.Italic; } if ((dwMask & CFM.STRIKEOUT) == CFM.STRIKEOUT) { fontStyle |= FontStyle.Strikeout; } if ((dwMask & CFM.UNDERLINE) == CFM.UNDERLINE) { fontStyle |= FontStyle.Underline; } return fontStyle; }
/// <summary> /// Converts a <see cref="FontStyle"/> to <see cref="CFM"/> constant. /// </summary> /// <param name="fontStyle">The <see cref="FontStyle"/> to convert.</param> /// <returns>A <see cref="CFM"/> constant</returns> public static CFM FontStyleTo_CFM(FontStyle fontStyle) { CFM cfm_ = 0; if ((fontStyle & FontStyle.Bold) == FontStyle.Bold) { cfm_ |= CFM.BOLD; } if ((fontStyle & FontStyle.Italic) == FontStyle.Italic) { cfm_ |= CFM.ITALIC; } if ((fontStyle & FontStyle.Strikeout) == FontStyle.Strikeout) { cfm_ |= CFM.STRIKEOUT; } if ((fontStyle & FontStyle.Underline) == FontStyle.Underline) { cfm_ |= CFM.UNDERLINE; } return(cfm_); }
/// <summary> /// Converts a <see cref="CFM"/> constant to a <see cref="FontStyle"/> /// </summary> /// <param name="dwMask">The <see cref="CFM"/> to convert</param> /// <returns>A <see cref="FontStyle"/></returns> public static FontStyle CFM_ToFontStyle(CFM dwMask) { FontStyle fontStyle = 0; if ((dwMask & CFM.BOLD) == CFM.BOLD) { fontStyle |= FontStyle.Bold; } if ((dwMask & CFM.ITALIC) == CFM.ITALIC) { fontStyle |= FontStyle.Italic; } if ((dwMask & CFM.STRIKEOUT) == CFM.STRIKEOUT) { fontStyle |= FontStyle.Strikeout; } if ((dwMask & CFM.UNDERLINE) == CFM.UNDERLINE) { fontStyle |= FontStyle.Underline; } return(fontStyle); }
private static void initilizeSubsystems() { masterWindow = new Master(); home = new Home(); graphics = new Graphics(); cfm = new CFM(); splash = new Splashcs(); }
public void CFM_ToFontStyleTest() { const CFM dwMask1 = CFM.BOLD; const CFM dwMask2 = CFM.ITALIC; const CFM dwMask3 = CFM.STRIKEOUT; const CFM dwMask4 = CFM.UNDERLINE; const FontStyle expected1 = FontStyle.Bold; const FontStyle expected2 = FontStyle.Italic; const FontStyle expected3 = FontStyle.Strikeout; const FontStyle expected4 = FontStyle.Underline; FontStyle actual1 = InteropConvert.CFM_ToFontStyle(dwMask1); FontStyle actual2 = InteropConvert.CFM_ToFontStyle(dwMask2); FontStyle actual3 = InteropConvert.CFM_ToFontStyle(dwMask3); FontStyle actual4 = InteropConvert.CFM_ToFontStyle(dwMask4); Assert.AreEqual(expected1, actual1); Assert.AreEqual(expected2, actual2); Assert.AreEqual(expected3, actual3); Assert.AreEqual(expected4, actual4); }
public void FontStyleTo_CFMTest() { const FontStyle fontStyle1 = FontStyle.Bold; const FontStyle fontStyle2 = FontStyle.Italic; const FontStyle fontStyle3 = FontStyle.Strikeout; const FontStyle fontStyle4 = FontStyle.Underline; const CFM expected1 = CFM.BOLD; const CFM expected2 = CFM.ITALIC; const CFM expected3 = CFM.STRIKEOUT; const CFM expected4 = CFM.UNDERLINE; CFM actual1 = InteropConvert.FontStyleTo_CFM(fontStyle1); CFM actual2 = InteropConvert.FontStyleTo_CFM(fontStyle2); CFM actual3 = InteropConvert.FontStyleTo_CFM(fontStyle3); CFM actual4 = InteropConvert.FontStyleTo_CFM(fontStyle4); Assert.AreEqual(expected1, actual1); Assert.AreEqual(expected2, actual2); Assert.AreEqual(expected3, actual3); Assert.AreEqual(expected4, actual4); }
public CHARFORMAT(CFM mask, CFE effects) : this() { dwMask = mask; dwEffects = effects; }
public static void SetDefaultCharFormat(this RichTextBox rtb, CFM mask, CFE effects) { CHARFORMAT cf = new CHARFORMAT(mask, effects); rtb.SetDefaultCharFormat(cf); }
public CHARFORMAT(CFM mask, CFE effects) : this() { cbSize = Marshal.SizeOf(this); dwMask = mask; dwEffects = effects; szFaceName = ""; }