Home  >  Article  >  Computer Tutorials  >  How to realize that the background image of MDI form changes with the size of the window in VB

How to realize that the background image of MDI form changes with the size of the window in VB

PHPz
PHPzforward
2024-01-07 12:30:11613browse

How to realize that the background image of MDI form changes with the size of the window in VB

In order to help players who have not passed the level yet, we can use a simple method to solve the puzzle. We can add a picturebox control within the main MDI form and add an image control within it. In this way, we can solve the puzzle by operating this control. Hope this method can help everyone!

Properties of Picture1:

1.Align=top

2.Appearance=flat

3.BordeStyle=None

4.TabStop=false

Properties of Image1:

1.Stretch=true

Add the following code in the resize event of the MDI form:

In order to help players solve puzzles better, let us learn about the specific methods of solving puzzles. In this process, we need to pay attention to an important function "Private Sub MDIForm_Resize()", which will play a key role in resizing the window.

In order to help those players who have not cleared the level yet, let us learn about the specific puzzle solving methods. An important step in the puzzle-solving process is to set the height of the picture to be equal to the height of the window, which can be achieved by using the code "Me.Picture1.Height = Me.Height". This operation will make the image adapt to the size of the window, allowing players to better observe and solve puzzles. hope

End Sub

Add the following code in the resize event of the Picture1 control:

In order to help those players who have not solved the puzzle yet, let us take a look at the specific methods of solving the puzzle.

In order to help players who have not passed the level yet, let us learn about the specific puzzle solving methods. In the game, you can try using the following code to move images: Me.Image1.Move 0, 0, Me.Picture1.Width, Me.Picture1.Height. This code can help you adjust the position and size of the image to better complete the puzzle task.

End Sub

The above code is a simple example, but when resizing, the width and height of picture1 and image1 can be accurately set through debugging to obtain a more complete and accurate image display effect.

One disadvantage of this method is that due to the adjustability of the form size, the background graphics may be deformed. Of course, we can also consider controlling changes in the size of the form to keep the aspect ratio of the form and the picture consistent, but this will add some additional control code.

What are vb programming used to add forms, MDI forms and other modules?

MDI Form

MDI (Multiple Document Interface) is a method for creating programs similar to the functionality in Photoshop of opening multiple documents in one window. Each program can only have one MDI main form, and other forms can be set as MDI subforms. In this way, users can conveniently process multiple documents at the same time in one interface, improving work efficiency.

Modules and class modules

Modules are a place for placing public information. Almost all code that can be placed in a form can be placed in a module. There are many benefits to using modules, the most obvious being that they simplify your code. But for simpler programs, using modules is not recommended as it will slow down the program.

UserControl

In VB6.0, programmers can develop their own controls or use third-party controls. Common third-party control formats include ocx and dll. There are also some programmers who are willing to share their experience and may develop controls in ctl format. If you obtain such a control, not only can it be used for free, but it also has another advantage compared to controls in ocx and other formats: it can be used without executing the regsvr32 command. This means that your program does not need to be packaged into installation files, which is equivalent to green software.

Add property page

For beginners, it may not be necessary to know how to add property pages to your own controls. This function is mainly used for custom needs during control development. When you right-click on most controls, you will see an option called "Properties", click on it to open the property page. On the property page, you can set various properties of the control, such as size, color, font, etc. This makes it easy to personalize the controls. But for the average user, knowing how to use property pages is not necessary because most applications already provide users with

add files

Sometimes when programmers develop programs, they use additional files for various purposes (such as necessary to implement a certain function, protect the copyright of the software, etc.), but if such files are deleted, the program cannot be used. , so you can use this function to import the file, and then VB will add this file to the main program when compiling. At the same time, there is another benefit: being able to create a program with only one exe file is green software.

The above is the detailed content of How to realize that the background image of MDI form changes with the size of the window in VB. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete