常州大学 C程序课程设计报告

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1
"繁华曲线"任务书 一、目的要求
本课程设计任务的目的是要求学生按照分析、设计、编码、调试和测试的软件开 发过程独立完成一个绘图程序,并能最终实现本系统的功能要求。本任务必须完成 拓展练习一。 二、功能要求 【题目描述】
有一种玩具叫做繁花曲线规,它由一套彩色塑料齿轮组成。一个大齿轮是环状 的,牙齿做在里面;几个小齿轮的牙齿做在外面,小齿轮内部有一些小圆孔和几个 其它形状的、较大的孔。
Examples
For an example, see Drawing Markers.
4
二、程序概述 主要功能:
1、用户能够通过菜单打开对话框输入大圆半径 R,小圆半径 r 和小孔位置 t(分为 小圆上的小孔半径 t1和大圆上的小孔半径 t2),画出单色调的繁花曲线。 2、用户能够通过不同的菜单绘制4幅不同的预定义的彩色繁花曲线。
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
HACCEL hAccelTable;
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_FLOVERCURVE, szWindowClass, MAX_LOADSTRING);
使用时左手按住大齿轮,让它紧贴在纸上,不能移动。在大齿轮里放一只小齿 轮,把笔尖插进小齿轮的某一个孔里,让小齿轮紧贴大齿轮内壁滚动,这时笔尖就 会在纸上画出许多美丽的曲线花纹。
图 1 繁华曲线规所作出的图
繁花曲线规的原理可以用下图 图 2 繁花曲线原理图
设大圆半径为 R,小圆半径为 r,小圆上孔距小圆圆心为 t。当小圆在大圆内转 动时,小圆圆心与大圆圆心构成转动后的角度α,由于小圆与大圆走过的圆弧长度相 同(齿啮合)所以小圆转过的圆弧β可通过α与 R 和 r 计算得到。则小圆上的小孔 新的坐标也可计算得到。
三、结构框图
用户自定义菜单
开始
输入 R,r,t1,t2 的值
程序预设菜单 开始
用户通过菜单选择 预定义繁花曲线图
输出单色繁花曲线 输入绚丽繁花曲线
结束 结束
四、程序代码
#include "stdafx.h"
#include<stdio.h>
#include "resource.h"
#include<stdlib.h>
MyRegisterClass(hInstance);
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_FLOVERCURVE);
题目要求:使用你的数学能力计算出繁花曲线上的每一点的坐标公式,变换你 的画笔的线型,线宽,色彩,使用循环描绘出美丽的图形。
要求 1:通过菜单生成对话框输入大圆半径 R,小圆半径 r 和小孔位置 t,画出单 色调的繁花曲线。
要求 2:通过不同的菜单绘制 4 幅不同的预定义的彩色繁花曲线,其中包括图 一两幅图案。
Return value
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
Remarks
The line is drawn by using the current pen and, if the pen is a geometric pen, the current brush. If LineTo succeeds, the current position is set to the specified ending point.
Syntax
BOOL LineTo( _In_ HDC hdc, _In_ int nXEnd, _In_ int nYEnd
);
Parameters
1
hdc [in] Handle to a device context. nXEnd [in] Specifies the x-coordinate, in logical units, of the line's ending point. nYEnd [in] Specifies the y-coordinate, in logical units, of the line's ending point.
wcex.cbClsExtra
= 0;
wcex.cbWndExtra
= 0;
wcex.hInstance
= hInstance;
wcex.hIcon
= LoadIcon(hInstance, (LPCTSTR)IDI_FLOVERCURVE);
wcex.hCursor
= LoadCursor(NULL, IDC_ARROW);
TCHAR szWindowClass[MAX_LOADSTRING];
ATOM
MyRegisterClass(HINSTANCE hInstance);
BOOL
InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
1
一、翻译 About Lines and Curves
0 out of 2 rated this helpful - Rate this topic Many types of applications use lines and curves to draw graphics output on raster devices. Computer-aided design (CAD) and drawing applications use lines and curves to outline objects, specify the centers of objects, the dimensions of objects, and so on. Spreadsheet applications use lines and curves to draw grids, charts, and graphs. Word processing applications use lines to create rules and borders on a page of text.
目录
“繁花曲线”任务书..........................................02 一、翻译..........................................................03 二、程序概述...................................................07 三、结构框图...................................................07 四、程序代码...................................................07 五、使用说明...................................................18 六、心得体会...................................................18
in logical units.
lpPoint [out]
Pointer to a POINT structure that receives the previous current
3
position. If this parameter is a NULL pointer, the previous position is not returned.
Return value
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
Remarks
The MoveToEx function affects all drawing functions.
LineTo function
1 out of 2 rated this helpful - Rate this topic The LineTo function draws a line from the current position up to, but not including, the specified point.
序号:
1
学号: 12477218
R S IT Y
CHA NG
Z H O U U N IV E
课程设计
课程设计名称: 学院名称: 学 生 姓 名: 小 组 成 员:
繁花曲线 信息科学与工程学院
孙剑峰 孙剑峰 陈菲 陈菲 夏园园 何凯 .
设计时间: 2013 年 06 月 17 日 2013 年 06 月 28 日
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
5
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int
nCmdShow)
{
MSG msg;
specified point and optionally returns the previous position.
Syntax
BOOL MoveToEx( _In_ HDC hdc, _In_ int X, _In_ int Y, _Out_ LPPOINT lpPoint
);
Parameters
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCSTR)IDC_FLOVERCURVE;
wcex.lpszClassName = szWindowClasBiblioteka Baidu;
}
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style
= CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
hdc [in]
Handle to a device context.
X [in]
Specifies the x-coordinate, in logical units, of the new position,
in logical units.
Y [in]
Specifies the y-coordinate, in logical units, of the new position,
#include<math.h>
#define MAX_LOADSTRING 100
struct curve
{
double R;
double rr;
double t1;
double t2;
}Curve,Cur[12];
int s[4]={0},C;
HINSTANCE hInst;
TCHAR szTitle[MAX_LOADSTRING];
Examples
For an example, see Drawing Markers.
2
MoveToEx function
1 out of 2 rated this helpful - Rate this topic
The MoveToEx function updates the current position to the
相关文档
最新文档