RichTextBox 貼圖/使用Graphics在圖像上寫字

RichTextBox 貼圖代碼:

             Image img = Image.FromFile(@"G:\Windows\Web\Wallpaper\Windows\img0.jpg");

            Clipboard.SetDataObject(img);

 

            DataFormats.Format  format = DataFormats.GetFormat(DataFormats.Bitmap);

 

            if (richTextBox1.CanPaste(format))

            {

                richTextBox1.Paste(format);

            }

            Clipboard.Clear();

 

在圖像的基礎上,描繪文字:

            Image img = Image.FromFile(@"G:\Windows\Web\Wallpaper\Windows\img0.jpg");

            Graphics g = Graphics.FromImage(img);

 

            g.DrawString("XXXXX", new Font(this.Font.Name, 12, FontStyle.Bold),Brushes.AliceBlue, 0F, 0F);

 

            g.Dispose();

            this.BackgroundImage = img;

發佈了58 篇原創文章 · 獲贊 4 · 訪問量 20萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章