av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

實體建模:C#畫圖的模式與縮放功能

在實體建模軟件中,經(jīng)常有設(shè)置并保存各種參考坐標系的功能,方便建立模型。C#畫圖中也有這種類似功能。不過沒有建模軟件那么強大。實體建模軟件中,可以獨立的設(shè)置并保存各種坐標系,并隨時調(diào)用。而這里只能以嵌套的形式調(diào)用,當返回到上一級狀態(tài)時,跳過的狀態(tài)就不再保存了。

C#畫圖普通模式主要命令

 
 
 
 
  1. state = graphics.BeginContainer();  
  2. 建一個新繪圖狀態(tài)  
  3.  
  4. e.Graphics.EndContainer(state1);  
  5. 結(jié)束這個繪圖狀態(tài)  
  6.  
  7. Rectangle rect = new Rectangle(0,   
  8. 0, 100, 100);//示例圖形  
  9.  
  10. GraphicsContainer state1 =   
  11. e.Graphics.BeginContainer();  
  12. //建一個新繪圖坐標state1  
  13.  
  14. e.Graphics.TranslateTransform(100, 100);  
  15. //移動坐標系到100,100,畫藍色矩形標記  
  16. e.Graphics.DrawRectangle(Pens.Blue, rect);  
  17. GraphicsContainer state2 =   
  18. e.Graphics.BeginContainer();  
  19. //在此基礎(chǔ)上建一個繪圖坐標state2  
  20.  
  21. e.Graphics.RotateTransform(45);//旋轉(zhuǎn)45度,  
  22. 畫紅色矩形標記  
  23. e.Graphics.DrawRectangle(Pens.Red, rect);  
  24.  
  25. e.Graphics.TranslateTransform(100, 100);  
  26. e.Graphics.DrawRectangle(Pens.Black, rect);  
  27.  
  28. e.Graphics.EndContainer(state2);//退出坐標系2,  
  29. 畫藍橢圓  
  30. e.Graphics.DrawEllipse(Pens.Blue, rect);  
  31.  
  32. e.Graphics.EndContainer(state1);//退出state1,  
  33. 畫紅橢圓  
  34. e.Graphics.DrawRectangle(Pens.Red, rect);  

 

建立狀態(tài)1

移動到100,100,畫藍色矩形

建被嵌套的狀態(tài)2

移動到200,0,畫紅色矩形

退出狀態(tài)2,畫藍色橢圓

退出狀態(tài)1,畫紅色矩形

狀態(tài)2是被嵌套的,如果直接退出狀態(tài)1畫紅色矩形,狀態(tài)2不再被保存。

graphics.BeginContainer()和EndGontainer是保存和返回當前畫板狀態(tài),當然,移動只是一種改變畫板狀態(tài)的方式。

C#畫圖縮放功能主要命令:

 
 
 
 
  1. GraphicsContainercontainerState=  
  2. e.Graphics.BeginContainer(  
  3. destRect,srcRect,  
  4. GraphicsUnit.Pixel);  
  5. 多加兩個參數(shù),destRect和scrRect制定縮放大小  
  6. Pixel指定單位  
  7.  
  8. RectanglesrcRect=newRectangle(  
  9. 0,0,200,200);  
  10. RectangledestRect=newRectangle(  
  11. 200,200,100,100);  
  12.  
  13. //建一個比例縮放的畫圖板.  
  14. GraphicsContainercontainerState=  
  15. e.Graphics.BeginContainer(  
  16. destRect,srcRect,  
  17. GraphicsUnit.Pixel);  
  18.  
  19. //繪圖縮放綠矩形.  
  20. e.Graphics.FillRectangle(  
  21. newSolidBrush(Color.Red),0,0,100,100);  
  22.  
  23. //退出此繪圖板.  
  24. e.Graphics.EndContainer(containerState);  
  25.  
  26. //繪原始紅矩形.  
  27. e.Graphics.FillRectangle(  
  28. newSolidBrush(Color.Green),0,0,100,100);  

以上就介紹了C#畫圖的模式與縮放功能。


網(wǎng)頁名稱:實體建模:C#畫圖的模式與縮放功能
文章位置:http://uogjgqi.cn/article/codppoe.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流