读书人

c# 3D成效

发布时间: 2011-12-19 23:23:36 作者: rapoo

c# 3D效果
小弟在学习过程中,想在c#中制作出3D的效果,恳请大侠指教阿
我是一点都没做过的啊,恳请可以有代码,哪怕只是做一个小例子的,也可以

[解决办法]
可以到codeproject上面搜索一下就有了,很多!
[解决办法]
http://www.5iaspx.com/vcnet/bC-3D-Chartingb-ldo701189.html
[解决办法]
是winform还是aspnet
[解决办法]
winform的话,用Managed DirectX或WPF吧.
[解决办法]
楼上正解!!!
[解决办法]
o
[解决办法]
楼主实在是让人摸不到头脑!
你要作什么3D啊!
是窗口的显示特效?(用图片或者绘制特殊窗口就可以实现)
还是在窗口某区域显示些简单的3D图形?(那用GDI+或者G自己在内存里画出来就可以了
还是要作一个3D窗口,类似游戏那样的全3D UI窗口??(用 Managed DirectX 或者XNA 或者OPENGL或者 VRM或者MS的荧光)
总要有个说明啊
[解决办法]
好像可以用CUT3D的方法不过我自己也没试过
[解决办法]
using System.Drawing.Drawing2D;
using System.Collections;


public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void DonPaint(PaintEventArgs e)
{
//背景
Graphics aGraphics = this.CreateGraphics();
Rectangle rect = new Rectangle(this.ClientRectangle.Location, this.ClientRectangle.Size);
rect.Inflate(-1, -1);
HatchBrush Hbrush = new HatchBrush(HatchStyle.LargeConfetti, Color.Yellow, Color.LawnGreen);
aGraphics.FillRectangle(Hbrush, rect);
Hbrush.Dispose();

//白线
Pen LinePen = new Pen(Color.White, 50);
aGraphics.DrawLine(LinePen, new PointF(ClientRectangle.Left + 150, ClientRectangle.Bottom + 20),
new PointF(ClientRectangle.Right - 180, ClientRectangle.Top - 20));
LinePen.Dispose();

//球的影子
Rectangle shadowRect = new Rectangle(400, 200, 70, 50);
HatchBrush Bhbrush = new HatchBrush(HatchStyle.LargeConfetti, Color.LightGray, Color.LawnGreen);
aGraphics.FillEllipse(Bhbrush, shadowRect);
Bhbrush.Dispose();

//画球内部
Rectangle ballrect = new Rectangle(300, 50, 150, 150);
GraphicsPath aGraphicsPath = new GraphicsPath();
aGraphicsPath.AddEllipse(ballrect);

PathGradientBrush ballbrush = new PathGradientBrush(aGraphicsPath);
ballbrush.CenterPoint = new Point(ballrect.Left + ballrect.Width / 3,
ballrect.Top + ballrect.Height / 4);
ballbrush.CenterColor = Color.White;
ballbrush.SurroundColors = new Color[] { Color.OrangeRed };
aGraphics.FillRectangle(ballbrush, ballrect);
ballbrush.Dispose();

//辈舍尔曲线条纹
Pen cuvpen = new Pen(Color.GhostWhite,3);
Point startpoint = new Point(300,125);
Point controlP1 = new Point(370, 205);
Point controlP2 = new Point(410, 45);
Point endpoint = new Point(450, 125);
aGraphics.DrawBezier(cuvpen, startpoint, controlP1, controlP2, endpoint);

//画球边
aGraphics.DrawEllipse(Pens.LightGray, ballrect);

//写字
Font afont = new Font("1", 12, FontStyle.Bold);
aGraphics.DrawString("高尔夫球", afont, Brushes.Black, new Point(0, 0));


float k;
k=Font.GetHeight(aGraphics);
MessageBox.Show(k.ToString());
}

//重绘
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
DonPaint(e);
}
}

建个窗体,粘贴代码,看看那个球是不是你要的效果!虽然不是3D,是2D
[解决办法]
学习
[解决办法]
没有C#的例子,只有C++的例子,运行还要DX9.0C SDK支持,
[解决办法]
是三维设计吗 我有例子
[解决办法]
WPF比较不错。
[解决办法]
up
[解决办法]
这么复杂不如用3d-max了
[解决办法]
不错的说
[解决办法]
以前一般都主要考虑DirectX
现在可以考虑考虑wpf
[解决办法]
我只是个新手,还不懂。。。。
[解决办法]
xna
wpf
mdx
你自己看看图形学中的算法自己写

读书人网 >C#

热点推荐