我使用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. 如何將C++ GDI代碼轉換爲C#項目
- 3. Directx C++ - 繪製DNA形狀
- 4. 使用AffineTransform縮放/將形狀轉換爲給定的矩形
- 5. 轉換GDI爲XPS
- 6. 如何轉換movieclip形狀?
- 7. System.Windows.Media.Imaging是否使用DirectX(如WPF)或GDI +?
- 8. 將形狀大小轉換爲cm
- 9. 如何將JTS幾何轉換爲AWT形狀?
- 10. GDI + - 對形狀的引用
- 11. 如何將其從C#轉換爲VB.NET?
- 12. 如何將LINQ從C#轉換爲VB.NET?
- 13. 如何將qsort從C轉換爲Java?
- 14. 如何將xml轉換爲形狀文件?
- 15. 如何將ESRI形狀文件轉換爲SQL Server 2008?
- 16. GDI System.Drawing.Printing將白色轉換爲黑色
- 17. 如何將WicImagingBitmap轉換爲Gdi +位圖或流?
- 18. 如何將GDI +的圖像*轉換爲位圖*
- 19. 使用TopoJSON 2.0 API將形狀文件轉換爲TopoJSON
- 20. 使用引導將文件輸入轉換爲形狀
- 21. 將GDI + PixelFormat轉換爲WPF PixelFormat
- 22. 如何將圖像視圖轉換爲自定義形狀(swift3)
- 23. 如何使用C#函數將XML轉換爲XSLT轉換
- 24. 如何將gdi +類似於位圖的結構轉換爲HDC?
- 25. 如何將列中的列表轉換爲垂直形狀?
- 26. 將numpy數組形狀從(1,100)轉換爲(100,)python
- 27. 轉換ndarray形狀
- 28. 不使用GDI的DirectX字體教程
- 29. 使用VB.NET中的GDI +將24BPP轉換爲4BPP
- 30. 將DXBC轉換爲DXIL(DirectX字節碼轉爲DirectX中間語言)
所以,就像澄清一樣,你有X,Y座標他的圈子的中心,你有半徑嗎?圓圈的中心是相關的,還是隻是想要有相似的形狀? – 2010-02-06 17:24:10
你我有雙格式的半徑 – ratty 2010-02-08 04:33:47
你想在哪繪製它?使用c的Windows面板中的 – 2010-02-08 05:18:21