Пример #1
0
        /**
         * 描画処理
         * @param canvas
         * @param paint
         * @param offset 独自の座標系を持つオブジェクトをスクリーン座標系に変換するためのオフセット値
         */
        override public void draw(Graphics g, PointF offset)
        {
            Color _textColor, _bgColor;

            _textColor = textColor;

            if (enabled == false)
            {
                _bgColor = colorDisabled;
            }
            else if (isHover)
            {
                _bgColor = colorHover;
            }
            else if (pressed)
            {
                _textColor = colorTextPressed;
                _bgColor   = colorPressed;
            }
            else
            {
                _bgColor = bgColor;
            }

            // bg
            g.FillRectangle(new SolidBrush(_bgColor), pos.X, pos.Y, size.Width, size.Height);

            // text
            textBrush = UBrushManager.getBrush(_textColor);
            g.DrawString(text, DefaultFont, textBrush, pos.X + size.Width / 2, pos.Y + size.Height / 2, sf);
        }
Пример #2
0
        static UButton()
        {
            sf               = new StringFormat();
            sf.Alignment     = StringAlignment.Center;
            sf.LineAlignment = StringAlignment.Center;

            DefaultFont      = new Font(UDrawUtility.FontName, 10);
            DefaultTextBrush = UBrushManager.getBrush(DefaultTextColor);
        }