using System.Drawing;
using System.Windows.Forms;
using Vanara.Extensions.Reflection;
namespace Vanara.Extensions;
public static partial class ControlExtension
{
///
/// Builds the based on this control's values.
///
/// The control.
/// if set to true text is in a single line.
/// A value for this control.
public static TextFormatFlags BuildTextFormatFlags(this Control ctrl, bool singleLine = true)
{
var align = ctrl.GetPropertyValue("TextAlign", ContentAlignment.TopLeft);
var ellip = ctrl.GetPropertyValue("AutoEllipsis", false);
var mne = ctrl.GetPropertyValue("UseMnemonic", false);
var kb = ctrl.GetPropertyValue("ShowKeyboardCues", false);
return GraphicsExtension.BuildTextFormatFlags(align, singleLine, ellip, mne, ctrl.GetRightToLeftProperty(), kb);
}
}