Beispiel #1
0
        private void OnJustifyButtonClicked(object sender, EventArgs e)
        {
            Button justifyButton = sender as Button;

            if (justifyButton == null)
            {
                return;
            }

            JustifyType type = GetJustifyType((string)justifyButton.Tag);

            if (type != JustifyType.None)
            {
                OnJustify?.Invoke(this, type);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Set text justification
        /// </summary>
        /// <param name="pos"></param>
        public void Justify(JustifyType pos)
        {
            switch (pos)
            {
            case JustifyType.left:
                Write(ESC + "a0");
                break;

            case JustifyType.center:
                Write(ESC + "a1");
                break;

            case JustifyType.right:
                Write(ESC + "a2");
                break;

            default:
                Write(ESC + "a0");
                break;
            }
        }