CodePudding user response:
Create an array (superscript number for square - 1) createcomxxxdc, createcomxxxbitmap, selectobject,SRT??? BLT cycle replication insets position to the array of HDC
CodePudding user response:
Use PicClip controlsOr
PaintPicture method
Used in the Form, PictureBox or Printer rendering graphics file (.... BMP, WMF, emf, cur, the ico or dib), does not support named parameters,
Syntax
Object. PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode
PaintPicture method syntax includes the following parts:
Part of the description
Object optional, an object expression, its value is "applied" in the list of an object, if you omit the object, with the focus of the default for the object, the Form object
Picture required, to draw to the object to the graphic source, Form or PictureBox must be Picture property,
X1, y1 required, both for single precision value, specified in draws a picture on the object target coordinates (x axis and y axis), the object of the ScaleMode property determines the units of measurement,
Width1 optional, single precision value, indicating the target width of the picture, the object of the ScaleMode property determines the units of measurement, if the target width than the width of the source (width2) big or small, will be properly stretched or compressed picture, if this parameter is omitted, use the width of the source,
Height1 optional, single precision value, indicating the target height of the picture, the object of the ScaleMode property determines the units of measurement, if the target height than the source height (height2) big or small, will be properly stretched or compressed picture, if this parameter is omitted, use the height of the source,
X2, y2 optional, all are single precision value, indicating the clip within the picture area coordinates (x axis and y axis), the object of the ScaleMode property determines the units of measurement, if this parameter is omitted, the default is 0,
Width2 optional, single precision value, indicate in the picture clip OuDeYuan width, the object of the ScaleMode property determines the units of measurement, if this parameter is omitted, use the width of the entire source,
Height2 optional, single precision value, indicate in the picture clip OuDeYuan height, the object of the ScaleMode property determines the units of measurement, if this parameter is omitted, use the height of the entire source,
Opcode optional, is long values or used only by the bitmap code, it is used to define the pictur mapped onto the object to perform the picture bit operation (for example, vbMergeCopy or vbSrcAnd operator), about a complete list of operators constant, please refer to the Visual Basic in the Help file RasterOp Constants theme,
In the use of opcode there are some limitations, for example, if the resource is icon or map file, only use vbSrcCopy, rather than using other opcode; And, with the design (or "brush") in the SDK terminology, such as MERGECOPY PATCOPY, PATPAINT and PATINVERT, interact FillStyle property of the opcode is, in fact, with the goal of interaction,
Note Opcode is used to transfer bitwise operation bitmap, when passing other image types to give a value to this parameter will cause the error "invalid procedure call or parameters", this is the cause of the design, to avoid the mistake, for besides the bitmap image, the Opcode parameter is null,
Description
By using the target height of the negative value (height1) and/or target value (width1), can be horizontal or vertical flip bitmap,
Can omit any more at the end of the optional parameters, if omitted one or more optional parameters, tail is not behind the last parameter of specified use commas, if you want to specify an optional parameter, you must first specify the grammar appeared in front of the parameters in all parameters,
Will note that in a. Bmp loaded into a PictureBox control and using the Windows API function BitBlt () is a little different between add images, when you are on an image to use BitBlt (), don't know as you use LoadPicture PictureBox control method to adjust the size, will ScaleWidth and ScaleHeight attribute is set to the image size doesn't work, if you want to use after BitBlt PictureBox, is used to adjust the size of the new image, has to do with the code by hand, conversion unit and deal with the borders, here's how to do a simple example:
Sub ResizePictureBoxToImage (PIC as PictureBox, twipWd _
As an Integer, twipHt as Integer)
'this code assumes that all the units for twip, if
'no, must, before calling this routine into tweed,
'here also assumes that the image displayed in the 0, 0,
Dim BorderHt as an Integer, BorderWd as Integer
BorderWd=Pic. Width - Pic. ScaleWidth
BorderHt=Pic. Height - Pic. ScaleHeight
PIC. Move PIC. Left PIC. Top, twipWd + BorderWd, _
TwipHt + BorderHt
End Sub