资源简介
主要基于c#语言,在OpenGL绘图窗口上使用鼠标对既有的图形进行空间的缩放与旋转

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SharpGL;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
float _x _yzs=0;
float clickX clickY ddx ddy;
bool clicKtf;
public Form1()
{
InitializeComponent();
this.openGLControl1.MouseWheel += new MouseEventHandler(openGLControl1_MouseWheel);
}
private void openGLControl1_OpenGLDraw(object sender RenderEventArgs args)
{
SharpGL.OpenGL gl = this.openGLControl1.OpenGL;
gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
gl.LoadIdentity(); // 重置
gl.Translate(0 0 zs-10); // 设置坐标,距离屏幕距离为10
gl.Rotate(_x 1.0f 0.0f 0.0f);
gl.Rotate(_y 0.0f 1.0f 0.0f);
gl.Begin(OpenGL.GL_QUADS);
{
gl.Color(1.0f 0.0f 1.0f);
gl.Vertex(1f -1f 0f);
gl.Color(0.0f 1.0f 1.0f);
gl.Vertex(1f 1f 0f);
gl.Color(0.0f 1.0f 0.0f);
gl.Vertex(-1f 1f 0f);
gl.Color(1.0f 1.0f 0.0f);
gl.Vertex(-1f -1f 0f);
}
gl.End();
}
private void openGLControl_OpenGLInitialized(object sender EventArgs e)
{
OpenGL gl = openGLControl1.OpenGL;
gl.ClearColor(1 0 1 0);
}
private void openGLControl1_MouseMove_1(object sender MouseEventArgs e)
{
if (clicKtf)
{
_y = ddx + e.X - clickX;
_x = ddy + e.Y - clickY;
}
}
private void openGLControl1_MouseUp_1(object sender MouseEventArgs e)
{
clicKtf = false;
ddx = _y;
ddy = _x;
}
private void openGLControl1_MouseDown_1(object sender MouseEventArgs e)
{
clicKtf = true;
clickX = e.X;
clickY = e.Y;
}
///
/// Handles the Resized event of the openGLControl control.
///
/// The source of the event.
/// The instance containing the event data.
private void openGLControl_Resized(object sender EventArgs e)
{
OpenGL gl = openGLControl1.OpenGL;
gl.MatrixMode(OpenGL.GL_PROJECTION);
gl.LoadIdentity();
gl.Perspective(90.0f (double)Width / (double)Height 0.01 100.0);
gl.LookAt(0 0 -5 5 5 0 0 1 0);
gl.MatrixMode(OpenGL.GL_MODELVIEW);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-11-28 17:53 鼠标控制\
目录 0 2018-03-07 08:49 鼠标控制\WindowsFormsApplication1\
目录 0 2017-11-28 17:53 鼠标控制\WindowsFormsApplication1\.vs\
目录 0 2017-11-28 17:53 鼠标控制\WindowsFormsApplication1\.vs\WindowsFormsApplication1\
目录 0 2017-11-28 17:53 鼠标控制\WindowsFormsApplication1\.vs\WindowsFormsApplication1\v14\
文件 30720 2018-03-07 08:49 鼠标控制\WindowsFormsApplication1\.vs\WindowsFormsApplication1\v14\.suo
文件 189 2017-11-28 17:17 鼠标控制\WindowsFormsApplication1\App.config
文件 2886 2017-11-28 17:50 鼠标控制\WindowsFormsApplication1\Form1.Designer.cs
文件 3337 2018-03-07 08:44 鼠标控制\WindowsFormsApplication1\Form1.cs
文件 5817 2017-11-28 17:50 鼠标控制\WindowsFormsApplication1\Form1.resx
文件 536 2017-11-28 17:17 鼠标控制\WindowsFormsApplication1\Program.cs
目录 0 2017-11-28 17:53 鼠标控制\WindowsFormsApplication1\Properties\
文件 1356 2017-11-28 17:17 鼠标控制\WindowsFormsApplication1\Properties\AssemblyInfo.cs
文件 2861 2017-11-28 17:17 鼠标控制\WindowsFormsApplication1\Properties\Resources.Designer.cs
文件 5612 2017-11-28 17:17 鼠标控制\WindowsFormsApplication1\Properties\Resources.resx
文件 1111 2017-11-28 17:17 鼠标控制\WindowsFormsApplication1\Properties\Settings.Designer.cs
文件 249 2017-11-28 17:17 鼠标控制\WindowsFormsApplication1\Properties\Settings.settings
文件 5318 2017-11-28 17:24 鼠标控制\WindowsFormsApplication1\WindowsFormsApplication1.csproj
文件 1368 2018-03-07 08:49 鼠标控制\WindowsFormsApplication1\WindowsFormsApplication1.sln
目录 0 2017-11-28 17:53 鼠标控制\WindowsFormsApplication1\bin\
目录 0 2018-03-07 08:31 鼠标控制\WindowsFormsApplication1\bin\Debug\
文件 143872 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.SceneGraph.dll
文件 568832 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.SceneGraph.pdb
文件 260726 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.SceneGraph.xm
文件 21504 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.WinForms.dll
文件 44544 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.WinForms.pdb
文件 13865 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.WinForms.xm
文件 366592 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.dll
文件 441856 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.pdb
文件 264280 2014-04-01 12:15 鼠标控制\WindowsFormsApplication1\bin\Debug\SharpGL.xm
文件 10752 2018-03-07 08:44 鼠标控制\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
............此处省略53个文件信息
- 上一篇:数据结构试题C#版,附答案
- 下一篇:ASP.NET实训实验报告
相关资源
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
评论
共有 条评论