ComponentFactory.Krypton.Toolkit.KryptonSplitterPanelDesigner.DrawWaterMark C# (CSharp) Method

DrawWaterMark() private method

private DrawWaterMark ( Graphics g ) : void
g System.Drawing.Graphics
return void
        private void DrawWaterMark(Graphics g)
        {
            // Get the rectangle available for drawing
            Rectangle clientRect = Control.ClientRectangle;

            // Get the name of the control to draw
            string drawText = Control.Name;

            // Use a fixed font for the drawing
            using (Font f = new Font("Arial", 8f))
            {
                try
                {
                    // Measure the size of the text
                    SizeF sizeF = g.MeasureString(drawText, f);

                    // Find the drawing position to centre the text
                    int middleX = (clientRect.Width / 2) - (((int)sizeF.Width) / 2);
                    int middleY = (clientRect.Height / 2) - (((int)sizeF.Height) / 2);

                    // Draw the name of the panel in the centre
                    TextRenderer.DrawText(g, drawText, f,
                                          new Point(middleX, middleY),
                                          Color.Black,
                                          TextFormatFlags.GlyphOverhangPadding);
                }
                catch { }
            }
        }