| |

VerySource

 Forgot password?
 Register
Search
View: 750|Reply: 3

Unit problem setting Left property

[Copy link]

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-3 15:50:01
| Show all posts |Read mode
VB6.0

Private Sub Timer_Timer ()
    If Pic_OPbackground.Left = -534 * Screen.TwipsPerPixelX Then
        Timer.Enabled = False
        Text1.Text = "1"
    Else
        Pic_OPbackground.Left = Pic_OPbackground.Left-0.1 * Screen.TwipsPerPixelX
    End If
End Sub

After the execution, only the statements after the else are executed.I tried to set Pic_OPbackground.Left = -534 * Screen.TwipsPerPixelX. There is a problem with the screen. Similar Left Top properties cannot be set in pixels?

PS: VB cannot use the operator "-="?
Reply

Use magic Report

0

Threads

9

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-1-3 15:51:01
| Show all posts
Pic_OPbackground.Left-0.1 * Screen.TwipsPerPixelX
This sentence is difficult to guarantee Pic_OPbackground.Left = -534 * Screen.TwipsPerPixelX is true
Change to If Pic_OPbackground.Left <= -534 * Screen.TwipsPerPixelX Then


-= Not supported
Reply

Use magic Report

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2020-1-3 17:54:01
| Show all posts
Thank youyoh2006for your answer. If you change it to If Pic_OPbackground.Left <= -534 * Screen.TwipsPerPixelX Then, it will take more time to meet the conditions, but after I execute it, the problem still exists.
The key to the problem lies in the interpretation of the sentence Pic_OPbackground.Left = -534 * Screen.TwipsPerPixelX, because I have tried Pic_OPbackground.Left = -534 * Screen.TwipsPerPixelX to set this sentence directly, the display screen is problematic, and the performance phenomenon is Show only background color
Reply

Use magic Report

0

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 Invalid IP Address

Post time: 2020-1-3 22:06:01
| Show all posts
Can be changed to If Pic_OPbackground.Left <= -534 * Screen.TwipsPerPixelX Then
 The problem should be solved!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list