VB Dynamic Drive Control Arrays Don't Get Correct Coordinates

ID Number: Q77644

1.00

WINDOWS

buglist1.00

Summary:

Setting the Left, Width, or Top coordinate of the first element of a

control array of dynamic drive controls then loading a second element

of the array will result in the Left, Width, or Top coordinate of the

first and second elements being different. This problem occurs when

ScaleMode property of the form is set to Twip, Point, Millimeter,

Centimeter, or User ScaleMode. The problem does not occur when the

ScaleMode property of the form is set to Character, Pixel, or Inch.

Microsoft has confirmed this to be a problem in Microsoft Visual Basic

programming system version 1.0 for Windows. Microsoft is researching

this problem and will post new information here as it becomes

available.

More Information:

When the ScaleMode property of the form is set to Character, Pixel, or

Inch, the second and subsequent elements of the control array maintain

the same coordinates as the first element of the array, as expected.

When the ScaleMode of the form is set to Twip, Point, Centimeter,

Millimeter, or User, the subsequent elements of the control array of

dynamic drive controls will not have the same coordinates as the first

element of the array.

Steps to Reproduce Problem

--------------------------

1. Start Visual Basic. From the File menu, choose New Project

(ALT, F, N).

2. Place a drive control (Drive1) on a blank form (Form1).

3. From the Properties bar, set the Index property of Drive1 to 0

(this is the first element of a control array).

4. Double-click anywhere on the form to bring up the Form_Click event

procedure.

5. Add the following code to the Form_Click event procedure of Form1:

SUB Form_Click ()

Drive1(0).Left = 2000 'Set the x coordinate of the first

'element of the array

Load Drive1(1) 'This loads the second element of the

'control array

Print Drive1(0).Left,Drive1(1).Left 'Print the x coordinate

'of the two elements of

'the control array

End Sub

6. From the Run menu, choose Start.

7. Click anywhere on the form.

The x (left) coordinates of the Drive1(0) and drive Drive1(1) will

print directly on the form.

Note: The Drive1(0) left coordinate will be 2000, where the Drive1(1)

left coordinate is 1995.

A similar discrepancy occurs when the ScaleMode property of Form1 is

set to Point, Centimeter, Millimeter, or User.

Specifying Drive1(0).Width then loading the next control array element

results in the same problem. The width of the second element of the

array will be slightly different from the first.

The Align to Grid feature of the Visual Basic 1.0 programming

environment (VB.EXE) does not change the position or size of any of

the elements of the control array.

This problem does not occur when the ScaleMode property of the form is

set to Character, Pixel, or Inch.

A workaround for the problem is to set the Left, Top, or Width property

of the second control array element equal to the like property of the

first control array element. Insert the following code after the Load

Drive1(1) statement in step 5 above to work around the problem as

follows:

Drive1(1).Left = Drive1(0).Left

Additional reference words: 1.00