Function: This function retrieves the specified information of a specified device.
Function prototype: int getdevicecaps (HDC, int nlndex );
Parameters:
1. HDC: handle of the device context.
2. nindex: Specifies the return item. This parameter takes the following values. (C ++)
Driverversion: The driver version of the device.
Technology: device technology, which can be one of the following values:
Dt_plotter: vector plotter; dt_rasdisplay: grating display;
Dt_rasprinter: grating printer; dt_rascamera: grating camera;
Dt_charstream: Metadata stream; dt_metafile: metadata file;
Dt_dispfile: display file.
If the HDC parameter specifies the device context of the Metafile, the device technology is to send the createenhmetafile Function
Number of referenced devices. You can use the getobjecttype function to determine whether it is an Enhanced Meta File device context environment.
Horzsize: width of the physical screen (in millimeters); vertsize: height of the physical screen (in millimeters); horzres: width of the screen (in pixels );
Vertres: screen height (grating line );
Logpixelsx: number of records per logical inch along the screen width. In Multiple display systems, this value is the same for the display;
Logpixelsy: number of records per logical inch along the screen height. In Multiple display systems, this value is the same for all displays;
Bitspixel: number of pixels connected to the color; planes: Number of color bit sides; numbrushes: number of devices that specify the number of pictures in the same painting;
Numpens: the number of PEN specified by the device; numfonts: the number of fonts specified by the device;
Numcolors: number of entries in the device color table. If the color depth of the device is no more than 8 pixels. -1 is returned for devices that exceed the color depth;
Aspectx: The relative width of the pixel used to draw the line; aspecty: The relative height of the pixel used to draw the line;
Aspectxy: the diagonal width of the pixel used to draw a line; pdevlcesize: reserved;
Clidcaps: displays the signs that the device supports shear performance. If the device can be cut into a rectangle, it is 1; otherwise, it is 0;
Sizepalette: number of entries in the system palette. This index value is valid only when the device drive sets the RC paletfe bit in the rastercaps index.
The index value can only be used on a 16-bit Windows Drive;
Numreserved: number of entries retained in the system palette. This index value is valid only when the device drive sets the RC paletfe bit in the rasterlap index.
Valid windows drive with the index value of only 16 bits;
Colorres: the actual device color of the actual bit image. The index value is valid and valid only when the device drive sets the rcpaletfe bit in the rasterlap index.
The value can only be used on a 16-bit Windows Drive;
Physicalwidth: the width of the physical page in the unit of the device for printing devices. For example, a device physical ticket with a printer set to 600dpi on the 8.5*11 page
The bit width is 5100. Note that the physical page is always larger than the printable page area and never smaller;
Phpsicalheight: The physical page width in the unit of devices. For example, the physical unit height of a printer set to 600dpi on 8.5*11 is 6600;
Physicaloffsetx: the distance from the left side of the physical page to the right side of the printed page. For example, if a printer is set to 600dpi on a 8.5*11 paper,
It cannot be printed at 0.25 points on the left, and there is a horizontal physical shift of 150 slave units;
Physicaloffsety; for printing devices. The distance from the physical page to the top of the printed page. For example, a printer set on 8.5*11 printing paper cannot
There is a physical shift in the unit of the device when the distance exceeds the upper limit;
Vrefresh: Windows NT: For display devices. The current vertical refresh rate of the device is measured in cycles per second. The value 0 or 1 indicates the default refresh rate of the hardware,
This default update rate is usually changed by setting the video card or patch cord of the motherboard, or by a configuration program that does not use the Win32 display function, such as changedisplay setting;
Desktophorzres: Windows NT: The pixel-based width of the visual desktop. If the device supports a visual desktop or dual display, this value may be greater than vertres;
Scalingfactorx: proportional coefficient of the printer X axis; scalingfactory: proportional coefficient of the printer Y axis.
Bltalignment: horizontal drawing adjustment as a pixel multiple in Windows NT. For the best drawing operation, the window drawing should be a multiple of horizontal adjustment to this value.
0 indicates that the device is accelerated and any adjustment is available.
Shadeblendcaps: in Windows 98, Windows NT 5.0, and later versions, this value displays the shadow and mixed features of the device.
Sb_const_alpha: process the source constantalpha element in the blendfunction structure and specify it using the blendfunction parameter in the alphablend number;
Sb_grad_rect: ability to fill gradientfill rectangles. Sb_grad_tri; ability to fill gradientfill triangles;
Sb_none: The device does not support any of these features. Sb_pixel_alpha: process each pixel alphx in alphablond;
Sb_premult_alpha: premultiplication of alpha in alphablend;
Rastercaps: the grating performance supported by the device. It can be a combination of the following values;
Rc_banding: joint support is required. Rc_bitblt: supports bitmap transfer.
Rc_bitmap64: supports bitmap larger than 64 KB. Rc_di_bitmap: supports setdibits and getdibits functions.
Rc_dibtodev: supports the setdibits to device function; rc_floodfill: supports continuous filling.
Rc_gdi20_output: supports 16-bit Windows 2.0 features; rc_palette: Specifies a palette-based device.
Rc_scaling: supports scaling; rc_stretchblt: supports the stretchblt function.
Rc_stretchdib: stretchdibits function.
Curvecaps: displays the curve performance supported by the device. It can be a combination of the following values.
Cc_none: Curve cannot be drawn; cc_chord: string can be drawn; cc_circles: circle can be drawn.
Cc_ellipses: supports drawing an ellipse; cc_interiors: supports internal filling; cc_pie: supports drawing a slice chart.
Cc_roundrect: supports drawing rounded rectangle; cc_styled: supports drawing border with style.
Cc_wide: supports drawing wide boundary; cc_widestyled: supports drawing wide and style boundary.
The linear performance supported by linecaps can be a combination of the following values:
Lc_none: Line Segments cannot be drawn; lc_interiors: internal filling is supported; lc_marker: marking is supported.
Lc_polyline: supports broken lines; lc_polymarker: supports multiple tags; lc_styled: line segments with styles.
Lc_wide: supports wide line drawing; lc_widestyled: supports wide line segments with styles.
Polygonalcaps supports polygon performance. It can be a combination of the following values.
Pc_none: polygon cannot be drawn; pc_interiors: Internal fill supported; pc_polygon: polygon can be drawn in an interval.
Pc_rectangle: supports drawing rectangles; pc_scanline: supports drawing scanning lines; pc_styled: supports drawing border with style.
Pc_wide: supports drawing wide borders; pc_widestyled: supports drawing wide border with style.
Pc_windpolygon: polygon can be drawn in line.
The textcaps device supports a combination of the following values:
Tc_op_character: supports character output precision; tc_op_stroke: supports stroke output precision.
Tc_cp_stroke: supports stroke cutting precision; tc_cr_90: supports 90-degree rotation of characters;
Tc_cr_any: supports character rotation at any angle; tc_sf_x_yindep: supports independent scaling in the X and Y directions.
Tc_sa_double: supports doubling characters; tc_sa_integer: supports integer doubling.
Tc_sa_contin: supports strict scaling by any number of multiples; tc_ea_double: supports increasing characters.
Tc_ia_able: supports oblique fonts; tc_ua_able: supports underlines; tc_so_able: supports strikethrough.
Tc_ra_able: supports grating fonts; tc_va_able: supports Vector Fonts; tc_reserved: reserved, must be zero.
Tc_scrollblt: bit fast transfer is not supported for rolling. Note that this may be counterproductive.
These are some C ++ parameters. The specific values of some parameters in C # are provided below.
All types are declared as Int or int32.
Driverversion = 0
Technology = 2
Horzsize = 4
Vertsize = 6
Horzres = 8
Vertres = 10
Bitspixel = 12
Planes = 14
Numbrushes = 16
Numpens = 18
Nummarkers = 20
Numfonts = 22
Numcolors = 24
Pdevicesize = 26
Curvecaps = 28
Linecaps = 30
Polygonalcaps = 32
Textcaps = 34
Clipcaps = 36
Rastercaps = 38
Aspectx = 40
Aspecty = 42
Aspectxy = 44
Shadeblendcaps = 45
Logpixelsx = 88
Logpixelsy = 90
Sizepalette = 104
Numreserved= 106
Colorres = 108.
Physicalwidth = 110
Physicalheight = 111
Physicaloffsetx = 112
Physicaloffsety = 113
Scalingfactorx= 114
Scalingfactory = 115
Vrefreesh = 116
Optional topvertres = 117
Required tophorzres = 118
Bltalignment = 119
Return Value: the return value specifies the value of the required project.
Note: getdevicecaps provides the following six indexes to replace the printer.
Physicalwidth getphyspagesize; physicalheight getphyspagesize
Physicaloffsetx getprintingoffset;
Physicaloffsety getphysicaloffset;
Scalingfactorx getscalingfactor;
Scalingfactory getscalingfactor;
Windows CE: Windows CE does not support the following nindex values:
Vrefresh; using tophorzres; using topvertres; bltalignment
Windows CE 1.0 does not support the following nindex values:
Physicalwidth; physicalheight; physicaloffsetx; physicaloffsety
Quick query: Windows NT: 3.1 and later; windows: 95 and later; Windows CE: 1.0 and later; header file: wingdi. h; library file: gdi32.lib.
Supplement:
Getdevicecaps (horzsize)
Horzsize display width in millimeters
Vertsize: display height in millimeters
The display width of horzres in pixels is 0 ~ 65535
Vertres displays the height in pixels from 0 ~ 65535
Logpixelsx pixel/logical inch (horizontal)
Logpixelsy pixel/logical inch (vertical)
Font function -- getdevicecaps