728x90
반응형
728x170
▶ MainForm.cs
using System;
using System.Drawing;
using System.Windows.Forms;
using Steema.TeeChart.Drawing;
using Steema.TeeChart.Styles;
namespace TestProject
{
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : Form
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
Text = "Surface 클래스 : 3D 원통 만들기";
this.tChart.Aspect.View3D = true;
this.tChart.Aspect.Orthogonal = false;
this.tChart.Aspect.Chart3DPercent = 100;
this.tChart.Aspect.Zoom = 80;
this.tChart.Aspect.Rotation = 320;
this.tChart.Aspect.Elevation = 350;
this.tChart.Panel.Pen = new ChartPen(Color.Black);
this.tChart.Walls.Visible = false;
this.tChart.Axes.Visible = false;
this.tChart.Legend.Visible = false;
Surface topSurface = new Surface(this.tChart.Chart);
topSurface.IrregularGrid = true;
topSurface.XValues.Order = ValueListOrder.None;
topSurface.YValues.Order = ValueListOrder.None;
Surface bottomSurface = new Surface(this.tChart.Chart);
bottomSurface.IrregularGrid = true;
bottomSurface.XValues.Order = ValueListOrder.None;
bottomSurface.YValues.Order = ValueListOrder.None;
int arcCount = 50; // 원호 카운트
int zCount = 20; // 원통 길이
Random random = new Random();
double radian180 = GetRadianAngle(180);
for(int z = 0; z < zCount; z++)
{
for(int i = 0; i < arcCount; i++)
{
double alpha = GetRadianAngle(i * 359 / arcCount);
double x = Math.Cos(alpha);
double y = Math.Sin(alpha);
Color color = Color.FromArgb(random.Next(255), random.Next(255), random.Next(255));
if(alpha < radian180)
{
topSurface.Add(x, y, z, "", color);
}
else
{
bottomSurface.Add(x, y, z, "", color);
}
}
Color color1 = Color.FromArgb(random.Next(255), random.Next(255), random.Next(255));
Color color2 = Color.FromArgb(random.Next(255), random.Next(255), random.Next(255));
bottomSurface.Add(topSurface.XValues.Maximum, Math.Sin(Math.Acos(topSurface.XValues.Maximum)), z, "", color1);
bottomSurface.Add(topSurface.XValues.Minimum, Math.Sin(Math.Acos(topSurface.XValues.Minimum)), z, "", color2);
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 라디안 각도 구하기 - GetRadianAngle(angle)
/// <summary>
/// 라디안 각도 구하기
/// </summary>
/// <param name="angle">각도</param>
/// <returns>라디안 각도</returns>
private double GetRadianAngle(double angle)
{
return angle * (Math.PI / 180d);
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'TeeChart > WinForm' 카테고리의 다른 글
[TEECHART/WINFORM] Count 클래스 : Period 속성 사용하기 (0) | 2022.04.25 |
---|---|
[TEECHART/WINFORM] Divide 클래스 사용하기 (0) | 2022.04.25 |
[TEECHART/WINFORM] Multiply 클래스 사용하기 (0) | 2022.04.25 |
[TEECHART/WINFORM] Subtract 클래스 사용하기 (0) | 2022.04.25 |
[TEECHART/WINFORM] Add 클래스 : Period 속성 사용하기 (0) | 2022.04.14 |
[TEECHART/WINFORM] Graphics3D 클래스 : PyramidTrunc 속성을 사용해 잘라진 피라미드 그리기 (0) | 2022.04.07 |
[TEECHART/WINFORM] Graphics3D 클래스 : Ellipse 메소드 사용하기 (0) | 2022.04.07 |
[TEECHART/WINFORM] Graphics3D 클래스 : RotationCenter 속성을 사용해 회전 중심 설정하기 (0) | 2022.04.07 |
[TEECHART/WINFORM] ICloneable 구현을 사용해 객체 복사하기 (0) | 2022.04.07 |
[TEECHART/WINFORM] TChart 클래스 : Aspect 속성을 사용해 직교 각도 설정하기 (0) | 2022.04.07 |
댓글을 달아 주세요