當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。