Title: ?VC ??????????????????????????: ??????,???????????????,?????????????????????4???????????,????????
1?? ? ????
?.??????? 1??????????????????????????? 2????????
???????????,???????????????????
3???????????????????????????? ?.????
?VC??????????????????????????
??????,???????????????,?????????????????????4?????
??????,????????
2?.???? 1. ???? ???Visual C ???File?New?Projec
ts?MFC AppWizardexe,?Project Name??????,??Locati
on??????????,????OK?
32. ?????????? ?Step1????,??Single
Document?Multiple Documents?Dialog
based???????,?????????(??Multiple
Documents)??Finish(?????????Nextgt)
4???New Project Information?????OK?
53. ??????
6 ???????????Project?,Workspace?????FileView,?
???ThirdP Files???,?Source Files???ThirdPView.cpp?
?,???????CView?????? void C ThirdPViewOnDraw(C
DC pDC) CFirstPDoc pDoc
GetDocument() ASSERT_VALID(pDoc)
// TODO add draw code for native data here
??? ???( ??????????????????)
?????????????,??????????????????(??AutoCAD????),??
??????????xoy???????????????????????,?????????????
????
74.??????,??????????????? 5. ????,????????
8?? ????????? 1.CDCMoveTo CPoint
MoveTo( int x, int y ) Return Value The x-
and y-coordinates of the previous position as a
CPoint object. Parameters x 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).
92.CDCLineTo BOOL LineTo( int x, int y
) Return Value Nonzero if the line is
drawn otherwise 0. Parameters x
Specifies the logical x-coordinate of the
endpoint for the line. y Specifies the
logical y-coordinate of the endpoint for the
line. Remarks Draws a line from the
current position up to, but not including, 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.
103.CPenCreatePen BOOL CreatePen( int
nPenStyle, int nWidth, COLORREF crColor ) Return
Value Nonzero, or the handle of a logical pen, if
successful otherwise 0. Parameters
nPenStyle 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 device 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, and color. The pen can be subsequently
selected as the current pen for any device
context.
114.CDCSelectObject CPen
SelectObject( CPen pPen ) Return Value
A pointer to the object being replaced. This is a
pointer to an object of one of the classes
derived from CGdiObject. The return value is NULL
if there is an error. Parameters pPen
A pointer to a CPen object to be
selected. Remarks Selects an object into
the device context.
125.CDCSetPixel COLORREF SetPixel( int
x, int y, COLORREF crColor ) Return Value
An RGB value for the color that the point is
actually painted. This value can be different
from that specified by crColor if an
approximation of that color is used. If the
function fails (if the point is outside the
clipping region), the return value is
1. Parameters x Specifies the logical
x-coordinate of the point to be set. y
Specifies the logical y-coordinate of the point
to be set. crColor Specifies the color
used to paint the point.
13Remarks Sets the pixel at the point
specified to the closest approximation of the
color specified by crColor. The point must be in
the clipping region. If the point is not in the
clipping region, the function does nothing.
Not all devices support the SetPixel
function. To determine whether a device supports
SetPixel, call the GetDeviceCaps member function
with the RASTERCAPS index and check the return
value for the RC_BITBLT flag.
146.CDCGetPixel COLORREF GetPixel( int
x, int y ) const Return Value For either
version of the function, an RGB color value for
the color of the given point. It is 1 if the
coordinates do not specify a point in the
clipping region. Parameters x Specifies the
logical x-coordinate of the point to be
examined. y Specifies the logical
y-coordinate of the point to be
examined. Remarks Retrieves the RGB color
value of the pixel at the point specified by x
and y. The point must be in the clipping region.
If the point is not in the clipping region, the
function has no effect and returns 1.
15??????? ??!