| |

VerySource

 Forgot password?
 Register
Search
View: 1069|Reply: 6

A small problem with VB

[Copy link]

8

Threads

19

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-9-28 10:30:01
| Show all posts |Read mode
It is required that each time the window is clicked, the size of the window is expanded by 10%, and when the window is clicked for the seventh time, the window is maximized.
I mainly don’t know what idea to write this loop statement
Thank you
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-28 13:45:01
| Show all posts
Dim i
Private Sub Form_Click()
If i <7 Then
i = i + 1
Me.Height = Me.Height * 1.1
Me.Width = Me.Width * 1.1
Else
Me.WindowState = 2
End If
End Sub
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-9-28 15:45:01
| Show all posts
Dim i As Integer
Private Sub Form_Click()

    i = i + 1
    Form1.Width = Screen.Width / 7 * i
    Form1.Height = Screen.Height / 7 * i
    Form1.Left = (Screen.Width-Form1.Width) / 2
    Form1.Top = (Screen.Height-Form1.Height) / 2
    If i = 7 Then i = 1

End Sub

Private Sub Form_Load()
Form1.AutoRedraw = True
End Sub

Play by yourself
Reply

Use magic Report

8

Threads

19

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-9-28 17:00:01
| Show all posts
Thank youeltada
By the way, does Me mean the current form? After defining Dim, what is the default value of i? Thank you for answering again, I will reveal the post immediately
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-9-29 14:00:01
| Show all posts
Feasible on the first floor
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-9-29 22:15:01
| Show all posts
i is 0 by default, just try it. Use the one on the first floor.
Reply

Use magic Report

1

Threads

2

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-10-5 21:18:12
| Show all posts
The bench in more detail
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