Home > Software engineering >  VB programming in the control system
VB programming in the control system

Time:09-21


As shown in figure, I soon learn VB, wanted to ask the above coordinates is how programming?

CodePudding user response:

His drawing, the coordinate transformation

CodePudding user response:


The Line method


Draw a straight line on the object and rectangles,

Syntax

Object. The Line [Step] (x1, 1) (x2, y2) [Step], [color], [B] [F]

Line method syntax object has the following qualifiers and parts:

Part of the description
Object optional, object expression, and its value is "applied" in the list of objects, if the object is omitted, a focus of the form as the object,
Step optional, keywords, specify the starting point coordinates and their relative to the current graphics position provided by the CurrentX and CurrentY attributes,
(x1, y1) optional, Single (Single precision floating point), the starting point of the straight line or rectangular coordinates, the ScaleMode property determines the use of units of measurement, if omitted, line began by CurrentX and CurrentY indicating position,
Step optional, keywords, specified relative to the end of the line as the starting point coordinates,
(x2, y2) required, Single (Single precision floating point), the end of the straight line or rectangular coordinates,
Color optional, Long (Long integer), line drawing with RGB color, if it is omitted, use the ForeColor attribute values, usable RGB function or QBColor function specified color,
B optional, if included, draw a rectangle with diagonal coordinates,
F optional, if you use the option B, F options specified rectangle with the color of the rectangle filling, not F instead of B, if it's not F light with B, the rectangle with the current FillColor and FillStyle populated, is transparent, the default value of FillStyle


Description

Draw connecting lines, before the end of a line is after the beginning of a line,

The width of the line depends on DrawWidth attribute values, draw a line on the background and the method of rectangular depends on DrawMode and DrawStyle attribute values,

CurrentX, when performing a Line method and CurrentY attributes are parameter is set to the finish Line,

This method cannot be used to With... End With statement block,

CurrentX, CurrentY attribute


Gets or sets the level of the next print or drawing method (CurrentX) or vertical (CurrentY) coordinates, when the design is not available,

Syntax

Object. CurrentX [=x]
Object. CurrentY [=y]

CurrentX and CurrentY attribute grammar includes the following parts:

Part of the description
Object expression, and its value is "applied" in the list of an Object,
X to determine horizontal coordinates numerical,
Y to determine the vertical coordinates numerical,


Description

Coordinate measurement, starting at the upper left of the object on the left side of the object CurrentX attribute value is 0, the above CurrentY is 0, coordinate in twips, or to ScaleHeight ScaleWidth, ScaleLeft, ScaleTop ScaleMode property definitions and units of measurement,

Use the graphic method, below CurrentX and CurrentY set values change according to the following instruction:

Methods set up CurrentX, CurrentY:
The center of the Circle object,
Cls 0, 0,
EndDoc 0, 0,
The finish Line Line,
Brought by 0, 0,
Print the next Print position,
Pset draw points,

CodePudding user response:


The Print method


In the Immediate window display text,

Syntax

Object. The Print [outputlist]

Print method syntax object has the following qualifiers and parts:

Part of the description
Object required, object expression, and its value is "applied" in the list of objects,
Outputlist optional, expression to expression of print or list, if omitted, then print a blank line,


Outputlist parameters with the following syntax and parts:

{the Spc (n) | Tab (n)} expression charpos

Part of the description
Spc (n) optional and is used to insert blank characters in the output, here, n to insert blank characters,
Tab (n) optional and used to position the insertion point on the absolute column number, here, n as the column number, use the no parameter Tab (n) will insert point positioning the starting position of the next print area,
Numerical expression or expression optional to print string expression,
Charpos optional, specify the next character of the insertion point, use a semicolon (;) Directly to the insertion point positioning are shown in a character, using the Tab (n) position the insertion point on the absolute column number, use the no parameter Tab will insert point positioning in the starting position of a print area, if you omit charpos, is the next line print the next character,


Description

Can use the blank or semicolons to separate multiple expression,

On the system specified country setting, with decimal separator will all printed to the Immediate window data formatted correctly, the key word to use is applicable to the main application of language output,

For Boolean data, or printing the True or False, according to the locale Settings of the host application to translation of True and False keywords,

System is used to identify the standard short Date format to write the Date data, Date or time when parts are lost or is zero, only writing has provided parts,

If outputlist data is Empty, no content to write, but, if outputlist data is Null, the output is Null, the output of Null keyword, want to translate the key word right up,

To put the wrong data as the Error errorcode output, the output Error keywords, to translate the right keywords,

If in a module with the default display space using this method, you will need to object, for example, if you don't specify objects in this method is called on the standard module, will lead to errors occur, however, if the calling on form module, will be displayed on the form "outputlist",

Note because the Print method is carried out in accordance with the proportion of characters printed, so the number of characters and character occupied the width of the fixed number of columns, for example, like "W" width the width of the letters to occupy more than one fixed column width, such as "I" and had smaller holds the width of the narrow letters, considering the wider space to use more than the average characters, table columns must be enough leeway, in addition, also can use fixed pitch fonts (like Courier) to ensure that each character are accounted for only one column,

CodePudding user response:


ScaleHeight, ScaleWidth attribute


When using the graphical method or adjust the control position, returns or sets the object's internal levels (ScaleWidth) or vertical (ScaleHeight) unit of measure, the MDIForm object, when the design is not available, and is read-only at run time,

Syntax

Object. ScaleHeight [=value]

Object. ScaleWidth [=value]

ScaleHeight and ScaleWidth attribute grammar includes the following parts:

Part of the description
Object expression, and its value is "applied" in the list of an Object,
A Value used to specify a numerical expression of a horizontal or vertical measurement,


Description

To be able to use these attributes to drawing or print to create a custom grid scale, for example, statements ScaleHeight=100 will change the form of the actual internal height measurement unit, replace the current height of n units (twip, pixels,... ), the height will become 100 custom units, therefore, 50 units of distance is half of the object's height/width, will exceed 101 units of distance object 1 unit,

In order to define based on the standard unit of measure scale, such as tweed, pounds, pixels, characters, inches, millimeters, or cm ScaleMode property should be used,

The attribute is set to positive will coordinate from the top down and from left to right to increase, they are set to a negative value will make the coordinates from the bottom up and from right to left to increase,

These properties and the use of related ScaleLeft ScaleTop attribute, can set up a complete with positive, negative coordinates, the coordinates of the system, all these four Scale and ScaleMode attribute interactions in the following way:

Put any other Scale property is set to any value will make the ScaleMode automatically set to 0, the ScaleMode equals 0 is user-defined,


Set ScaleMode to a number greater than zero, will make ScaleHeight ScaleWidth and unit of measure of the change, and will be ScaleLeft and ScaleTop is set to 0, in addition, CurrentX and CurrentY set values will change to reflect the new coordinates of points,
Can also be used in the statements set ScaleHeight Scale method, ScaleWidth, ScaleLeft and ScaleTop attributes,

Note ScaleHeight and ScaleWidth property and the Height and Width attributes are not the same,

For MDIForm object, ScaleHeight ScaleWidth and involves only the form is not covered by the PictureBox control area, in the MDIForm Resize event should avoid to use these attributes to Resize the PictureBox,

CodePudding user response:

All your picture

To establish a coordinate system, and then according to the coordinates, draw up,

CodePudding user response:

Can refer to the following code changes implemented drawing:
 Option Explicit 
Dim As Long I
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related