我使用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