我使用directx.i在c#中繪製圓形,就像使用GDI在c#中繪製具有相同尺寸的圓一樣。這意味着我喜歡將該圓形從directx轉換爲GDI。是任何身體的幫助me.plz爲我提供了答案,我可以做到這一點。是任何可用的算法........ 而且我給圓的中心輸入是(x, y)以這種格式。但在gdi中它是像素格式。因此,如何將directx點轉換爲gdi +像素如何將形狀從Directx轉換爲gdi +使用c#
1
A
回答
3
這是MSDN的一個鏈接,介紹Graphics and Drawing in Windows Forms。而且很可能,你將需要類似於:
public Form1()
{
InitializeComponent();
this.Paint += new PaintEventHandler(Form1_Paint);
// This works too
//this.Paint += (_, args) => DrawCircle(args.Graphics);
}
void Form1_Paint(object sender, PaintEventArgs e)
{
DrawCircle(e.Graphics);
}
private void DrawCircle(Graphics g)
{
int x = 0;
int y = 0;
int radius = 50;
// The x,y coordinates here represent the upper left corner
// so if you have the center coordinates (cenX, cenY), you will have to
// substract radius from both cenX and cenY in order to represent the
// upper left corner.
// The width and height represents that of the bounding rectangle of the circle
g.DrawEllipse(Pens.Black, x, y, radius * 2, radius * 2);
// Use this instead if you need a filled circle
//g.FillEllipse(Brushes.Black, x, y, radius * 2, radius * 2);
}
之後,你可能要考慮雙緩衝技術,幾個環節:
相關問題
- 1. 使用gdi +(C#)將png轉換爲gif
- 2. 如何使用不同的形狀作爲jung形狀轉換
- 3. 如何將C++ GDI代碼轉換爲C#項目
- 4. Directx C++ - 繪製DNA形狀
- 5. 將directx轉換爲slimdx
- 6. 轉換GDI爲XPS
- 7. 使用AffineTransform縮放/將形狀轉換爲給定的矩形
- 8. 將手繪路徑轉換爲形狀
- 9. System.Windows.Media.Imaging是否使用DirectX(如WPF)或GDI +?
- 10. 如何轉換movieclip形狀?
- 11. GDI + - 對形狀的引用
- 12. 將形狀大小轉換爲cm
- 13. 如何使用PInvoke將Unicode字符串從C++轉換爲C#
- 14. 如何將JTS幾何轉換爲AWT形狀?
- 15. 如何將形狀文件類型從折線轉換爲多邊形?
- 16. 使用InvalideRect()更改GDI形狀
- 17. 將Directx 11項目轉換爲在Windows 8.1上工作Directx 11.2
- 18. 將形狀(n,1)的numpy數組轉換爲形狀(n,)
- 19. 如何將qsort從C轉換爲Java?
- 20. 如何將LINQ從C#轉換爲VB.NET?
- 21. 如何將其從C#轉換爲VB.NET?
- 22. 如何將zend_parse_parameters從C++轉換爲pascal?
- 23. GDI System.Drawing.Printing將白色轉換爲黑色
- 24. 如何將WicImagingBitmap轉換爲Gdi +位圖或流?
- 25. 將DirectX頂點轉換爲OpenGL頂點
- 26. 如何將xml轉換爲形狀文件?
- 27. 如何將GDI +的圖像*轉換爲位圖*
- 28. 如何將海洋形狀文件轉換爲topojson
- 29. 如何將ESRI形狀文件轉換爲SQL Server 2008?
- 30. 將GDI + PixelFormat轉換爲WPF PixelFormat
所以,就像澄清一樣,你有X,Y座標他的圈子的中心,你有半徑嗎?圓圈的中心是相關的,還是隻是想要有相似的形狀? – 2010-02-06 17:24:10
你我有雙格式的半徑 – ratty 2010-02-08 04:33:47
你想在哪繪製它?使用c的Windows面板中的 – 2010-02-08 05:18:21