求AutoResize控件(分不够可加)

SonicOne 2003-09-13 11:02:34
类似的也行!求求各位了
...全文
35 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
abc10 2003-09-13
  • 打赏
  • 举报
回复
'不要控件
'这个加在模块里
Public FormOldWidth As Long
Public FormOldHeight As Long


Public Sub ResizeInit(FormName As Form) '记录窗体及各控件原始位置及尺寸
Dim Obj As Control

FormOldWidth = FormName.ScaleWidth
FormOldHeight = FormName.ScaleHeight

On Error Resume Next
For Each Obj In FormName
Obj.Tag = Obj.Left & " " & Obj.Top & " " & Obj.Width & " " & Obj.Height & " "
Next Obj
End Sub

Public Sub ResizeForm(FormName As Form) '当窗体大小发生变化时,各控件尺寸及位置作相应变化
Dim Pos '控件原先尺寸、位置
Dim I As Long '计数器
Dim Obj As Control '遍历窗体内控件
Dim ScaleX As Double, ScaleY As Double '缩放比例

ScaleX = FormName.ScaleWidth / FormOldWidth

ScaleY = FormName.ScaleHeight / FormOldHeight

On Error Resume Next

For Each Obj In FormName
Pos = Split(Obj.Tag, " ", , vbTextCompare)
Obj.Move Pos(0) * ScaleX, Pos(1) * ScaleY, Pos(2) * ScaleX, Pos(3) * ScaleY
Next Obj
End Sub

Public Sub AdjustForm(ScaleX As Single, ScaleY As Single, frm As Form)
Dim s As Object
On Error Resume Next
For Each s In frm.Controls
s.Left = s.Left * ScaleX
s.Top = s.Top * ScaleY
s.Width = s.Width * ScaleX
s.Height = s.Height * ScaleY
Next
End Sub

'以下加在你的form窗口里。

Private Sub Form_Load()
Call ResizeInit(Me)
End Sub
'分不够再加,有多少分啊? :)
Private Sub Form_Resize()
Call ResizeForm(Me)
End Sub

一个老外(西班牙)编写的控件,封装了全部google maps api ,使用在DELPHI中使用谷歌地图变得非常简单 GMLib - Google Maps Library Send suggestions to gmlib@cadetill.com Supported Delphi version: Delphi 6, 7, 2007, 2010, XE2, XE3 Tested Windows Versions: XP, 2003, Vista, 7 Change History january 14, 2013 - Google Maps Library v0.1.9 - Improvement: Compatible with FMX framework. - Improvement: About all Geometry Library coded. - bug fixed: Some bugs fixes. - Attempt to do compatible with DCEF components. October 05, 2012 - Google Maps Library v0.1.8 - Improvement: Compiled under XE3 - Improvement: new component added, the TGMElevation. - bug fixed: General -> fixed all memory leaks found - bug fixed: TGMDirection -> the OnDirectionsChanged event was not triggered - Improvement: TBasePolyline -> class TLinePoints and TLinePoint is disassociated from TPolyline and they are transferred to GMClasses - Improvement: TBasePolyline -> implements ILinePoint interface September 11, 2012 - Google Maps Library v0.1.7 - bug fixed: some memory leaks fixed (there is still some) (thanks Donovan) - Improvement: TGMCircle -> modified all Set and ShowElements methods to use the new method ChangeProperties inherited from TLinkedComponent - Improvement: GMFunctions -> added new functions of transformation types - Improvement: TGMGeoCode-> added boolean property PaintMarkerFound. To true, all markers are automatically generated (if a TGMMarker is linked) (by Luis Joaquin Sencion) - Improvement: TGMGeoCode-> generated URL is encoded in UTF8 to avoid problems with special characters (? accents, ....) - Improvement: TGMMap.TNonVisualProp -> added MapMarker property. True if Map Maker tiles should be used instead of regular tiles. - Improvement: TLatLngEvent -> the events of this type now have a new parametre, X and Y, of Real type, with information of point (X,Y) - Improvement: TLinkedComponent -> added ShowInfoWinMouseOver boolean property. If true, show the InfoWindows when mouse is over the object. Now

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧