Exemple #1
0
 protected override void paintSelft(object sender, PaintEventArgs e)
 {
     _bgImage.DrawScale9(e.Graphics, this.size);
     if (_text != null && _text.Length > 0)
     {
         String drawText = _text;
         if (isPassword)
         {
             drawText = new String('*', _text.Length);
         }
         if (drawText.Length > _limitNum)
         {
             e.Graphics.DrawString(drawText.Substring(0, _limitNum), this._font, this._brush, 0, 0);
         }
         else
         {
             e.Graphics.DrawString(drawText, this._font, this._brush, 0, 0);
         }
     }
     else
     {
         e.Graphics.DrawString(_emptyText, this._font, Brushes.LightBlue, 0, 0);
     }
     base.paintSelft(sender, e);
 }
Exemple #2
0
        protected override void paintSelft(object sender, PaintEventArgs e)
        {
            float x = 0;
            float y = 0;

            if (status == ButtonStatus.Normal)
            {
                if (_NormalCanvas != null)
                {
                    _NormalCanvas.DrawScale9(e.Graphics, this.size, x, y);
                }
                if (_imgNormalLabel != null)
                {
                    DrawCenter(e.Graphics, _imgNormalLabel);
                }
                else if (this.mormalText != null)
                {
                    DrawCenter(e.Graphics, _font, this.mormalText, _brush);
                }
            }
            else if (status == ButtonStatus.Select)
            {
                if (_SelectCanvas != null)
                {
                    _SelectCanvas.DrawScale9(e.Graphics, this.size, x, y);
                }
                if (_imgSelectLabel != null)
                {
                    DrawCenter(e.Graphics, _imgSelectLabel);
                }
                else if (this.selectText != null)
                {
                    DrawCenter(e.Graphics, _font, this.selectText, _brush);
                }
            }
            else if (status == ButtonStatus.Disable)
            {
                if (_DisableCanvas != null)
                {
                    _DisableCanvas.DrawScale9(e.Graphics, this.size, x, y);
                }
                if (_imgDisableLabel != null)
                {
                    DrawCenter(e.Graphics, _imgDisableLabel);
                }
                else if (this.disableText != null)
                {
                    DrawCenter(e.Graphics, _font, this.disableText, _brush);
                }
            }

            base.paintSelft(sender, e);
        }