This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
实验一 图形程序设计基础
一 . 概述:
本实验是在 Microsoft Visual C++ 6.0 平台上,建立一个 Project ,并在该 Project 的 View 文件内,找到 Visual C++ 6.0 自动创建的 CView 类的虚拟成员函数 OnDraw(CDC* pDC) ,并在该函数内添加相应的绘图程序,绘图程序通过 CDC 类指针 pDC 调用相应的绘图土函数,来完成所需图形的绘制。
Return Value The x- and y-coordinates of the previous position as a CPoi
nt object.Parametersx Specifies the logical x-coordinate of the new position.y Specifies the logical y-coordinate of the new position.Remarks Moves the current position to the point specified by x and y
(or by point).
2 . CDC::LineTo
BOOL LineTo( int x, int y );
Return Value Nonzero if the line is drawn; otherwise 0.Parametersx Specifies the logical x-coordinate of the endpoint for the l
ine.y Specifies the logical y-coordinate of the endpoint for the l
ine.Remarks Draws a line from the current position up to, but not inclu
ding, the point specified by x and y (or point). The line is drawn with the selected pen. The current position is set to x,y or to point.
3 . CPen::CreatePen
BOOL CreatePen( int nPenStyle, int nWidth, COLORREF crColor );
Return Value Nonzero, or the handle of a logical pen, if successful; otherwise
0.ParametersnPenStyle Specifies the style for the pen. For a list of possible values, see
the nPenStyle parameter in the CPen constructor.nWidth Specifies the width of the pen. if this value is 0, the width in dev
ice units is always 1 pixel, regardless of the mapping mode.crColor Contains an RGB color for the pen.Remarks The CreatePen initializes a pen with the specified style, width, a
nd color. The pen can be subsequently selected as the current pen for any device context.