Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 02:38:50 +0000



Post From: How to strikeout text using updated Graphics for GDI?

[2024-01-20 23:00:15]
gcUserStudies - Posts: 106
I'm trying to figure out how to strikeout text. Using the updated example from GDIExample.cpp

n_ACSIL::s_GraphicsFont GraphicsFont;
GraphicsFont.m_Height = 16;
GraphicsFont.m_Weight = FW_BOLD;
sc.Graphics.SetTextFont(GraphicsFont);

Should there be a option like?

GraphicsFont.m_IsStrikeOut

In looking at the structures, I don't see a strikeout option

struct s_GraphicsFont
{
  s_GraphicsFont() {}

  SCString m_FaceName = "Arial";
  int m_Height = 10; //In Points
  int m_Weight = FW_NORMAL; //
  bool m_IsItalic = false;
  bool m_IsUnderline = false;
  int m_Angle = 0;

  /* Font Weights
  #define FW_DONTCARE 0
  #define FW_THIN 100
  #define FW_EXTRALIGHT 200
  #define FW_LIGHT 300
  #define FW_NORMAL 400
  #define FW_MEDIUM 500
  #define FW_SEMIBOLD 600
  #define FW_BOLD 700
  #define FW_EXTRABOLD 800
  #define FW_HEAVY 900
  */
};

The previous method I was using was this

// Create font
HFONT hFont;
hFont = CreateFont(
  sc.Input[n_FF::Input::FontSize].GetInt(), // Font size from user input
  0,
  0,
  0,
  700, // Weight
  FALSE, // Italic
  FALSE, // Underline
  TRUE, // StrikeOut
  DEFAULT_CHARSET,
  OUT_OUTLINE_PRECIS,
  CLIP_DEFAULT_PRECIS,
  CLEARTYPE_QUALITY,
  DEFAULT_PITCH,
  TEXT(sc.ChartTextFont()) // Pulls font used in chart
);
SelectObject(DeviceContext, hFont);

Thank you!