Ò»ÀÍÓÀÒÝÈÃVB×Ô¶¯¸Ä±ä¿Ø¼þ´óС_VB.net_ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤»ùµØ--Powered by WWW.RONGSEN.COM.CN

Ò»ÀÍÓÀÒÝÈÃVB×Ô¶¯¸Ä±ä¿Ø¼þ´óС

×÷ÕߣººÚ¿Í·ÀÏßÍø°²VB½Ì³Ì»ùµØ À´Ô´£ººÚ¿Í·ÀÏßÍø°²VB½Ì³Ì»ùµØ ä¯ÀÀ´ÎÊý£º0

±¾Æª¹Ø¼ü´Ê£º¿Ø¼þ´óС¸Ä±ä×Ô¶¯
ºÚ¿Í·ÀÏßÍø°²ÍøѶ£º--µ±´°Ìå´óС¸Ä±äʱ£¬ÈçºÎ¶¯Ì¬µÄ¸Ä±ä¿Ø¼þµÄ´óСÊÇÐí¶àVB³ÌÐòԱͷʹµÄÊ¡£ÓеÄÈËÉèÖô°ÌåResizableµ«È´²»¸Ä±ä¿Ø¼þµÄ´óС£»ÓеÄÈËÔò¸ù¾Ý¿Ø¼þµÄ¾ø¶ÔλÖÃÓë´°¿Ú´óСÏà¼Ó¼õµÄ°ì·¨À´ÖØж¨Î»¿Ø¼þÓë...

--µ±´°Ìå´óС¸Ä±äʱ£¬ÈçºÎ¶¯Ì¬µÄ¸Ä±ä¿Ø¼þµÄ´óСÊÇÐí¶àVB³ÌÐòԱͷʹµÄÊ¡£ÓеÄÈËÉèÖô°ÌåResizableµ«È´²»¸Ä±ä¿Ø¼þµÄ´óС£»ÓеÄÈËÔò¸ù¾Ý¿Ø¼þµÄ¾ø¶ÔλÖÃÓë´°¿Ú´óСÏà¼Ó¼õµÄ°ì·¨À´ÖØж¨Î»¿Ø¼þÓë¸Ä±ä´óС£¬ÕâÖÖ°ì·¨±È½Ï·±Ëö£¬ÇÒ²»¿ÉÖØÓ㻵±È»Ò²ÓÐÈËÔòÏÞ¶¨´°¿Ú¸É´à²»Èøı䡣ÓÐûÓÐÒ»ÖÖ¼ò±ãÒ×Ðеİ취£¿´ð°¸Êǿ϶¨µÄ£¬ÏÂÃæ¸ø³öÒ»¸öÒ»ÀÍÓÀÒݵİ취£¬Ô´³ÌÐòÈçÏÂ:

Option Explicit
Private FormOldWidth As Long
`±£´æ´°ÌåµÄԭʼ¿í¶È
Private FormOldHeight As Long
`±£´æ´°ÌåµÄԭʼ¸ß¶È

`ÔÚµ÷ÓÃResizeFormÇ°Ïȵ÷Óñ¾º¯Êý
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
On Error GoTo 0
End Sub

`°´±ÈÀý¸Ä±ä±íµ¥ÄÚ¸÷Ôª¼þµÄ´óС£¬
ÔÚµ÷ÓÃReSizeFormÇ°Ïȵ÷ÓÃReSizeInitº¯Êý
Public Sub ResizeForm(FormName As Form)
Dim Pos(4) As Double
Dim I As Long, TempPos As Long, StartPos 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
StartPos = 1
For I = 0 To 4
`¶ÁÈ¡¿Ø¼þµÄԭʼλÖÃÓë´óС

TempPos = InStr(StartPos,
Obj.Tag, " ", vbTextCompare)
If TempPos > 0 Then
Pos(I) = Mid(Obj.Tag,
StartPos, TempPos - StartPos)
StartPos = TempPos + 1
Else
Pos(I) = 0
End If
`¸ù¾Ý¿Ø¼þµÄԭʼλÖü°´°Ìå¸Ä±ä´óС
µÄ±ÈÀý¶Ô¿Ø¼þÖØж¨Î»Óë¸Ä±ä´óС
Obj.Move Pos(0) * ScaleX, Pos(1)
* ScaleY, Pos(2) * ScaleX, Pos(3) * ScaleY
Next I
Next Obj
On Error GoTo 0
End Sub

Private Sub Form_Load()
Call ResizeInit(Me) `ÔÚ³ÌÐò×°Èëʱ±ØÐë¼ÓÈë
End Sub

Private Sub Form_Resize()
Call ResizeForm(Me) `È·±£´°Ìå¸Ä±äʱ¿Ø¼þËæÖ®¸Ä±ä
End Sub

----±¾ÀýÖиø³öÁ˶þ¸öº¯Êý:ResizeInitºÍResizeForm,ÔÚµ÷ÓÃResizeForm֮ǰ±ØÐëÏȵ÷ÓÃResizeInit¡£Äã¿ÉÒÔ½«±¾³ÌÐò¿½µ½´°Ìå´úÂë¶ÎÀȻºóÔÚ´°ÌåÀï¼ÓÈëÈÎÒâ¿Ø¼þ¼´¿É½øÐвâÊÔ

    ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤·½°¸±¾ÆªÁ¬½Ó£ºhttp://www.rongsen.com.cn/show-14745-1.html
Íøվά»¤½Ì³Ì¸üÐÂʱ¼ä:2012-04-03 01:13:38  ¡¾´òÓ¡´ËÒ³¡¿  ¡¾¹Ø±Õ¡¿
ÎÒÒªÉêÇë±¾Õ¾£ºNµã | ºÚ¿Í·ÀÏß¹ÙÍø |  
רҵ·þÎñÆ÷ά»¤¼°Íøվά»¤ÊÖ¹¤°²È«´î½¨»·¾³£¬ÍøÕ¾°²È«¼Ó¹Ì·þÎñ¡£ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤»ùµØÕÐÉ̽øÐÐÖУ¡QQ:29769479

footer  footer  footer  footer