当前位置: 首页>>代码示例>>C#>>正文


C# Bitmap.SetOpacity方法代码示例

本文整理汇总了C#中System.Drawing.Bitmap.SetOpacity方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.SetOpacity方法的具体用法?C# Bitmap.SetOpacity怎么用?C# Bitmap.SetOpacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Bitmap的用法示例。


在下文中一共展示了Bitmap.SetOpacity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReDraw

        /// <summary>
        /// 绘制过场动画
        /// </summary>
        protected override void ReDraw()
        {
            Graphics.FromImage(WindowFace).Clear(Color.Transparent);
            
            if (Valid)
            {
                Bitmap temp = new Bitmap(FlashPicture);
                Graphics.FromImage(temp).DrawString("魔 塔", new Font(new FontFamily("宋体"), 30, FontStyle.Bold), new SolidBrush(Color.Black), new PointF(70, 70));
                Graphics.FromImage(temp).DrawString(Message.Mesg, new Font(new FontFamily("宋体"), 28, FontStyle.Bold), new SolidBrush(Color.Black), new PointF(50, 110));

                temp.SetOpacity(Opacity);
                Graphics.FromImage(WindowFace).DrawImage(temp, FrmMain.DesWindow, new Rectangle(new Point(0, 0), FlashPicture.Size), GraphicsUnit.Pixel);
                TimeCount++;
            }  
        }
开发者ID:sleepandeat,项目名称:Program,代码行数:18,代码来源:FloorFlash.cs

示例2: MotaImage

        /// <summary>
        /// 初始加载固有图像,但标准单位尺寸分隔
        /// </summary>
        static MotaImage()
        {
            BackImage = new Bitmap("images/map/Empty1.png");
            SelectedBackImage = GetImage(MotaElement.选中怪物背景);
            SelectedBackImage.SetOpacity(0.4F);

            BackWindow = new Bitmap("images/back.png");

            for (int i = 0; i < ImageVector.Length; i++)
            {
                MotaElement id = (MotaElement)i;
                ImageVector[i] = GetFaceList(GetImage(id), new Size(GameIni.ElementWidth, GameIni.ElementHeight));
            }
        }
开发者ID:sleepandeat,项目名称:Program,代码行数:17,代码来源:MotaImage.cs

示例3: ReDraw

        /// <summary>
        /// 绘制怪物数据到窗口
        /// </summary>
        protected override void ReDraw()
        {
            Canvas = new Bitmap(WindowFace);
            Graphics g = Graphics.FromImage(Canvas);
            g.Clear(Color.Black);

            Font strFont = new Font("幼圆", 12, FontStyle.Bold);
            SolidBrush strBrush = new SolidBrush(Color.White);
            
            g.DrawString("怪物手册", new Font("宋体", 18, FontStyle.Bold), strBrush, new PointF(220, 10));

            OneFlash(null, null);

            //逐一绘制怪物属性
            int trun = 0;
            IEnumerable<ICanShowData> curMonsters = CurMonsters;
            foreach (var item in curMonsters)
            {
                DrawMonsterData(g, trun, item);

                trun++;
            }

            //绘制说明信息
            g.DrawString("按space返回主游戏页面", strFont, strBrush, new PointF(190, 420));

            g.DrawString(curPage.ToString() + " / " + MaxPage.ToString(), strFont, strBrush, new PointF(460, 420));
            try
            {
                //如果当前页数大于1,绘制向左翻页的提示
                if (CurPage > 1)
                {
                    g.DrawImage(new Bitmap("images/left.png"), new Point(440, 418));
                }
                //如果当前页数小于最大页数,绘制向右翻页提示
                if (curPage < MaxPage)
                {
                    g.DrawImage(new Bitmap("images/right.png"), new Point(508, 418));
                }
            }
            catch 
            {
            }

            Canvas.SetOpacity(0.90F);
            WindowFace = Canvas;
        }
开发者ID:sleepandeat,项目名称:Program,代码行数:50,代码来源:MonsterBook.cs

示例4: ReDraw

        /// <summary>
        /// 从对话队列中取出一次对话,绘制此对话到画布
        /// 如果对话队列为空,则关闭对话框
        /// </summary>
        protected override void ReDraw()
        {
            //取出一次对话
            Dialogue oneDialogue = DialogueQueue.Dequeue();

            Bitmap canvas = new Bitmap(WindowFace);
            Graphics g = Graphics.FromImage(canvas);
            
            Font strFont = new Font(new FontFamily("微软雅黑"), 12, FontStyle.Regular);
            SolidBrush strBrush = new SolidBrush(Color.Black);

            //绘制人物栏
            g.DrawImage(MotaImage.BackWindow, new Rectangle(0, 0, 80, 30), new Rectangle(0, 0, MotaImage.BackWindow.Width, MotaImage.BackWindow.Height), GraphicsUnit.Pixel);
            //g.FillRectangle(new SolidBrush(Color.Aquamarine), new Rectangle(0, 0, 80, 30));
            g.DrawString(oneDialogue.Speaker, strFont, strBrush, new PointF(10, 5));

            //绘制会话栏
            g.DrawImage(MotaImage.BackWindow, new Rectangle(0, 35, GameIni.DialogueSize.Width - 5, GameIni.DialogueSize.Height - 40), new Rectangle(0, 0, MotaImage.BackWindow.Width, MotaImage.BackWindow.Height), GraphicsUnit.Pixel);
            //g.FillRectangle(new SolidBrush(Color.Aquamarine), new Rectangle(0, 35, GameIni.DialogueSize.Width - 5, GameIni.DialogueSize.Height - 40));
            g.DrawString(oneDialogue.Content, strFont, strBrush, new Rectangle(10, 45, 320, 100));

            canvas.SetOpacity(0.8F);
            WindowFace = canvas;
        }
开发者ID:sleepandeat,项目名称:Program,代码行数:28,代码来源:DialogueBox.cs

示例5: ReDraw

        /// <summary>
        /// 绘制跳转界面到画布
        /// </summary>
        protected override void ReDraw()
        {
            Bitmap canvas = new Bitmap(WindowFace);
            Graphics.FromImage(canvas).DrawImage(MotaImage.BackWindow, new Rectangle(0, 0, this.WindowFace.Width, this.WindowFace.Height), new Rectangle(0, 0, MotaImage.BackWindow.Width, MotaImage.BackWindow.Height), GraphicsUnit.Pixel);
            
            //绘制文字
            Font descFont = new Font(new FontFamily("微软雅黑"), 13, FontStyle.Regular);
            SolidBrush descBrush = new SolidBrush(Color.Black);
            Graphics.FromImage(canvas).DrawString("请选择您要跳转的楼层", descFont, descBrush, new PointF(40, 10));

            //绘制楼层信息
            int index = 0;
            for (int i = 0; i < GameIni.SkipWindowCol; i++)
            {
                for (int j = 0; j < GameIni.SkipWindowRow; j++)
                {
                    if (Options.Count <= index)
                    {
                        break;
                    }

                    Options[index++].Draw(Graphics.FromImage(canvas), new Point(i * (GameIni.FloorUnit.Width + 20) + 25, 50 + j * (20 + GameIni.FloorUnit.Height)));  
                }
                if (Options.Count <= index)
                {
                    break;
                }
            }

            canvas.SetOpacity(0.8F);
            WindowFace = canvas;
        }
开发者ID:sleepandeat,项目名称:Program,代码行数:35,代码来源:FloorSkip.cs


注:本文中的System.Drawing.Bitmap.SetOpacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。