コード例 #1
0
        public static Bitmap drawOnImage(Stream imageStream, BierRapportModel model)
        {
            Bitmap   bitMapImage  = new Bitmap(imageStream);
            Graphics graphicImage = Graphics.FromImage(bitMapImage);

            graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
            graphicImage.DrawString(model.displayTemperature, new Font(
                                        "Arial",
                                        12,
                                        FontStyle.Bold),
                                    SystemBrushes.WindowText,
                                    new Point(50, 50)
                                    );
            graphicImage.DrawString(model.temperatureCondition, new Font(
                                        "Arial",
                                        12,
                                        FontStyle.Bold),
                                    SystemBrushes.WindowText,
                                    new Point(50, 70)
                                    );
            graphicImage.DrawString(model.beerStatus, new Font(
                                        "Arial",
                                        12,
                                        FontStyle.Bold),
                                    SystemBrushes.WindowText,
                                    new Point(50, 90)
                                    );
            return(bitMapImage);
        }
コード例 #2
0
        public static Stream TextToImage(Stream imageStream, double temperature)
        {
            BierRapportModel model       = ImageHelper.setImageText(temperature);
            Bitmap           bitMapImage = ImageHelper.drawOnImage(imageStream, model);
            MemoryStream     stream      = new MemoryStream();

            bitMapImage.Save(stream, ImageFormat.Png);
            stream.Position = 0;
            return(stream);
        }