簡體   English   中英

在緊湊的框架中使用圖形在圖像上繪制線條

[英]DrawLines over Image using graphics in compact framework

我有一個picturebox控件,其中通過使用鼠標按下和鼠標移動事件,我使用點繪制圖像並將其存儲在數據庫中。 在更新模式下,我正在獲取字節並將圖像繪制到圖片框控件中,現在我在圖像上添加了幾行,但是我正在獲取新添加的行或舊圖像,但是我都希望

  //rect is my picture box
    Bitmap bmp = new Bitmap(rect.Width, rect.Height);
            // Create compatible graphics
            Graphics gxComp = Graphics.FromImage(bmp);

 //If i have a image 

           System.IO.MemoryStream memStream = new System.IO.MemoryStream(TmpSign);
                    Bitmap im = new Bitmap(memStream);

Tmp是我圖像的字節數組

         gxComp.DrawLines(pen, _currentStroke.ToArray());

_currentStroke是點列表。

在該圖形對象上創建圖像和繪制線條的圖形已解決了我的問題。

          //Ref with above Code

//創建圖像的圖形(如果存在)

      gxcomp=Graphics.FromImage(im);

然后//將新繪制的點寫到圖形上

       gxComp.DrawLines(pen, _currentStroke.ToArray());

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM