C#Windows窗体界面设计_攻击决策项目_真实轨迹RealTrack
来源:互联网 发布:大数据金融教学实验室 编辑:程序博客网 时间:2024/05/01 12:16
Author: binzhouweichao@163.com
Date: 2013-10-29
参考:
http://www.cnblogs.com/OpenCoder/archive/2010/02/23/1672043.html
http://developer.51cto.com/art/200909/149829.htm
重新建立项目。命名为AttackDecision_RealTrack
MainForm
Size: 800, 600
pictureBox1
Size: 520, 520
BackColor: White
time1
Enabled: True
Trick
MainForm.cs
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace AttackDecision_RealTrack{ public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void MainForm_Load(object sender, EventArgs e) { //初始化 GlobalVars.B = new Bitmap(pictureBox1.Width, pictureBox1.Height); this.pictureBox1.Image = GlobalVars.B; //当前速度 GlobalVars.currentVx = 0; GlobalVars.currentVy = 10; //当前位置 /* GlobalVars.currentPoint = new PointF(100F, 0F); * */ //初始位置 GlobalVars.startPoint = new PointF(100F, 0F); GlobalVars.attackPointData = new List<PointF>(); GlobalVars.attackPointData.Add(GlobalVars.startPoint); //时间间隔 GlobalVars.timeInterval = 1000; this.timer1.Interval = GlobalVars.timeInterval; GlobalVars.timeCnt = 0; } private void timer1_Tick(object sender, EventArgs e) { //处理数据 PointF currentPoint = new PointF(GlobalVars.attackPointData[GlobalVars.timeCnt].X, GlobalVars.attackPointData[GlobalVars.timeCnt].Y); currentPoint.X = currentPoint.X + GlobalVars.currentVx * this.timer1.Interval / 1000; currentPoint.Y = currentPoint.Y + GlobalVars.currentVy * this.timer1.Interval / 1000; GlobalVars.attackPointData.Add(currentPoint); GlobalVars.timeCnt++; SolidBrush myBrush = new SolidBrush(Color.Red); Graphics g = Graphics.FromImage(GlobalVars.B); //g.DrawArc(myBrush, GlobalVars.attackPointData[GlobalVars.timeCnt-1].X, GlobalVars.attackPointData[GlobalVars.timeCnt-1].Y,) g.FillEllipse(myBrush, GlobalVars.attackPointData[GlobalVars.timeCnt - 1].X, GlobalVars.attackPointData[GlobalVars.timeCnt - 1].Y, 2F, 2F); //pictureBox1.Image = GlobalVars.B; pictureBox1.Refresh(); } }}
GlobalVars.cs
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Drawing;namespace AttackDecision_RealTrack{ public static class GlobalVars { //攻击结点数据全局变量 private static List<PointF> attackpointdata; public static List<PointF> attackPointData { set { attackpointdata = value; } get { return attackpointdata; } } //绘图全局变量 private static Bitmap b; public static Bitmap B { set { b = value; } get { return b; } } //当前速度 private static float currentvx; public static float currentVx { set { currentvx = value; } get { return currentvx; } } private static float currentvy; public static float currentVy { set { currentvy = value; } get { return currentvy; } } //当前位置 /* private static PointF currentpoint; public static PointF currentPoint { set { currentpoint = value; } get { return currentpoint; } } * */ //初始位置 private static PointF startpoint; public static PointF startPoint { set { startpoint = value; } get { return startpoint; } } //当前时间间隔 private static int timeinterval; public static int timeInterval { set { timeinterval = value; } get { return timeinterval; } } //时间计时 private static int timecnt; public static int timeCnt { set { timecnt = value; } get { return timecnt; } } }}
代码:
http://yunpan.cn/Q9QaF2enPvGT9
- C#Windows窗体界面设计_攻击决策项目_真实轨迹RealTrack
- C#Windows窗体界面设计_攻击决策项目_02_设计窗体_01_主窗体
- C#Windows窗体界面设计_攻击决策项目_02_设计窗体_02_子窗体
- C#Windows窗体界面设计_攻击决策项目_01_系统架构
- C#Windows窗体界面设计_攻击决策项目_03_数据绘图_03_绘制雷点
- C#Windows窗体界面设计_攻击决策项目_02_设计窗体_03_设置窗体弹出退出顺序
- C#Windows窗体界面设计_攻击决策项目_02_设计窗体_04_修订主窗体工具栏和状态栏
- C#Windows窗体界面设计_攻击决策项目_03_数据绘图_01_绘制坐标轴_修订ParamsForm
- C#Windows窗体界面设计_攻击决策项目_03_数据绘图_02_修订坐标轴和ParamsForm文本框数据
- C#Windows窗体界面设计_02_绘制三角函数_多点作图法_全局变量思想
- C#Windows窗体界面设计_01_绘制三角函数_附强制类型转换
- C#Windows窗体界面设计_01_绘制三角函数_五点作图法
- C#Windows窗体界面设计_02_绘制三角函数_多点作图法
- C#Windows窗体界面设计_07_多窗体设计
- Android项目实战视频教程_快递轨迹查询应用开发
- C#_启动多个窗体winform
- <C#>_在窗体中打开文件
- C#Windows窗体界面设计_03_坐标系平移 旋转 镜像
- { 二分答案 }soj2015
- mysql字符截取substring_index
- IMS学习中的一些名词解释
- J2EE综合—在项目过程中Struts常见错误的全面汇总
- POJ 1958 没有AC的版本
- C#Windows窗体界面设计_攻击决策项目_真实轨迹RealTrack
- (奇迹冬瓜)坦克大战[MFC框架]
- css实现图片与文字底边对齐
- 直接插入排序
- android bluetooth开发基础-5发现设备
- ”值不能为空 参数值:DataSet“的错误原因
- linux中的find命令——查找文件名
- Android LayoutInflater详解
- 通过传入的一个下载路径得到server上包的大小