コード例 #1
0
        public Bitmap GetBitmap()
        {
            Bitmap bitmap;

            stbc._InterpolationMode = interpolationMode;
            stbc._SmoothingMode     = smoothingMode;
            stbc._TextRenderingHint = textRenderingHint;
            bitmap   = stbc.GetBitmap(text, font, new SolidBrush(fontColor), backColor);
            TextSize = bitmap.Size;
            return(bitmap);
        }
コード例 #2
0
        public Bitmap GetBitmap()
        {
            Bitmap   bitmap = new Bitmap(ClockSize.Width, ClockSize.Height);
            Bitmap   str_bitmap;
            Graphics g = Graphics.FromImage(bitmap);

            g.Clear(BackColor);

            Text       = DateTime.Now.ToString("hh:mm tt");// Text = DateTime.Now.ToString("mm:ss tt");
            str_bitmap = stbc.GetBitmap(Text, TextFont, new SolidBrush(fontColor), backColor);
            g.DrawImage(str_bitmap, 1, 0);

            return(bitmap);
        }
コード例 #3
0
        public Bitmap GetBitmap()
        {
            Graphics g;
            Bitmap   textBitmap;

            stbc._InterpolationMode = InterpolationMode.Bicubic;
            stbc._SmoothingMode     = SmoothingMode.None;
            stbc._TextRenderingHint = textRenderingHint;
            ActiveFrame.Width       = TextArea.Width;
            ActiveFrame.Height      = TextArea.Height;

            while (ActiveFrame.X + ActiveFrame.Width > bitmap.Width)
            {
                textBitmap = stbc.GetBitmap(text, font, new SolidBrush(fontColor), backColor);
                TextSize   = textBitmap.Size;
                int    NewWidth  = bitmap.Width + SpaceWidth + textBitmap.Width - ActiveFrame.X;
                Bitmap NewBitmap = new Bitmap(NewWidth, textBitmap.Height);
                g = Graphics.FromImage(NewBitmap);
                g.Clear(BackColor);
                g.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width - ActiveFrame.X, textBitmap.Height), new Rectangle(ActiveFrame.X, 0, bitmap.Width - ActiveFrame.X, textBitmap.Height), GraphicsUnit.Pixel);
                g.DrawImage(textBitmap, bitmap.Width - ActiveFrame.X + SpaceWidth, 0);
                bitmap        = NewBitmap;
                ActiveFrameX -= ActiveFrame.X;
                ActiveFrame.X = 0;
            }

            Bitmap frame = new Bitmap(TextArea.Width, TextArea.Height);

            g = Graphics.FromImage(frame);
            g.Clear(BackColor);
            g.DrawImage(bitmap, new Rectangle(0, 0, frame.Width, frame.Height), ActiveFrame, GraphicsUnit.Pixel);
            ActiveFrameX += (float)Speed / (float)FPS;
            ActiveFrame.X = (int)ActiveFrameX;

            return(frame);
        }