コード例 #1
0
ファイル: CloudWithWordsPainter.cs プロジェクト: CRASHGRIM/fp
        private void DrawRectangle(IGraphicDrawer graphics, string word, int wordFrequency, Brush backgroundBrush, Pen rectPen, Brush textBrush)
        {
            var font = new Font("Arial", Math.Min(72, wordFrequency * settings.Scale));
            var size = new Size(TextRenderer.MeasureText(word, font).Width, TextRenderer.MeasureText(word, font).Height);
            var rect = layouter.PutNextRectangle(size);

            if (settings.Fill)
            {
                graphics.FillRectangle(backgroundBrush, rect);
            }
            if (settings.Frame)
            {
                graphics.DrawRectangle(rectPen, rect);
            }
            graphics.DrawString(word, font, textBrush, new PointF(rect.X, rect.Y));
        }
コード例 #2
0
ファイル: CloudPainter.cs プロジェクト: CRASHGRIM/fp
 private void DrawRectangle(IGraphicDrawer graphics, SolidBrush backgroundBrush, Pen rectPen, Rectangle rectangle)
 {
     graphics.FillRectangle(backgroundBrush, rectangle);
     graphics.DrawRectangle(rectPen, rectangle);
 }