Exemple #1
0
        public void DrawText(string str, CRect rect, int align)
        {
            if (_graphics == null)
            {
                return;
            }

            if (_font == null)
            {
                _font = SystemFonts.DefaultFont;
            }

            if (_textBrush == null)
            {
                _textBrush = new SolidBrush(Color.Black);
            }

            StringFormat stringFormat = new StringFormat();

            if ((align & DT_CENTER) != 0)
            {
                stringFormat.LineAlignment = StringAlignment.Center;
            }
            if ((align & DT_RIGHT) != 0)
            {
                stringFormat.LineAlignment = StringAlignment.Far;
            }

            if ((align & DT_VCENTER) != 0)
            {
                stringFormat.Alignment = StringAlignment.Center;
            }
            if ((align & DT_BOTTOM) != 0)
            {
                stringFormat.Alignment = StringAlignment.Far;
            }

            stringFormat.FormatFlags = StringFormatFlags.NoWrap;

            _graphics.DrawString(str, _font, _textBrush, rect.GetRect(), stringFormat);
        }
Exemple #2
0
        public void MoveWindow(CRect rect)
        {
            Rectangle rectangle = rect.GetRect();

            MoveWindow(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
        }