?VC ??????????????????????????: ??????,???????????????,?????????????????????4???????????,???????? - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

?VC ??????????????????????????: ??????,???????????????,?????????????????????4???????????,????????

Description:

Title: PowerPoint Presentation Last modified by: Created Date: 1/1/1601 12:00:00 AM Document presentation format: Other titles – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 16
Provided by: educ5460
Category:
Tags: clipping | point

less

Transcript and Presenter's Notes

Title: ?VC ??????????????????????????: ??????,???????????????,?????????????????????4???????????,????????


1
?? ? ????
?.??????? 1??????????????????????????? 2????????
???????????,???????????????????
3???????????????????????????? ?.????
?VC??????????????????????????
??????,???????????????,?????????????????????4?????
??????,????????
2
?.???? 1. ???? ???Visual C ???File?New?Projec
ts?MFC AppWizardexe,?Project Name??????,??Locati
on??????????,????OK?
3
2. ?????????? ?Step1????,??Single
Document?Multiple Documents?Dialog
based???????,?????????(??Multiple
Documents)??Finish(?????????Nextgt)
4
???New Project Information?????OK?
5
3. ??????
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???????????????????????,?????????????
????
7
4.??????,??????????????? 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).
9
2.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.
10
3.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.
11
4.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.
12
5.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.
13
Remarks 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.
14
6.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
??????? ??!
Write a Comment
User Comments (0)
About PowerShow.com