当前位置:网站首页>vb. Net changes with the window, scales the size of the control and maintains its relative position
vb. Net changes with the window, scales the size of the control and maintains its relative position
2022-07-06 08:43:00 【Flying_】
Public Class Form1
Dim _originClienSize As Size = Nothing
Dim _originBtnSize As Size
Dim _originBtnPos As Point
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' You have to use ClientSize, Out of commission Size, because Size Including the width and height of the window frame , This is a fixed value , Cannot be calculated into the scaling factor
' Otherwise, when it shrinks to a certain extent , The calculation proportion of the size and position of the control is wrong
_originClienSize = ClientSize
_originBtnSize = Button2.Size
_originBtnPos = Button2.Location
End Sub
Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
If _originClienSize <> Nothing Then
Button2.Width = ClientSize.Width / _originClienSize.Width * _originBtnSize.Width
Button2.Height = ClientSize.Height / _originClienSize.Height * _originBtnSize.Height
Dim point As Point = New Point(ClientSize.Width / _originClienSize.Width * _originBtnPos.X, ClientSize.Height / _originClienSize.Height * _originBtnPos.Y)
Button2.Location = point
End If
End Sub
End Class
effect


边栏推荐
- Visual implementation and inspection of visdom
- JVM quick start
- pytorch训练好的模型在加载和保存过程中的问题
- POI add write excel file
- egg. JS getting started navigation: installation, use and learning
- Deep analysis of C language data storage in memory
- 按位逻辑运算符
- ROS编译 调用第三方动态库(xxx.so)
- Swagger setting field required is mandatory
- C语言双指针——经典题型
猜你喜欢

2022.02.13 - 238. Maximum number of "balloons"

Roguelike game into crack the hardest hit areas, how to break the bureau?

堆排序详解
![[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes](/img/ac/773ce8ee7f380df19edf8373250608.jpg)
[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes

Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)

Precise query of tree tree

pytorch训练好的模型在加载和保存过程中的问题

【ROS】usb_cam相机标定

Indentation of tabs and spaces when writing programs for sublime text

JS native implementation shuttle box
随机推荐
win10系统中的截图,win+prtSc保存位置
2022.02.13 - NC003. Design LRU cache structure
Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)
@Jsonbackreference and @jsonmanagedreference (solve infinite recursion caused by bidirectional references in objects)
Swagger setting field required is mandatory
China vanadium battery Market Research and future prospects report (2022 Edition)
Is it safe to open an account in Zheshang futures?
Mobile phones and computers on the same LAN access each other, IIS settings
移位运算符
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
R language uses the principal function of psych package to perform principal component analysis on the specified data set. PCA performs data dimensionality reduction (input as correlation matrix), cus
egg. JS directory structure
On the inverse order problem of 01 knapsack problem in one-dimensional state
JS inheritance method
深度剖析C语言指针
MySQL learning record 10getting started with JDBC
Function coritization
sys. argv
Current situation and trend of character animation
【嵌入式】Cortex M4F DSP库