¤ÀÃþ |
¼ÐÃD |
¤j·N |
§@ªÌ |
¤é´Á |
¦r¦ê³B²z | Àɮפ¤¦r¦ê·j´M | InStr ¨ç¼Æªº¨Ï¥Î | ¦Ñ©Ç | 1998/10/25 |
¦r¦ê³B²z | ÀɮץΦr²Îp | ¡@ | ¦Ñ©Ç | 1998/10/27 |
¦r¦ê³B²z | ¦r¦ê¹ï»ô¿é¥X | ¦P¦r¼Æªº¦r¦ê¨Ã¤£µ¥ªø | ¦Ñ©Ç | 1998/11/8 |
ÅܼƳB²z | For Each ±Ôz»Pª«¥ó°Ñ·Ó | ¡@ | ¦Ñ©Ç | 1998/10/27 |
ÅܼƳB²z | Collection À³¥ÎÁ|¨Ò | ¡@ | ¦Ñ©Ç | 1998/11/28 |
ÅܼƳB²z | ¤@ª«±±¦h¶µ | ª«¥ó°Ñ·Óªº¾Þ§@¤è¦¡ | ¦Ñ©Ç | 1998/12/2 |
¤é´Á®É¶¡ | ¤½¤åµ²®×¤épºâ½d¨Ò | ¡@ | ¦Ñ©Ç | 1998/11/17 |
¤é´Á®É¶¡ | VB ¤p¾xÄÁ½d¨Ò | ¡@ | ¦Ñ©Ç | 1998/11/18 |
¤é´Á®É¶¡ | ®É¶¡¼È°± | ¡@ | ¦Ñ©Ç | 1998/11/28 |
¹Ï§Î³B²z | ½ò¦a¹pµe±¼ÒÀÀ½d¨Ò | Line ¤èªk¤Î PictureBox °Ï¶ô¤À³Î | ¦Ñ©Ç | 1998/10/30 |
¹Ï§Î³B²z | ¹Ï¤ùªº 90 «×½Âà | ¡@ | ¦Ñ©Ç | 1998/11/5 |
¹Ï§Î³B²z | ¹Ï¤ù±²°Ê²°½d¨Ò | ¡@ | ¦Ñ©Ç | 1998/11/26 |
ª«¥ó³B²z | «ç¼ËÂI¨ú Disable ªºª«¥ó | ¥Î Form ±µ¦¬·Æ¹«¨Æ¥ó | ¦Ñ©Ç | 1998/11/19 |
¥~³¡µ{¦¡ | Åý³à¥¢¾nÂIµ{¦¡«ì´_¾nÂI | ¶È©ó Shell ±Ò°ÊªÌ | ¦Ñ©Ç | 1998/10/28 |
µøµ¡¬É± | Âù½u©T©wµøµ¡ªº¤Á´« | ¡@ | fumi | 1998/9/23 |
µøµ¡¬É± | Åý ChildForm ¶ñº¡ MDIForm | ±ø¥ó¡GChildForm ¤£n³Ì¤j¤Æ | ¦Ñ©Ç | 1998/11/10 |
µøµ¡¬É± | Ãö³¬©Ò¦³µ{¦¡¸ü¤Jªºªí³æ | ¤£¯d¤Ut¾áªºµ²§ôµ{¦¡ | ¦Ñ©Ç | 1998/11/13 |
¦â±m³]©w | ¥Î±²¶b³]©wÃC¦âÈ | ¡@ | ¦Ñ©Ç | 1998/11/17 |
ÀÉ®× I/O | ³Ì§Öªº¶}ÀɼҦ¡ | Open Binary | ¦Ñ©Ç | 1998/11/17 |
ÀÉ®× I/O | Àˬd¥Ø¿ý¤¤¯S©wÀɮ׬O§_¦s¦b | Dir ¨ç¼Æªº¨Ï¥Î | ¦Ñ©Ç | 1998/11/26 |
¡@
Eric HSU ¼¶¼g©ó¤å³¹
¦b VB ¸Ìn«ç»ò¨ú±o¤@Ó¤å¦rÀɪº¦æ¼Æ¡H¤S¦p¦ó¦b¤@ÓÀɮפ¤·j´M¯S©w¦r¦ê¡H
¦Ñ©Çµª¡G
'´ú¸Õ¥»½d¨Ò½Ð¦bªí³æ¤W¥¬¸m Label1,2¡BText1,2¡BCommand1
Option Explicit
Private Sub Command1_Click()
Dim FileHandle As Integer
Dim I As Long, SearchPos As Long
Dim LineString As String
Dim LongString As String
FileHandle = FreeFile
Open Text1.Text For Input As #FileHandle
Do While Not EOF(FileHandle)
Line Input #FileHandle, LineString
I = I + 1
LongString = LongString + LineString
Loop
MsgBox "ÀÉ®×Á`¦æ¼Æ¡G" & Str(I)
SearchPos = InStr(1, LongString, Text2.Text)
If SearchPos <> 0 Then
MsgBox "[" & Text2.Text & "]" & "¦b " & Str(SearchPos) & "¦ì¸m"
Else
MsgBox "§ä¤£¨ì[" & Text2.Text & "]"
End If
End Sub
Private Sub Form_Load()
Label1.Caption = "½Ð¿é¤JÀɮצWºÙ"
Label2.Caption = "½Ð¿é¤J·j´M¦r¦ê"
Text1.Text = App.Path
Text2.Text = ""
End Sub
Yih-Jaj Lin ¼¶¼g©ó¤å³¹
½Ð°Ý For Each element In Group ... Next ³oÓ±ÔzÀ³¸Ó¦p¦ó¨ÓÀ³¥Î?§Ú¬Ý¤F½u¤W¤â¥U,¦ý¬O¨S¦³¹ê»Ú¨Ò¤l,©Ò¥HÁÙ¬O¤£¬ÆÁA¸Ñ¡H
¦Ñ©Çµª¡G
¥ýÁ|½d¨Ò¡G
- µ{¦¡¥Ø¼Ð¡G
§ä¥X Form ¤W©Ò¦³ CommandButton Control¡A¨Ã§â¥¦Ìªº Caption §ï¦¨ "©R¥O"+§Ç¦C¼Æ¦r¡C- µ{¦¡½d¨Ò¡G
Dim SetControl As Control
Dim I As Integer
I = 1
For Each SetControl In Me.Controls
If TypeName(SetControl) = "CommandButton" Then
SetControl.Caption = "©R¥O" & I
I = I + 1
End If
Next
¦A»¡ For Each...±Ôzªºn»â¡G
- Element ¥²¶·¬O¦b¶°¦Xª«¥ó¤¤ªº¤@Óª«¥ó¡C
- ¦]¬° Element ¬Oª«¥ó¡A©Ò¥H¥¦ªº«Å§i¥²¶·¬O [ª«¥ó³q¥Î¦WºÙ]¡B[Object] ©Î [Variant] ¡A¨ä¤¤¥Hª«¥ó³q¥Î¦WºÙ®Ä²v³Ì¦n¡AObject ¦¸¤§¡AVariant ³Ì®t¡A¦ý¤TªÌ¬Ò¯à¹F¦¨¥Øªº¡C
- ¦]¬° Element ¬O¦b¶°¦Xª«¥ó¤¤ªº¤@Óª«¥ó¡A©Ò¥H§A¥²¶·ª¾¹D¥¦¶°¦X¦WºÙ¬O¤°»ò¡A¦p Form ¤W©Ò¦³ªº±±¨î¶µ¶°¦X¦WºÙ¬° Me.Controls or FormName.Controls¡C
- ·í«Å§iª«¥óÅܼÆ(¦p SetControl)¹ï·Ó¨ì¶°¦Xª«¥ó¤¤¬Y¤@ª«¥ó®É¡A§Y©M¸Óª«¥ó²£¥Í°Ñ·ÓÃö«Y(¦p CommandButton)¡A§A¥i¨Ï¥Î¸Óª«¥óªº©Ò¦³ÄݩʡB¤èªk¡A¹ï«Å§iª«¥óÅܼÆ(¦pSetControl)ªº©Ò¦³³]©w¡A³£±N¤Ï¬M¦b°Ñ·Óª«¥ó(CommandButton)¤W¡C©Ò¥H For Each ¥u¬O±Nª«¥óÅܼƳv¤@°Ñ·Ó¨ì¶°¦Xª«¥ó¤¤¡A¯u¥¿«nªº¬O§An¹ï¶°¦Xª«¥ó°µ¦óºØ³]©w¡C
- ª«¥óÅܼƹﶰ¦Xª«¥óªº°Ñ·ÓÃö«Y¨Ã¤£ÀH For Each °j°éµ²§ô¦Óµ²§ô¡A¦pªG°j°é¦ÛµMµ²§ô¡A¨ºª«¥óÅܼƬO°Ñ·Ó¶°¦X¤¤³Ì«á¤@Óª«¥ó¡C¦pªG¨Ì±ø¥ó±Ä¥Î Exit For ¤è¦¡±j¢µ²§ô¡A¨º»òª«¥óÅܼƬO°Ñ·Ó Exit ±Ôz«eªº¨ºÓª«¥ó¡A³o¦³¥H¤U¨âÓ·N¸q¡G
- ´N°O¾ÐÅé¨Ï¥Î¦Ó¨¥¡A°£«D¨Ï¥Î Set ª«¥óÅܼÆ=Nothing ¡A§_«hª«¥óÅܼƷ|¤@ª½¦û¦³ì°O¾Ð°Ï¶ô¡AµM«á¨Ì·ÓÅܼƥͦsì«h³Qµ²§ô¡A¦b°Ï°ìùثŧiªº¦b°Ï°ìµ²§ô®Éµ²§ô¡A¤½¥ÎÅܼƫh¦bµ{¦¡µ²§ô®Éµ²§ô¡C
- ´N°Ñ·ÓÃö«YªºÄ~Äò¨Ï¥Î¦Ó¨¥¡A¦b°Ï°ìµ{§Çùثŧiªºª«¥óÅܼƦb For Each °j°éµ²§ô«á¥i¥HÄ~Äò¨Ï¥Î¨ä°Ñ·ÓÃö«Y¡Aª½¨ì°Ï°ìµ{§Çµ²§ô¬°¤î¡C¤½¥Îª«¥óÅܼơA«h¦b¥þ³¡¼Ò²Õ³£¥i¥HÄ~Äò¨Ï¥Î¨ä°Ñ·ÓÃö«Y¡Aª½¨ì§A Set Nothing or µ{¦¡µ²§ô¡C
¡@
`½¶ªÞ ¼¶¼g©ó¤å³¹
½Ð°Ý¸Ó¦p¦ó¼g¤@¤ä¯à±N¤@^¤å¦r¦êªº©Ò¦³^¤å¦r¥À¡B¼ÐÂI²Å¸¹¡BªÅ®æ¡B¼Æ¦r©Ò¥X²{ªº¦¸¼Æµ¹²Îp¥X¨Ó«¨????????
¦Ñ©Çµª¡G
Option Explicit
'´ú¸Õ¥»µ{¦¡½Ð©ó¼Ð³æ¤W¥¬¸m Command1,2,3¡BLabel1¡BList1 ¤Î
'CommonDialog1
'Àx¦s©Ò¦³¦r½X¤§°}¦C
Dim varCalc(32766) As Long
'¦U¦r¤¸¨Ï¥Î¦¸¼Æ²Îp
Private Sub Command1_Click()
'ÀÉ®×¥N¸¹
Dim FileHandle As Integer
'¤¤¤å¦r½Xt¸¹Âà´«
Dim CharNo As Integer
Dim I As Long
'¤G¶i¨úÀɤ§ Buffer
Dim Buff() As Byte
'³v¦r¨ú¥X¤§ªøµuÅܼÆ
Dim LongString As String, ShortString As String * 1
'Àɮ׸ô®|¤Î¦WºÙ
Dim FileString As String
'²M°£«e¦¸³]©w
CommonDialog1.filename = ""
'±Ò¥Î¶}Àɹï¸Ü²°
CommonDialog1.ShowOpen
'¨ú±oÀɮ׸ô®|¤Î¦WºÙ
FileString = CommonDialog1.filename
If FileString = "" Then
MsgBox "¥¼¿ï¾Ü¨Ï¥ÎÀɮסAµLªk²Îp¡C", vbOKOnly, "Àɮ׿ù»~"
Exit Sub
End If
Me.MousePointer = 11
'²M°£¤W¤@¦¸ªº¶µ¥Ø
List1.Clear
'¥Î Byte °}¦C¼Ò¦¡¶}Àɳt«×¤ñ¸û§Ö
FileHandle = FreeFile
Open FileString For Binary As #FileHandle
ReDim Buff(LOF(FileHandle) - 1)
Get #FileHandle, , Buff
Close #FileHandle
'§â byte °}¦C¦r½XÂন Unicode¡A©ñ¤J LongString ¤¤
'¥H«K³v¦r¨ú¥X
LongString = StrConv(Buff, vbUnicode)
'²M°£ Buffer ¦û¥Îªº°O¾ÐÅéªÅ¶¡
Erase Buff
For I = 1 To Len(LongString)
'´`§Ç¨ú¥X¤@¦r
ShortString = Mid(LongString, I, 1)
'¨ú±o¸Ó¦r½X¤§µ´¹ïÈ
CharNo = Abs(Asc(ShortString))
'±N»P¨ä¹ïÀ³¤§°}¦C«ü¯Á¤Þp¼Æ¥[ 1
varCalc(CharNo) = varCalc(CharNo) + 1
Next
'©ñ¨ì ListBox ùØÅã¥Ü²Îpµ²ªG
For I = 0 To UBound(varCalc)
'p¼Æ¤£¬° 0 ªº¤~Åã¥Ü
If varCalc(I) > 0 Then
CharNo = I
'¤¤¤å¦r½X¬Ot¼Æªº¡A©Ò¥Hn§â°}¦C¯Á¤Þ¥[t¸¹
If CharNo > 255 Then CharNo = -CharNo
List1.AddItem "[" & Chr(CharNo) & "]" & varCalc(I)
End If
DoEvents
Next
'¦³¶}Àɤ~¯à¦sÀÉ
Command2.Enabled = True
Me.MousePointer = 0
End Sub
'±N²Îp¼ÆÈ¦s¦¨¦s¤å¦rÀÉ
Private Sub Command2_Click()
Dim FileHandle As Integer, CharNo As Integer
Dim FileString As String
Dim I As Long
CommonDialog1.filename = ""
CommonDialog1.ShowSave
FileString = CommonDialog1.filename
If FileString = "" Then
MsgBox "¥¼¿ï¾Ü¨Ï¥ÎÀɮסAµLªk¦sÀÉ¡C", vbOKOnly, "Àɮ׿ù»~"
Exit Sub
End If
Me.MousePointer = 11
'¶}±Ò¿é¥XÀÉ
FileHandle = FreeFile
Open FileString For Output As #FileHandle
For I = 0 To UBound(varCalc)
'p¼Æ¤£¬° 0 ªº¤~¦s¤J
If varCalc(I) > 0 Then
CharNo = I
If CharNo > 255 Then CharNo = -CharNo
Write #FileHandle, Chr(CharNo), varCalc(I)
End If
Next
Close #FileHandle
Me.MousePointer = 0
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Caption = "ÀɮץΦr²Îp"
Label1.Caption = "²ÎpÆ[¹îµ¡"
Command1.Caption = "¶}±ÒÀÉ®×"
Command2.Caption = "¦s¦¨ÀÉ®×"
Command2.Enabled = False
Command3.Caption = "µ²§ô"
'°ÆÀɦW¹w³]¬O TXT
CommonDialog1.DefaultExt = "txt"
CommonDialog1.Filter = "¤å¦rÀÉ (*.txt)|*.txt|©Ò¦³ÀÉ®× (*.*)|*.*"
CommonDialog1.InitDir = App.Path
End Sub
¬q ÅA ¼¶¼g©ó¤å³¹
½Ð°Ý¤@¤U¦bVB¤¤§Ú§Q¥Îshell°õ¦æ¥~³¡µ{¦¡,«ü©w¥~³¡µ{¦¡¤£¾Ö¦³¾nÂI, ¥B³Ì¤p¤Æ (´N¬O°Ñ¼Æµ¹ 6)n«ç»ò°µ¤~¯àÅý³oÓµ{¦¡«ì´_¦¨¥þ¿Ã¹õ¤j¤p¡H
¦Ñ©Çµª¡G
Dim AppNum As Variant
Private Sub Command1_Click()
AppNum = Shell("c:\windows\notepad.exe", vbMinimizedNoFocus)
End Sub
Private Sub Command2_Click()
AppActivate AppNum
SendKeys "{ENTER}"
End Sub
±H¥óªÌ: terry
½Ð°Ý¦p¦ó¼g¹³½ò¦a¹p¤@¹³¥i³]©w¼e°ª«×,«ö¤U·Æ¹«¤è¶ô´N·|¤U¨I.
¦Ñ©Çµª¡G
£~£²¯í°Õ... ¼¶¼g©ó¤å³¹
·í¤@Óform³]©w¬°Âù½u©T©w®É,³o¤@Óµ{¦¡¦b°õ¦æªº®ÉÔ,>´NµLªk¥Îalt+tab¥h¤Á´«,¦n¹³¬OÅܦ¨I´º°õ¦æªºµ{¦¡¤F...¦³¨S¦³¿ìªk¥i¥H¥[¥H¸Ñ¨M©O??
fumi 榭G
ShowInTaskbar ³]¬° True....
YQ ¼¶¼g©ó¤å³¹
½Ð°Ý¤@¤U§rn«ç¼Ë¦bVB¤¤±N¹Ï¤ùÅý¥L±ÛÂà§r
¦Ñ©Çµª¡G
'°õ¦æ¥»½d¨Ò½Ð©óªí³æ¤W¥¬¸m Command1,2,3,4¡BPicture1,2
'¥»½d¨Ò¥u¤ä´© 90 «×±ÛÂà¡A¹w¥ô·N¨¤«×±ÛÂà¹Ï§Î¡A¥²¶·¨Ï¥Î¤T¨¤¨ç¼Æ¡A
'½d¨Ò½Ð°Ñ¦Ò CWW http://sunh.hosp.ncku.edu.tw/~cww/ VB¤ß±oµ§°O
Option Explicit
'API SetPixel ¦b VB ùج۹ïÀ³¥\¯à¬° PSet ¡AGetPixel ¬° Point ¡A
'¦ý¬°¨D§ó§Ö³tµeÂI¡A¬G±Ä¥Î API ¡C
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, ByVal Y As Long) As Long
'¹Ï°Ï°ª«×¤Î¼e«×
Dim PicWidth As Integer, PicHeight As Integer
'Ãä¬É¼e«×
Dim TransX As Single, TransY As Single
'¬O§_¶i¦æ±ÛÂà«Ã¸
Dim ReDraw As Boolean
'¤ô¥Â½Âà¶s
Private Sub Command1_Click()
With Picture1
'³]¬° AutoRedraw ³]¬° True ¤~¯à¨ú±o Picture1.Image
.AutoRedraw = True
'³]©w¶i¦æ±ÛÂà«Ã¸¡A§í¨î Picture1_Paint «Ã¸¥\¯à
ReDraw = True
'¤ô¥Â½Â઺ì²z¦b§âø¹Ï°_©lÂI³]¬°¥kºÝ¡A¦Ó¼e«×¬°t¼Æ¡C
.PaintPicture Picture2.Image, PicWidth - 1, 0, -PicWidth, PicHeight,
_
0, 0, PicWidth, PicHeight
.AutoRedraw = False
Picture2.Picture = .Image
'³]©w±ÛÂà«Ã¸µ²§ô¡A¶}©ñ Picture1_Paint «Ã¸¥\¯à
ReDraw = False
End With
End Sub
'««ª½Â½Âà¶s
Private Sub Command2_Click()
With Picture1
.AutoRedraw = True
ReDraw = True
'««ª½Â½Â઺ì²z¦b§âø¹Ï°_©lÂI³]¬°©³ºÝ¡A¦Ó°ª«×¬°t¼Æ¡C
.PaintPicture Picture2.Image, 0, PicHeight - 1,
PicWidth, -PicHeight, _
0, 0, PicWidth, PicHeight
.AutoRedraw = False
Picture2.Picture = .Image
ReDraw = False
End With
End Sub
'¶¶®É°w 90 ¶s
Private Sub Command3_Click()
Dim I As Integer, J As Integer
With Picture1
'Picture1 °ª«×¼e«×¤¬´«
.Width = ScaleX(PicHeight, vbPixels, Me.ScaleMode) + TransX
.Height = ScaleY(PicWidth, vbPixels, Me.ScaleMode) + TransY
ReDraw = True
.Visible = False
.AutoRedraw = True
'ì²z¡G§â Picture2 Áa½uªº¥½ºÝÂI·í°µ Picture1 ªº¾î½u°_©lÂI
For I = 0 To PicWidth - 1
For J = 0 To PicHeight - 1
SetPixel .hdc, J, I, _
GetPixel(Picture2.hdc, I, Abs(J - PicHeight) - 1)
Next
Next
.AutoRedraw = False
'§ó·sø¹Ï°Ï
.Refresh
.Visible = True
Picture2.Picture = .Image
'ªÀ±N¹Ï°Ï¼e°ª«×Àx¦s¥H³Æ¤U¦¸§Q¥Î
PicWidth = Picture1.ScaleWidth
PicHeight = Picture1.ScaleHeight
ReDraw = False
End With
End Sub
'°f®É°w 90 ¶s
Private Sub Command4_Click()
Dim I As Integer, J As Integer
With Picture1
.Width = ScaleX(PicHeight, vbPixels, Me.ScaleMode) + TransX
.Height = ScaleY(PicWidth, vbPixels, Me.ScaleMode) + TransY
ReDraw = True
.Visible = False
.AutoRedraw = True
'ì²z¡G§â Picture2 ¶}©lÁa½u·í°µ Picture1 ªºµ²§ô¾î½u
For I = 0 To PicWidth - 1
For J = 0 To PicHeight - 1
SetPixel .hdc, J, Abs(I - PicWidth) - 1, _
GetPixel(Picture2.hdc, I, J)
Next
Next
.AutoRedraw = False
.Visible = True
.Refresh
Picture2.Picture = .Image
PicWidth = Picture1.ScaleWidth
PicHeight = Picture1.ScaleHeight
ReDraw = False
End With
End Sub
Private Sub Form_Load()
Command1.Caption = "¤ô¥Â½Âà"
Command2.Caption = "««ª½Â½Âà"
Command3.Caption = "¶¶®É°w 90"
Command4.Caption = "°f®É°w 90"
With Picture2
'¨Ï Picture2 ¾AÀ³¹ÏÀɤj¤p
.AutoSize = True
.Picture = LoadPicture("c:\temp\1.1.jpg")
'¨Ï Picture1 »P Picture2 ¦P¤j¤p
Picture1.Width = .Width
Picture1.Height = .Height
'³æ¯Â¬°¹Ï¯À·|¥[§Ö´yÂIø¹Ï
.ScaleMode = 3
'Àx¦s Picture ¼e°ª«×
PicWidth = .ScaleWidth
PicHeight = .ScaleHeight
.Visible = False
'¥´¶} AutoRedraw ¤~¯à¨ú±o Visible = False ªº¹ÏÂI
.AutoRedraw = True
End With
With Picture1
'Àx¦sÃä¬É Twip È¥H¨Ñ½Õ¾ã¹Ï§Î¤j¤p¤§¥Î
TransX = .Width - .ScaleWidth
TransY = .Height - .ScaleHeight
.ScaleMode = 3
End With
End Sub
Private Sub Picture1_Paint()
'¦pªG¤£¬O¦b±ÛÂà«Ã¸°Ê§@¤¤«h«Ã¸¹Ï«¬
If Not ReDraw Then
With Picture1
.PaintPicture Picture2.Image, 0, 0, PicWidth, PicHeight, _
0, 0, PicWidth, PicHeight
End With
End If
End Sub
±H¥óªÌ: jessy
- §Úªº FORM ªº Midchild ÄÝ©Ê= True¡A ¦pªG³] BorderStyle = 1 ( or 3 ) «h©Ò³]pªºµe±¥i¥HÅã²{¥X¨Ó¡A¦ý¬ORuntime ®ÉµLªk¦A½Õ¾ãµe±¤j¤p¡C
- ¦Ó BorderStyle = 2 , Runtime ®É©Ò³]pªºµe±µLªk§¹¥þÅã¥Ü¥X¨Ó,¦ý¥i¥H½Õ¾ã¤j¤p¡C
- ,¦p¦ó±N©Ò³]pªºµe±¯à§¹¥þÅã¥Ü¥X¨Ó¦Ó¥BÁÙ¥i½Õ¾ã¤j¤p ¡C
¦Ñ©Çµª¡G
±M®×Äݩʤ¤³] MDIForm ±Ò°Ê¡A¨Ã§â¤U¦C½X¶K MDIForm §Y¥i¡C
Private Sub MDIForm_Load()
With Me
.Show
Load Form1
Form1.Move 0, 0, .ScaleWidth, .ScaleHeight
Form1.Show
End With
End Sub
XXX ¼¶¼g©ó¤å³¹
½Ð°Ýn¦p¦ó¥Î¤@Ó«ü¥OÃö³¬µ{¦¡¤¤©Ò¦³ªº Form ?
¦Ñ©Çµª¡G
±H¥óªÌ: Jeff Chen
§Ú·Q³]p¤@µ{¦¡¥Î¥Hpºâ¤½¤åªº¿ì²z®É¶¡,³W©w¬O³Ì³t¥ó¤@¤Ñ,³t¥ó¤T¤Ñ,´¶³q¥ó¤C¤Ñ,¦ý¬O»Ý¸ó¹L°²¤é(°ê©w°²¤é¤Î¶g¥ð¤G¤é) ½Ð°Ýn¦p¦ópºâ¥X,À³¸Ó¿ì§¹ªº¤é´Á.
¦Ñ©Çµª¡G
Option Explicit
'§ä¬Y¤@Ó¶g¤»¤é´Á°µ¬°±Àºâ¶g¥ð¤G¤éªº°ò·Ç¤é´Á
Private Const ¶g¤»°ò·Ç¤é As Date = #1/3/98#
'¦pªG°ò·Ç¤é´Á¬O¥ð°²ªº«h¦¹±`¼Æ¬° 0 ¡A§_«hÀ³§ï¬° 1¡C
Private Const ¶g¥ð¤G¤é As Byte = 0
'©ñ©Ò¦³°ê©w°²¤éªº¤é´Á°}¦C
Dim °²¤é°}¦C() As Date
'¥»¨ç¼Æ¬O¥Î¨Ó¬d®Ö¬Y¤é´Á¬O§_¬°©ñ°²¤é¡A¨ä·Ç«h¦³¤T¡G
'¬P´Á¤é«h¥»¨ç¼Æµ¥©ó True
'¶g¥ð¤G¤éªº¬P´Á¤»«h¥»¨ç¼Æµ¥©ó True
'¯S©w¨Ò°²¤é«h¥»¨ç¼Æµ¥©ó True
Private Function °²¤é¬d®Ö(ByVal CheckDay As Date) As Boolean
Dim I As Integer
Dim ¬O§_°²¤é As Boolean
'¦pªG¬P´Á¤é«h¥»¨ç¼Æµ¥©ó True
If WeekDay(CheckDay) = vbSunday Then
¬O§_°²¤é = True
'¦pªG«D¬P´Á¤é
Else
'¦pªG¬P´Á¤»
If WeekDay(CheckDay) = vbSaturday Then
'¯S©w¤é´Á´î¥h°ò·Ç¤é´Á°£¥H¤C¡A¬Oªí¥Ü¶ZÂ÷°ò·Ç¤é´Áªº²Ä´X¶g¡C
'±N²Ä´X¶g¼Æ¥Ø¨ú 2 ªº¾l¼Æ´N¥i¥H§PÂ_¶g¥ð¤G¤éªº½ü´À¡C
If Int((CheckDay - ¶g¤»°ò·Ç¤é) / 7) Mod 2 = ¶g¥ð¤G¤é Then
¬O§_°²¤é = True
End If
End If
'³Ì«á¬O§â©Ò¦³«D¶g¥ð¤G¤éªº¬P´Á¤»¤Î¨ä¥L¤é´Á¡A¨Ì§Ú̦b
'[¨ä¥L¨Ò°²¤é] Sub ¤¤©ñ¤Jªº°²¤é°}¦C¨Ó§PÂ_¬O§_°ê©w°²¤é¡C
If Not ¬O§_°²¤é Then
For I = 0 To UBound(°²¤é°}¦C)
If CheckDay = °²¤é°}¦C(I) Then
¬O§_°²¤é = True
Exit For
End If
Next
End If
End If
°²¤é¬d®Ö = ¬O§_°²¤é
End Function
Private Sub ¨ä¥L¨Ò°²¤é()
ReDim °²¤é°}¦C(2)
'±N°ê©w°²¤é¥H¦CÁ|¤è¦¡¤@¤@©ñ¤J°}¦C¤¤¡A½Ð¦Û¦æ¸É¨¬¤£¨¬¶µ¥Ø
°²¤é°}¦C(0) = DateSerial(Year(Date), 3, 29) '«C¦~¸`
°²¤é°}¦C(1) = DateSerial(Year(Date), 10, 10) '°ê¼y¤é
°²¤é°}¦C(2) = DateSerial(Year(Date), 12, 25) '¦æ¾Ë¬ö©À¤é
End Sub
Private Sub Form_Click()
Dim CalcDay As Date
'ÀH«K¿ï¤@¤é´ú¸Õ
CalcDay = #11/20/98#
CalcDay = µ²®×¤é(CalcDay, 7)
Debug.Print CalcDay
End Sub
Private Sub Form_Load()
'°õ¦æ©ñ¤J°²¤é¦Ûqµ{§Ç
¨ä¥L¨Ò°²¤é
End Sub
Private Function µ²®×¤é(ByVal ¦¬¥ó¤é As Date, _
ByVal ¿ì²z¤é¼Æ As Integer) As Date
Dim RetrunDay As Date
'I ¬O°²¤é¬d®Ö«ü¼Ð¡AJ ¬O¹ê»Ú¤u§@¤Ñ¼Æ²Öp¡C
Dim I As Integer, J As Integer
If ¿ì²z¤é¼Æ < 1 Then
MsgBox "¿ì²z¤é¼Æ³Ì¤Ö¬°¤@¤Ñ"
Exit Function
End If
Do While J < ¿ì²z¤é¼Æ
I = I + 1
If Not °²¤é¬d®Ö(¦¬¥ó¤é + I) Then
J = J + 1
µ²®×¤é = (¦¬¥ó¤é + I)
End If
Loop
End Function
VERSION 5.00
Begin VB.Form Form1
Caption
= "Form1"
ClientHeight = 3195
ClientLeft =
60
ClientTop =
345
ClientWidth =
3840
LinkTopic =
"Form1"
ScaleHeight =
3195
ScaleWidth =
3840
StartUpPosition = 3 '¨t²Î¹w³]È
Begin VB.CommandButton Command1
Caption
= "Command1"
Height
= 495
Left
= 2280
TabIndex
= 2
Top
= 2400
Width
= 1215
End
Begin VB.Frame Frame1
Caption
= "Frame1"
Height
= 1935
Left
= 240
TabIndex
= 1
Top
= 1080
Width
= 1575
Begin VB.TextBox Text1
Height
= 270
Index
= 2
Left
= 600
TabIndex
= 8
Text
= "Text1"
Top
= 1320
Width
= 615
End
Begin VB.TextBox Text1
Height
= 270
Index
= 1
Left
= 600
TabIndex
= 6
Text
= "Text1"
Top
= 840
Width
= 615
End
Begin VB.TextBox Text1
Height
= 270
Index
= 0
Left
= 600
TabIndex
= 4
Text
= "Text1"
Top
= 360
Width
= 615
End
Begin VB.Label Label2
Caption
= "Label2"
Height
= 255
Index
= 2
Left
= 240
TabIndex
= 7
Top
= 1320
Width
= 615
End
Begin VB.Label Label2
Caption
= "Label2"
Height
= 255
Index
= 1
Left
= 240
TabIndex
= 5
Top
= 840
Width
= 615
End
Begin VB.Label Label2
Caption
= "Label2"
Height
= 255
Index
= 0
Left
= 240
TabIndex
= 3
Top
= 360
Width
= 615
End
End
Begin VB.Timer Timer1
Left
= 3120
Top
= 360
End
Begin VB.Shape Shape1
Height
= 255
Left
= 2040
Shape
= 3 '¶ê§Î
Top
= 480
Width
= 255
End
Begin VB.Label Label1
Caption
= "Label1"
Height
= 495
Left
= 360
TabIndex
= 0
Top
= 360
Width
= 2055
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim SetTime As Date
Private Sub Command1_Click()
If Command1.Caption = "³]©w®É¶¡"
Then
Frame1.Visible = True
Command1.Caption =
"½T©w®É¶¡"
Else
Frame1.Visible = False
If Val(Text1(0).Text)
> 24 Then Text1(0).Text = 24
If Val(Text1(1).Text)
> 60 Then Text1(1).Text = 60
If Val(Text1(2).Text)
> 60 Then Text1(2).Text = 60
If Text1(0).Text =
"" Then Text1(0).Text = 0
If Text1(1).Text =
"" Then Text1(1).Text = 0
If Text1(2).Text =
"" Then Text1(2).Text = 0
SetTime = TimeSerial(Val(Text1(0).Text),
Val(Text1(1).Text), _
Val(Text1(2).Text))
Command1.Caption =
"³]©w®É¶¡"
Debug.Print SetTime
End If
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Label1.BackColor = RGB(125, 0, 255)
Label1.ForeColor = RGB(0, 255, 255)
Label1.FontSize = 24
Shape1.FillStyle = 0
Shape1.FillColor = RGB(0, 255, 0)
Frame1.Caption = "½Ð¿é¤J¤é´Á"
Frame1.Visible = False
Label2(0).Caption = "®É"
Label2(1).Caption = "¤À"
Label2(2).Caption = "’"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Command1.Caption = "³]©w®É¶¡"
ShowTime
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
'KeyAscii 32
¥H¤U¬O¤@¨Ç±±¨îÁä¡AÄdºI·|³y¦¨¾Þ§@»Ùê
If KeyAscii >= 33 Then
If KeyAscii <=
vbKey9 And KeyAscii >= vbKey0 Then
Else
'§â KeyAscii ³]¬° 0 ´N¬O¨ú®ø¿é¤J
KeyAscii = 0
MsgBox "¤£¥i¿é¤J«D¼Æ¦r¦r¤¸"
End If
End If
End Sub
Private Sub Timer1_Timer()
ShowTime
End Sub
Private Sub ShowTime()
Dim SubTime As Date
Shape1.FillColor = RGB(0, 255, 0)
SubTime = TimeSerial(Hour(Now), Minute(Now),
Second(Now))
Label1.Caption = SubTime
'¦b®É¶¡¨ì¹F«áªº¤»¬í¡A·|¦³´£¿ô¿O¸¹¤ÎÁnµ
If SubTime > SetTime And SubTime <
TimeSerial(Hour(SetTime), _
Minute(SetTime), Second(SetTime) + 6) Then
Shape1.FillColor = RGB(255,
0, 0)
Beep
End If
End Sub
¦w¦w ¼¶¼g©ó¤å³¹
§Ú¦pªG¶}±Ò¤@Ó¶W¹L1mb®e¶qªº¤å¦rÀÉ,³£·|ı±o«ÜºC!½Ö¥i¥H§Ú«ü¾É¤@¤U,¶}±ÒÀɮתº¤@¨Ç§Þ¥©©O?
¦Ñ©Çµª
XXX ¼¶¼g©ó¤å³¹
§Ú¦b¤@ÓForm¤¤Â\¤FÓ Frame¡A§Ú¦bForm Load®É ±N Frame Disable¡A§Ú·QÅý·Æ¹«¦bFrame¤WÂI¤@¤U,¤~Enable³QÂI¨ìªºFrame¡A¦]¬°Frame¥¼Enable«eµLªk±µ¨ü¥ô¦ó¨Æ¥ó¡An¦p¦ó¤~¯à°µ¨ì©O?
¦Ñ©Çµª¡G
ÁöµM Frame1.Visible=False «á¡AForm ¤WÁ٬ݱo¨ì Frame1 ²H¦Ç¦â¼v¹³¡A¦ý·í§ÚÌ MouseClick «á¡A¦¬¨ì Mouse Event ªº«o¬O Frame I«áªºª«¥ó¡A©Ò¥H¦pªG Frame1 «á±´N¬O Form ªº¸Ü¡A¥i¥H¨Ï¥Î Form ¨Ó±µ¦¬ Mouse Event ¡A¨Ã¨Ï Frame1.Enable=True¡G
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
With Frame1
If (X > .Left And X < .Left + .Width) And (Y > .Top And Y < .Top + .Height) Then
.Enabled = True
End If
End With
End Sub
ÂŦâ°{ÆF ¼¶¼g©ó¤å³¹
¦p¦ó¤~¯à§Q¥Î¤ô¥©M««ª½½Õ¸`¶s¨Ó±±¨î¹Ï¤ù¤è¶ô¸Ìªº¹Ï¤ù§r?
¦Ñ©Çµª¡G
¤ô¤û ¼¶¼g©ó¤å³¹
¦U¦ì«e½ú¤j®a¦n¡A¤p§Ì¼g¤F¤@¬qµ{¦¡¨Ó¶}±ÒÀɮסA¦b³o¤§«e·Q¥[¤J¤@¨Çµ{¦¡½X¨ÓÀˬdÀɮ׬O§_½T©w¦s¦b¡AÀ³¸Ó«ç»ò°µ¤ñ¸û¦n©O?
¦Ñ©Çµª¡G
Dim DirReturn As String
Dim DirSend As String
Dim MsgString As String
DirSend="YourFilePath&Name"
DirReturn = Dir(DirSend, vbHidden Or vbDirectory Or vbReadOnly Or vbSystem)
If DirReturn="" Then
MsgString="§ä¨S¦³°Õ"
Else
MsgString="§ä¨ì¤F " & DirReturn & " ÀÉ®×"
End If
MsgBox MsgString
Peter ¼¶¼g©ó¤å³¹
½Ð°Ý¤°»ò¬O¶°¦Xª«¥ó(Collection)¡Hn«ç»ò¨Ï¥Î¡H¤Î¨ä¨Ï¥Î®É¾÷¬°¦ó¡H
¦Ñ©Çµª¡G
¼È®É·Q¤£¨ì ¼¶¼g©ó¤å³¹
½Ð°ÝVB¦p¦ó¼g¤~¯à¹F¨ì®É¶¡¼È°±´X¬íªº¥\¯à¡H
¦Ñ©Çµª¡G
Dim Delay As Date
Me.MousePointer = 11
Delay = Now
Do While Second(Now - Delay) < 3
Loop
Me.MousePointer = 0
¼È°±¤T¬íÄÁ
ÛÛ ¼¶¼g©ó¤å³¹
¦b¨Ï¥Î¼Ò²Õ®É...¦pªG»Ýn¥Î¨ì form1 ªº±±¨î¶µ...¥²¶·¼g¦¨ form1.XXX ¡A¦³¨S¦³¿ìªk§ï¬Y¨Ç³]©w...¥i¥H¤£¥Î¥[ form1.¡C
¦Ñ©Çµª¡G