Esempio n. 1
0
 protected override void MakeGraphic()
 {
     Idaho.Draw.TextGraphic draw = new Idaho.Draw.TextGraphic();
     draw.Text       = _text;
     draw.Rotate     = _angle;
     draw.Color.Text = _textColor;
     draw.FontName   = _fontName;
     draw.Size       = _size;
     draw.Generate();
     this.Bitmap = draw.Bitmap;
 }
Esempio n. 2
0
        /// <summary>
        /// Get values needed to render text
        /// </summary>
        protected override void OnPreRender(EventArgs e)
        {
            string cacheKey = Utility.NoNull <string>(_resourceKey, _text);

            if (!this.TagInCache(cacheKey) || this.ForceNew)
            {
                Assert.NoNull(_fontName, "NullButtonFontName");

                // load resource string if specified
                if (string.IsNullOrEmpty(_text) && !string.IsNullOrEmpty(_resourceKey))
                {
                    string resx = string.Format("Label_{0}", _resourceKey);
                    _text = Idaho.Resource.Say(resx);
                    Assert.NoNull(_text, "NullResource", resx);
                }
                if (_opacity > 0 && _opacity < 100)
                {
                    Draw.Utility.AdjustOpacity(_color, _opacity);
                }
                Idaho.Draw.TextGraphic draw = new Idaho.Draw.TextGraphic();
                draw.Text              = _text;
                draw.Rotate            = _rotate;
                draw.Color.Text        = _color;
                draw.FontName          = _fontName;
                draw.FontStyle         = _fontStyle;
                draw.Size              = _size;
                draw.ForceRegeneration = this.ForceNew;
                this.Transparency      = true;
                this.Src    = draw.Url;
                this.Height = draw.Height;
                // height computed after .Url method runs
            }
            // attributes that aren't cached
            this.Generated = true;
            this.CssClass  = "text";
            base.OnPreRender(e);
        }