MyException - 我的异常网
当前位置:我的异常网» C# » c# 3D成效

c# 3D成效

www.MyException.Cn  网友分享于:2013-12-20  浏览:90次
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));

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有