System.Windows.Forms.BitmapLabel.OnPaint C# (CSharp) Method

OnPaint() protected method

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(BackColor, 0, 0, Width, Height);

            if (string.IsNullOrEmpty(Text)) return;

            if (_bakedTexture == null)
            {
                var tSize = TextureSize;

                int xOffset = 0;
                for (int i = 0; i < Text.Length; i++)
                {
                    if (_font.textureList.ContainsKey(Text[i]) == false) continue;
                    var textC = _font.textureList[Text[i]];
                    if (textC == null) continue;

                    /*if (textC.Id == 'H' || textC.Id == 'W')
                    {
                        _testHue += UnityEngine.Time.deltaTime * 5;
                        if (_testHue > 255)
                            _testHue = 0;
                        _charSettings[i].ForeColor = ColorPickerForm.GetColorFromHSL(_testHue / 255, 0.5f, .5f);
                    }*/

                    float _scale = _charSettings[i].Scale;
                    Color _foreColor = _charSettings[i].ForeColor;

                    float cX = xOffset + textC.OffsetX * _scale;
                    float cY = GetCursor() - textC.OffsetY * _scale;
                    float cW = textC.Texture.Width * _scale;
                    float cH = textC.Texture.Height * _scale;
                    float cA = textC.Advance * _scale;
                    if (ShowRects)
                        e.Graphics.DrawRectangle(new Pen(Color.FromArgb(64, 64, 64, 64)), cX, cY, cW, cH);
                    e.Graphics.DrawTexture(textC.Texture, cX, cY, cW, cH, _foreColor);
                    xOffset += (int)cA;
                }
            }
            else
            {
                e.Graphics.DrawTexture(_bakedTexture.uTexture, 0, 0, _bakedTexture.Width, _bakedTexture.Height);
            }
        }