VB5 ªì¯Å¥Í ¦Ñ©Ç½d¨Ò(¤G)

¦^­º­¶


¤ÀÃþ

¼ÐÃD

¤j·N

§@ªÌ

¤é´Á

¤¸¥ó¥Îªk ComboBox ªº¨Ï¥Î§Þ¥© ¡@ ¦Ñ©Ç 1998/5/26
¤¸¥ó¥Îªk ActiveX ¥\¯àªí½s¿è¾¹ªº¨Ï¥Î ¡@ ¦Ñ©Ç 1998/6/4
¤¸¥ó¥Îªk CommonDialog ªº Cancel ³qª¾ ¥H Err.Number ¨ú¥N Event ¦Ñ©Ç 1998/7/12
ª«¥ó¨Ï¥Î TextBox ªº½Æ»s¤Î¶K¤W ClipBoard ªº¨Ï¥Î ¦Ñ©Ç 1998/5/30
ª«¥ó¨Ï¥Î ¨ú±o¬Y¹q¸£ªº©Ò¦³¦r«¬ Screen ©M Printerªº¨Ï¥Î ¦Ñ©Ç 1998/6/5
¶°¦Xª«¥ó Form.Controls ªº¨Ï¥Î ¡@ ¦Ñ©Ç 1998/5/28
¤¤¤å³B²z ¦p¦ó§P§O¤@­Ó¦r¤¸¬°¤¤¤å¦r ¡@ ¦Ñ©Ç 1998/5/28
¤¤¤å³B²z TextBox ªº¤¤­^¿é¤J¤Á´«¥\¯à IMEMode Äݩʪº§Q¥Î ¦Ñ©Ç 1998/6/7
¦r¦ê³B²z VB Script SPLIT() ¨ç¼Æ¼ÒÀÀ Vb ¦r¦ê¨ç¼ÆªºÁa¦X¹B¥Î ¦Ñ©Ç 1998/6/5
¦r¦ê³B²z ¤å¦rÀɪº¦r¦ê´À´« ¡@ ¦Ñ©Ç 1998/6/9
¦r¦ê³B²z ­ç°£¦r¦ê¤¤ªº«ü©w¦r¤¸ Mid() ¨ç¼Æªº¹B¥Î ¦Ñ©Ç 1998/6/16
¦r¦ê³B²z ¦p¦ó°µ¥X¶]°¨¿O®ÄªGªº TextBox ¡@ ¦Ñ©Ç 1998/6/14
ÅܼƳB²z ÅܼưO¾ÐÅéªÅ¶¡ªºÄÀ©ñ ¡@ ¦Ñ©Ç 1998/5/29
°Æµ{¦¡ ¸ó Form ªº Procedure ©I¥s ¡@ ¦Ñ©Ç 1998/7/2
¼Æ­È³B²z ¤£¦P¶i¦ì¼ÆªºÂà´« Hex() & Oct() ¦Ñ©Ç 1998/5/31
¤é´Á³B²z ¨D±o¨C¤ëªº³Ì«á¤@¤Ñ¬O´X¸¹ DateSerial() ªº¹B¥Î Rose 1998/6/10
¨ä¥LÂø¶µ ¥~³¡Àɮתº°õ¦æ¤Î²×¤î Shell ©M AppActivate¨Ï¥Î ¦Ñ©Ç 1998/6/16
¤¸¥ó¥~Æ[ Drag ®ÉÅã¥Ü Picture Drag ©M DragMode ¦Ñ©Ç 1998/6/18
¤¸¥ó¥~Æ[ Drag ©M Move ªº¤ñ¸û ¥Ñ¨Ï¥ÎªÌ¾Þ±±¤¸¥ó²¾°Ê ¦Ñ©Ç 1998/6/18
¹Ï§Î³B²z VB 5.0 ¥i¥H¨Ï¥Îªº¹ÏÀɮ榡 ¡@ ¦Ñ©Ç 1998/7/20
¹Ï§Î³B²z ¦p¦ó¦Û»s MetaFile VB »P Office 97 ¦Ñ©Ç 1998/7/20

VB5 ªì¯Å¥Í½d¨Ò¨Ï¥Î»¡©ú


  1. ¥»½d¨ÒÅwªï«DÀç§Q©Ê­Ó¤H¤Î²Õ´Âà¸ü¨Ï¥Î¡AÀç§Q¤§§Q¥Î½Ð¥ý¼x±o¥»¤H¤§¦P·N¡A¨Ó«Hµù©ú¨Ï¥Î¤è¦¡¤Î¦^ÂЦa§}¡C
  2. ¥»½d¨Ò©Ò¦³ªºµ{¦¡½X½d¨Ò¡A¬ÒÄݤQ¤À°ò¥»ªº VB »yªk¡A¦pªG±z¬O­Ó VB User ¡AÅwªïª½±µ¤Þ¥Î©Î§ï¼g¨Ï¥Î¦b§Aªºµ{¦¡¤¤ ¡A¥»¤H¤£¥D±iµÛ§@Åv¡A¦]¬°¡A¨S¿ìªk¬d¹À¡C
  3. ¦pªG§A¬O­Ó VB ªì¾ÇªÌ¡A¤S¦³ÂI½a½a(©M¦Ñ©Ç¤@¼Ë)¡A»°§Ö§â¥»­¶¥t¦s·sÀɨì§A¦Û¤vªººÏºÐ¡AÂ÷½u«áºCºC¬Ý¡A¤]¥i¥H Copy µ¹ªB¤Í³á(¤£¥i¥H¦¬¿ú)¡C
  4. ¥»½d¨Ò³£¬O¦Ñ©Ç´X­Ó¤ë¨Ó¦b tw.bbs.comp.language °Q½×¸s²Õ¤¤¦^µªª©¤Í°ÝÃDªº¦X¿è¡A¦]¬°¬O°w¹ï°ÝÃD¸Ñ¨M¡A©Ò¦³¨Ã¨S¦³¥þ­±Æ[©Àªº¸Ñ»¡¡A¤£¾A¦X§@¬°¤Jªù¤å³¹¡A¦ý¦pªG§AŪ¤F¤Jªù®Ñ¡A©Î¬O¤W¤F¦Ñ®vªº½Ò¡A¤ß¤¤¤´¤£¬Æ©ú¥Õªº¸Ü¡A´N¥i¥H¨Ó³o§ä§ä¦³¨S¦³§A­nªºµª®×¡A¦]¬°³o³£¬O§O¤H°Ý¹Lªº°ÝÃD¡C

¦^¯Á¤Þ


ComboBox ªº¨Ï¥Î§Þ¥©


iroi ¼¶¼g©ó¤å³¹

½Ð°Ý¦U¦ì,vbªºcombo box«ç¥Îªº

¦Ñ©Çµª¡G

¦b°µ Comboboxªº§PÂ_®É¡A¦³´X­Ó­nª`·N°t¦X¨Ï¥ÎªºÄݩʬO

  1. List
  2. text
  3. listindex
  4. newindex
  5. listcount

¨ú¥X ComboBox ùتº­È

'------¨ú¥X¥H·Æ¹«ÂI¿ï­È

'-----¨ú¥X·s¥[¤Jªº­È

'---- ±N²Õ¦X¦¡¤å¦r®Ø¥[¤J Combo1

¦^¯Á¤Þ


Form.Controls ªº¨Ï¥Î


Eagle Tsui ¼¶¼g©ó¤å³¹

½Ð°Ý¥Îvb5¦p¦ó¥i¥H¦b¥þ¤£ª¾±¡¤Uª¾¹DForm1¦³ÃäÉAControl§r!

¦Ñ©Çµª¡G

­pºâ form ¤W¦³´X­Ó Control

¦C¥X form ¤W©Ò¦³ control ªº¦WºÙ

¦^¯Á¤Þ


¦p¦ó§P§O¤@­Ó¦r¤¸¬°¤¤¤å¦r


html ¼¶¼g©ó¤å³¹

¦Ñ©Çµª¡G

Strlength=LenB(StrConv("YourChar", vbFromUnicode))
Strlength=1 ­^¤å
Strlength=2 ¤¤¤å

¦^¯Á¤Þ


ÅܼưO¾ÐÅéªÅ¶¡ªºÄÀ©ñ


±H¥óªÌ: Annie Chiu

¦ó²M°£°O¾ÐÅéÅܼÆ?

¦Ñ©Çµª¡G

  1. °}¦CÅܼƪºÄÀ©ñ¡G

  2. «Å§i°Ïùبp¦³Åܼƪº¥Í©R´Á¡G

  3. ª«¥óÅܼƪº°O¾ÐÅéªÅ¶¡ÄÀ©ñ¡G

  4. °ÊºA±±¨î¤¸¥óªº·s¼W»PÄÀ©ñ¡G

  5. ©Ò¦³ªº±±¨î¤¸¥ó¤Î Form ª«¥ó¡A§Ú­Ì³£¥i¥H§â¥Lµø¬° Public ÅܼơA¬J¸g²£¥Í¡A¦b¥ô¦ó Procedure ³£¯à©I¥sªº¨ì¡C

¦^¯Á¤Þ


TextBox ªº½Æ»s¤Î¶K¤W


­· ¼¶¼g©ó¤å³¹

½Ð°Ý¹³°O¨Æ¥»¤¤ªº½Æ»s¡B°Å¤U¡B¶K¤W¡ATextBox ­n¦p¦ó¼g¡H

¦Ñ©Çµª¡G

  1. ½Æ»s¡G
  2. °Å¤U¡G
  3. ¶K¤W¡G
  4. ¥þ¿ï¡G

¦^¯Á¤Þ


¤£¦P¶i¦ì¼ÆªºÂà´«


§¥¤H ¼¶¼g©ó¤å³¹

vb­n¦p¦ó±N¤Q¶iÅÜ...¤G¶i...¤K¶i....¤Q¤»¶iµ¥

¦Ñ©Çµª¡G

  1. ¤Q¶i¦ì¼ÆÂন¨ä¥L¶i¦ì¼Æ
  2. ¬°Åܼƫü©w¨ä¥L¶i¦ì­È¡G
  3. ±N¨ä¥L¶i¦ì¦r¦êÅܼƺâ¦^¤Q¶i¦ì¡G
  4. ¤G¶i¦ìªºÂà´«¥\¯à¡G

¦^¯Á¤Þ


¸ó Form ªº Procedure ©I¥s


johneson ¼¶¼g©ó¤å³¹

½Ð°Ý¦bvb Àô¹Ò¤U¦p¦ó¤@µøµ¡¦p¦ó¥h°õ¦æ¥t¤@µøµ¡©Ò¼gªºµ{¦¡½X

¦Ñ©Çµª¡G

  1. ¤@­Ó¹w³Æ¦b¬Y Form ¤W³Q§Oªº Form ©I¥sªº Sub ©Î Function ¥²¶·­n«Å§i¬° Public¡C
  2. Call ¥t¤@­Ó Form ªº Public Sub or Public Function ®É¥²¶·¦b«e­±¥[¸Ó Form ªº¦WºÙ¡A¦p BeCallForm.SubName or BeCallForm.Function Name¡C
  3. ¤@­Ó±±¨î¤¸¥óªº¨Æ¥ó«Å§i³£¦b¨ä©ÒÄݪº Form ¤W³Q«Å§i¬° Private ¡A¦p Private Image1_Click()¡A¦ý¦pªG§Ú­Ì§â¨ä Private §ï¬° Public «á¡A¤@¼Ë¥i¥H¥Î 2. ¤è¦¡¥hIJµo¸Ó¤@¨Æ¥ó¡A¤]´N¬O¥i¥H¦b§Oªºµøµ¡ùØIJµo¥t¤@­Óµøµ¡ªº¤¸¥ó¨Æ¥ó¡C

¦^¯Á¤Þ


ActiveX ¥\¯àªí½s¿è¾¹ªº¨Ï¥Î


¬y®öªº­· ¼¶¼g©ó¤å³¹

¦bVB5¤¤ªºActiveX±±¨î¶µ,¯à¤£¯à¥Î¥\¯àªí½s¿è¾¹°Ú???¦³­Ó«Ü©_©Çªº²{¶H...¦bªí³æªº§ÖÅã¥\¯àªí¤¤¦³¥\¯àªí½s¿è¾¹...¶i¥h¤§«á,¥i¥H³]©w³á...¤£¹LÃä¦n«á,¦bªí³æ¤¤¬Ý¤£¨£¥\¯àªí£z£°......¦³½Öª¾¹D­ì¦]....

¦Ñ©Çµª¡G

  1. ActiveX ¥i¥H¨Ï¥Î¥\¯àªí½s¿è¾¹¡A¦ý¥Îªk¸ò Form ©M MDIForm ¦³¨Ç®t§O¡C
  2. Form ©M MDIForm ªº¥\¯àªí¯à¦bªí³æ¤WÅã²{¡A¤]¯à¥Î PopUpMenu ªº¤èªkÅý¥¦¼u¥X¨Ó¡AActiveX±±¨î¶µªº¥\¯àªíµLªk¦b¦Û¤vªºªí³æ¤WÅã¥Ü¡A¦ý¥i¥H¥Î PopUpMenu ªº¤èªk¼u¥X¨Ó¡C
  3. ActiveX±±¨î¶µ¥\¯àªíªº¿ï¶µ¡A¦b[¨ó½Õ¦ì¸m]ªº¿ï¶µ¤W¦pªG§ïÅܭ줣Åã¥Üªº³]©w¡A¦Ó§ï³]¾a¥ª¡B¾a¤¤¡B¾a¥k¡A¨º³o¿ï¶µ¦b°õ¦æ´Á¤¤´N·|Åã²{¦b¦¬¯Ç¥¦ªºªí³æ¤W¡C

¦^¯Á¤Þ


¨ú±o¬Y¹q¸£ªº©Ò¦³¦r«¬


­· ¼¶¼g©ó¤å³¹

¦p¦ó¥ÎVB¨Ó¨ú±o¹q¸£¸Ìªº¦r«¬¨Ã¥B¥Î¤U©Ô¦¡¿ï³æ¨q¥X¨Ó...

¦Ñ©Çµª¡G

  1. ¨ú±o¿Ã¹õ¦r«¬¡G
  2. ¨ú±o¦Lªí¾÷¦r«¬¡G

¦^¯Á¤Þ


VB Script SPLIT() ¨ç¼Æ¼ÒÀÀ


misckl ¼¶¼g©ó¤å³¹

¦bVB Script¤¤¦³¤@­Ó SPLIT() ªº Function ¥i¥H±N¦r¦êÂন¦r¦ê°}¦C¡A¦Ó¦bVB5¤¤«o¨S¦³¡C¦bVB5¤¤¬O§_¦³Ãþ¦üªºFunction¡H©Î¬O­þ¸Ì¦³³o­Ó Function?

¦Ñ©Ç¸Õ§@¡G

VB5 ùبèS¦³©M VBScript ¬Û¦Pªº SPLIT() ¨ç¼Æ¡A¦ý³z¹L VB5 ¦r¦êÅܼƪºÁa¦X¹B¥Î¡A§Ú­Ì¥i¥H¦Û³Ð¨ã¦³ SPLIT() ¥\¯àªº¨ç¼Æ¡C

Function Split(ByVal Exp As String, _
        Optional ByVal Deli As String = " ", _
        Optional ByVal varCount As Long = -1, _
        Optional ByVal Comp As Integer = 0)

Dim ReturnArr() As String, ReturnNum As Long
Dim ShortWord As String, WordNum As Variant

    If varCount = 0 Or Len(Exp) = 0 Then
        SimuSplit = ReturnArr
        Exit Function
    End If

    Do
        WordNum = InStr(1, Exp, Deli, Comp)
        If WordNum = 0 Then
            ShortWord = Exp
        Else
            ShortWord = Mid(Exp, 1, WordNum - 1)
            Exp = Right(Exp, Len(Exp) - WordNum)
        End If

        On Error Resume Next
        ReDim Preserve ReturnArr(UBound(ReturnArr) + 1)
        If Err.Number = 9 Then
            ReDim ReturnArr(0)
        End If

        ReturnArr(UBound(ReturnArr)) = ShortWord

        If WordNum = 0 Then Exit Do

    Loop

    If varCount <> -1 And varCount <= UBound(ReturnArr) Then
        ReDim Preserve ReturnArr(varCount - 1)
    End If

    SimuSplit = ReturnArr
End Function

¦^¯Á¤Þ


CommonDialog ªº Cancel ³qª¾


¥£Áõ ¼¶¼g©ó¤å³¹

CommonDialog¨ä¤¤ªº ¶}±ÒÂÂÀɪºµøµ¡¤¤¡A¿ï¨ú "¨ú®ø"  ©Ò·|¤Þµo¤§¨Æ¥ó¬°¦ó¡H

¦Ñ©Çµª¡G

¦pªG§A´¿¥J²Ó¦b VB5 ªº[ÂsÄýª«¥ó]¥\¯àùØ¥J²ÓÆ[¹î¹L CommonDialog ³o­Ó¤¸¥ó¡A§A·|µoı CommonDialog ¨S¦³³]©w¥ô¦óªº¨Æ¥óµ{§Ç¡A¨º§Ú­Ì¸Ó¦p¦ó±oª¾¥¦°õ¦æªºª¬ªp©O¡Hµª®×´N¦b¥¦ªº ErrorConstants ±`¼Æ«Å§iùØ¡C¤]´N¬O CommonDialog §â¥¿½T°õ¦æªº°Ê§@µ²ªG©ñ¦b¦U Property ­ÈùØ¡A¿ù»~«h²£¥Í¤@­Ó Error ¨Ó³qª¾§A¡C¦¹¥~ Cancel ¦b CommonDialog ùعw³]­È¤£¬O¿ù»~¡A¦ý¦pªG§A­nÄdºI¨ì Cancel °T®§¡A¥u¦³³W©w«ö¤U Cancel µø¦P²£¥Í¤@­Ó¿ù»~¡C¤]´N¬O¥²»Ý¥ý³]©w CommonDialog1.CancelError=Ture «á¡A¦A¥Î Err.Number ¨Ó°»´ú Cancel ªº¦æ¬°¡C½Ð°Ñ¦Ò¤U¨Ò¡C

Option Explicit

Private Sub Command1_Click()
    On Error Resume Next
    CommonDialog1.ShowOpen
    If Err.Number = cdlCancel Then
        MsgBox "FileOpen Cancel"
    End If
End Sub

Private Sub Form_Load()
    CommonDialog1.CancelError = True
End Sub

¦^¯Á¤Þ


TextBox ªº¤¤­^¿é¤J¤Á´«¥\¯à


Neuro Doc ¼¶¼g©ó¤å³¹

¦b VB 5.0 ¤U, ¦p¦ó¥Îµ{¦¡¤Á´«ª`­µ¤Î­^¤å¿é¤J?

¦Ñ©Çµª¡G

Vb 5.0 ¦b ¥i¥H¿é¤J¤å¦rªº Box (¦p TextBox,ListBox,ComBox....µ¥)ùØ¥[¤F¤@­Ó¿é¤Jªk¤Á´«ªºÄÝ©Ê¡A´N¬O IMEMode¡A¥i¬O¥¦¦Û¤v»¡©úùسºµM°¦¦r¥¼´£¡A¤£¹L¸g¦Ñ©Ç´ú¸Õ¡A¯uªº¦³§@¥Î¡C°t¦X¤W ImeStatus ³o­Ó¨ç¼ÆÀË´ú¥Ø«eªº¿é¤Jª¬ºA¡A¦b§A¿é¤J¤å¦r®É¡A´N¥i¥H¾Þ±±¨Ï¥ÎªÌªº¿é¤Jª¬ºA¡C

¦^¯Á¤Þ


¤å¦rÀɪº¦r¦ê´À´«


James Wu ¼¶¼g©ó¤å³¹

±ý§â¤å¦rÀÉ(filename.txt)¤¤¬Y¤@¦r¦ê(beforchange)§ï¬°(afterchange),¦p¦ó¼g? 

¦Ñ©Çµª¡G

½Ð°Ñ¦Ò¤U¦C½d¨Òµ{¦¡¡G

VERSION 5.00
Begin VB.Form Form1
   Caption         =   "Form1"
   ClientHeight    =   3885
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3885
   ScaleWidth      =   4680
   StartUpPosition =   3  '¨t²Î¹w³]­È
   Begin VB.TextBox Text3
      Height          =   495
      Left            =   3240
      TabIndex        =   5
      Top             =   1680
      Width           =   1215
   End
   Begin VB.TextBox Text2
      Height          =   495
      Left            =   3240
      TabIndex        =   4
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton Command3
      Caption         =   "¦sÀÉ"
      Height          =   495
      Left            =   3360
      TabIndex        =   3
      Top             =   3240
      Width           =   1215
   End
   Begin VB.CommandButton Command2
      Caption         =   "¨ú¥N"
      Height          =   495
      Left            =   1800
      TabIndex        =   2
      Top             =   3240
      Width           =   1335
   End
   Begin VB.CommandButton Command1
      Caption         =   "¶}ÀÉ"
      Height          =   495
      Left            =   240
      TabIndex        =   1
      Top             =   3240
      Width           =   1335
   End
   Begin VB.TextBox Text1
      Height          =   2895
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   2  '««ª½±²¶b
      TabIndex        =   0
      Top             =   120
      Width           =   2895
   End
   Begin VB.Label Label2
      Caption         =   "¨ú¥N¦r¦ê"
      Height          =   375
      Left            =   3240
      TabIndex        =   7
      Top             =   1200
      Width           =   1215
   End
   Begin VB.Label Label1
      Caption         =   "·j´M¦r¦ê"
      Height          =   375
      Left            =   3240
      TabIndex        =   6
      Top             =   120
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'TextSearch ¬°¦Û¦æÃä¼g¤§ Sub Procedure
'varObject ¬O¶Ç¤Jªº Textbox ª«¥ó
'OrgString ¬O´M§ä¦r¦ê
'RepString ¬O¨ú¥N¦r¦ê
Sub TextSearch(ByVal varObject As Control, _
        ByVal OrgString As String, _
        ByVal RepString As String)

Static varStart As Long    '«Å§i Static «¬ºA¡A¥Nªí¥¦¯à°O¦í¤W¦¸ªº·j´M¦ì¸m
Dim SeString As String
Dim NowPos As Long
    'ª«¥ó±µ¦¬¾nÂI
    varObject.SetFocus
    '§â¤W¦¸¥¼·j´M¨ìªº¦r¦ê©ñ¤J SeString ÅܼƤ¤
    SeString = Right(varObject.Text, Len(varObject.Text) - varStart)
    '§ä·sªº²Å¦X¦r¦ê
    NowPos = InStr(SeString, OrgString)

    '¨S§ä¨ì
    If NowPos = 0 Then
        '°O¿ý«ü¼ÐÂk 0
        varStart = 0
        '³]©wµL¿ï¨ú
        varObject.SelLength = 0
    '§ä¨ì¤F
    Else
        '°O¿ý«ü¼Ð²¾¨ì·s¦ì¸m
        varStart = varStart + NowPos - 1
        '±q°O¿ý«ü¼Ð¦ì¸m¶}©l¿ï¨ú
        varObject.SelStart = varStart
        '¿ï¨ú·j´M¦r¦êªø«×
        varObject.SelLength = Len(OrgString)
        '·j´M¦r¦ê´«¦¨·s¦r¦ê
        varObject.SelText = RepString
        '°O¿ý«ü¼Ð²¾©¹¨ú¥N¦r¦ê¤§«á
        varStart = varStart + Len(RepString)
    End If
End Sub

'¶}±Ò¬J¦s¤å¦rÀÉ
Private Sub Command1_Click()
Dim OpenString As String
Dim FHandle As Long

    '§ä¤@­Ó¥¼¨Ï¥ÎªºÀÉ®×¥N½X
    FHandle = FreeFile()
    '®ø°£ Textbox ùتº­ì¤å¦r
    Text1.Text = ""
    '¶}±Ò¤@¿é¤JÀÉ
    Open "c:\ttt.txt" For Input As #FHandle

    '§âÀÉ®×¥[¨ì Text1.Text ¤¤
    Do While Not EOF(FHandle)
        Line Input #FHandle, OpenString
        Text1.Text = Text1.Text + OpenString + Chr(13) + Chr(10)
    Loop
    Close #FHandle

End Sub

'©I¥s TextSearch °Æµ{§Ç
Private Sub Command2_Click()
    TextSearch Text1, Text2.Text, Text3.Text
End Sub

'±N Text1.Text ¦s¦¨ÀÉ®×
Private Sub Command3_Click()
Dim FHandle As Long

    FHandle = FreeFile()

    Open "c:\ttt.txt" For Output As #FHandle

    Print #FHandle, Text1.Text
    Close #FHandle
End Sub

¦^¯Á¤Þ


¨D±o¨C¤ëªº³Ì«á¤@¤Ñ¬O´X¸¹


Rose ¼¶¼g©ó¤å³¹

Day(DateSerial(¦~¤À,(¤ë¥÷+1),0))

¦Ñ©Ç¸Ñ»¡¡G

  1. DateSerial() ùئ³ Year,Month,Day¤T­Ó¼Æ­È°Ñ¼Æ¡A¼gªk¬O DateSerial(Year,Month,Day)¡C
  2. day=0 ªí¥Ü¬O¤W­Ó¤ëªº³Ì«á¤@¤Ñ¡C
  3. ¤ë¥÷+1ªí¥Ü¤U­Ó¤ë¡C
  4. ¦A¨Ï day=0 ´N¨D±o¥»¤ë³Ì«á¤@¤Ñ¡C
  5. ³o­Ó±Ô­z¤Sµu¤S¦n¡A¥i¨£ Rose ¬O­Ó°ª¤â¡C¦ý§Ú¦bª©¤W¥uÅåÂE¤@¿h¬Ý¦o Post ¹L¤@¦¸¡A±q¦¹¦AµLªÚÂÜ¡A¤j·§¯u¥¿¼F®`ªº¤H²{¦b³£¤w¦b¸ê°T¬É¨­­t­«Â¾¡A¥u¦³¦Ñ©Ç³oºØ¥b½Õ¤l¡A¤~¦³ªÅ¦b News Group ùؤf¤ô¤@°ï¡A¦]¬°³o­Ó¦¡¤l¹ê¦b¤Ó¦n¤F§Ô¤£¦í­n¦V¤j®a±ÀÂË¡A§Æ±æ Rose ¤£­n»{¬°§Ú«I¥ÇµÛ§@Åv¤~¦n¡C

¦^¯Á¤Þ


¦p¦ó°µ¥X¶]°¨¿O®ÄªGªº TextBox


¦Ñ©Ç¸Õ§@¡G

VERSION 5.00
Begin VB.Form Form1
   Caption         =   "Marquee"
   ClientHeight    =   3960
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3960
   ScaleWidth      =   4680
   StartUpPosition =   3  '¨t²Î¹w³]­È
   Begin VB.CommandButton Command2
      Cancel          =   -1  'True
      Caption         =   "¶]°¨¿Oµ²§ô"
      Height          =   495
      Left            =   2640
      TabIndex        =   5
      Top             =   3360
      Width           =   1215
   End
   Begin VB.Timer Timer1
      Left            =   2160
      Top             =   3480
   End
   Begin VB.CommandButton Command1
      Caption         =   "¶]°¨¿O¶}©l"
      Height          =   495
      Left            =   840
      TabIndex        =   2
      Top             =   3360
      Width           =   1215
   End
   Begin VB.TextBox Text2
      Height          =   1215
      Left            =   840
      MultiLine       =   -1  'True
      ScrollBars      =   2  '««ª½±²¶b
      TabIndex        =   1
      Top             =   1920
      Width           =   3135
   End
   Begin VB.TextBox Text1
      BackColor       =   &H80000018&
      Height          =   375
      Left            =   1200
      TabIndex        =   0
      Top             =   360
      Width           =   2895
   End
   Begin VB.Label Label4
      Alignment       =   2  '¾a¤¤¹ï»ô
      Caption         =   "½Ð¿é¤J¶]°¨¿O¤å¦r"
      Height          =   375
      Left            =   1320
      TabIndex        =   4
      Top             =   1200
      Width           =   2295
   End
   Begin VB.Label Label2
      Caption         =   "Text ¶]°¨¿O"
      Height          =   375
      Left            =   120
      TabIndex        =   3
      Top             =   360
      Width           =   975
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'«Å§i­n¦b Text1 ùØÅã¥Üªº¶]°¨¿O¦r¦êÅܼÆ
Dim TString As String

Private Sub Command1_Click()
'«Å§iÀx¦s Text1 ¦r¦êªø«×ªºÅܼÆ
Dim TWidth As Long

    Command2.Enabled = True
    '±Ò°Ê Timer Åã¥Ü¶]°¨¿O
    Timer1.Enabled = True
    Command1.Enabled = False

    'text2 ùØ¥²¶·¿é¤J¶]°¨¿O¦r¦ê
    If Text2.Text = "" Then
        MsgBox "½Ð¿é¤J¶]°¨¿O¤å¦r"
        '¨S¦³¿é¤J´N«ö¤U Command2 ¶]°¨¿Oµ²§ô¶s
        Command2_Click
        Exit Sub
    End If

    '²Î­p Text1Box ùب쩳©ñªº¤U´X­Ó¦r
    Do While TextWidth(Space(TWidth)) <= Text1.Width
        TWidth = TWidth + 1
    Loop

    '³]©w¶]°¨¿O¦r¦ê¬° Text1 ¼e«×­ÓªÅ¥Õ
    '¥[­ì¿é¤Jªº ¶]°¨¿O¤å¦r
    TString = Space(TWidth) + Text2.Text

End Sub

Private Sub Command2_Click()
    Text1.Text = ""

    Command1.Enabled = True

    Command2.Enabled = False
    'Ãö³¬¶]°¨¿OÅã¥Ü
    Timer1.Enabled = False

    Text2.SetFocus
End Sub

Private Sub Form_Load()
    Timer1.Enabled = False
    Timer1.Interval = 200
    Command2.Enabled = False

    '±N¦U¤¸¥ó Font ²Î¤@¡A§Q©ó­pºâ¦r¦ê¼e«×
    Text1.Font = Me.Font
    Text2.Font = Me.Font

    Me.Show

    Text2.SetFocus

End Sub

Private Sub Timer1_Timer()
'¶}©l¾e¨ú¶]°¨¿O¦r¦ê¤§¦ì¸m«ü¼Ð
Static TPos As Long

    '¦pªG¦ì¸m«ü¼Ð¶V¹L¤F¾ã­Ó¦r¦ê
    If TPos > Len(TString) Then
        '§â¦ì¸m«ü¼Ð²¾¨ì³Ì¶}ÀY
        TPos = 1
    Else
        '§â¦ì¸m«ü¼Ð²¾¨ì¤U¤@­Ó¦r
        TPos = TPos + 1
    End If

    '³v¦rÅã¥Ü¶]°¨¿O¦r¦ê
    Text1.Text = Mid(TString, TPos)

End Sub

¦^¯Á¤Þ


¥~³¡Àɮתº°õ¦æ¤Î²×¤î


³½¥b ¼¶¼g©ó¤å³¹

½Ð°ÝVB5¬O¥Îshell¨Ó°õ¦æ¥~³¡ÀÉ®×,¨º°õ¦æ«á,­n«ç¼Ë¥ÎVBªº»yªk¨Ó²×¤î¦¹Àɮתº°õ¦æ©O!?

¦Ñ©Çµª¡G

Dim FHandle As Variant '(Àx¦sµøµ¡¥N½XªºÅܼÆ

Private Sub Command1_Click()
    FHandle = Shell("C:\WIND98\CALC.EXE", 1) '(¶}±Ò¥~³¡°õ¦æÀÉ)
End Sub

Private Sub Command2_Click()
    AppActivate FHandle 'Åý¥ý«e¶}±Òªºµøµ¡¨ú±oµJÂI¡C
    SendKeys "%{f4}", True '°e¥X [Alt]+[F4] Windows ¨t²ÎªºÃö³¬²Õ¦XÁä¡C
End Sub

§ï¼g¦¨¯à³B²z¿ù»~ªº©I¥s¨ç¼Æ«h¦p¤U¡G

¶}±Ò Windows À³¥Îµ{¦¡
'varAppName ¬Oµ{¦¡¸ô®|¤Î¦WºÙ¤§¶Ç»¼°Ñ¼Æ
'varWinState ¬OÀ³¥Îµ{¦¡µøµ¡¶}±Òª¬ºA,³]©w¤è¦¡½Ð°Ñ¦Ò Shell
'ªº WindowsStyle »¡©ú
Private Function OpenApp(ByVal varAppName As String, _
        Optional ByVal varWinState As Integer)
'¶Ç¦^À³¥Îµ{¦¡¤§µøµ¡¥N½X
Dim varWinTitle As Variant

    '¿ù»~³B²z
    On Error GoTo OpenAppErr

    varWinTitle = Shell(varAppName, varWinState)
    OpenApp = varWinTitle
    Exit Function

OpenAppErr:
    Select Case Err.Number
        Case 53
            MsgBox "µ{¦¡¸ô®|©Î¦WºÙ¿ù»~", vbOKOnly, "¶}±ÒÀ³¥Îµ{¦¡"
    End Select
End Function

'Ãö³¬ Windows À³¥Îµ{¦¡
'varWinTitle ¬O¶}±Òµ{¦¡®É Windows ¨t²Îµ¹ªº¥N½X
Private Sub CloseApp(ByVal varWinTitle As Variant)

    '¿ù»~³B²z
    On Error GoTo CloseAppErr

    AppActivate varWinTitle
    '¥Î SendKeys ³¯­z¼ÒÀÀÁä½L [ALT]+[F4]
    SendKeys "%{F4}"
    Exit Sub

CloseAppErr:
    Select Case Err.Number
        Case 5
            MsgBox "µ{¦¡µøµ¡¤w³QÃö³¬", vbOKOnly, "Ãö³¬À³¥Îµ{¦¡"
    End Select
End Sub

'¤W­±¬O§ï¼g Shell ©M AppActivate ªº¨â­Ó¨ç¼Æ¡A©I¥s¤è¦¡¦p¤U¡G

'«Å§i¤@­ÓÀx¦sµøµ¡¥N½XªºÅܼÆ
Private WinTitle As Variant

'¶}µ{¦¡
Private Sub Command1_Click()
Dim AppName As String

    AppName = "§Aªºµ{¦¡¸ô®|¤Î¦WºÙ"
    WinTitle = OpenApp(AppName)
End Sub

'Ãöµ{¦¡
Private Sub Command2_Click()
    CloseApp WinTitle
End Sub

¦^¯Á¤Þ


­ç°£¦r¦ê¤¤ªº«ü©w¦r¤¸


º¡¨¬²{ªp...:P ¼¶¼g©ó¤å³¹

¤@­Ó string ¤¤¦³ 'aaa bbb      ccc'  «ç»òÅý¥¦Åܦ¨  'aaabbbccc'©O?

¦Ñ©Çµª¡G

Function KillChar(ByVal ExpString As String, ByVal KillString As String)
Dim ReturnString As String
Dim I As Long

    For I = 1 To Len(ExpString)
        If Mid(ExpString, I, 1) <> KillString Then
            ReturnString = ReturnString + Mid(ExpString, I, 1)
        End If
    Next

    KillChar = ReturnString
End Function

Private Sub Command1_Click()
Dim SomeChar As String

    SomeChar = "aaa bbb      ccc"
    Debug.Print SomeChar
    SomeChar = KillChar(SomeChar, " ")
    Debug.Print SomeChar
End Sub

¦^¯Á¤Þ


Drag ®ÉÅã¥Ü Picture


¥Á­ô ¼¶¼g©ó¤å³¹

When dragmode set auto ©ì¦²picture®É,·|Åã²{¤@­Ó®Ø®Ø,·Pı¤£¦n, ©Ò¥H¥h³]dragicon, ¦ý¦o¥u±µ¨ü *.ico *.cur  ½Ð°Ý¦pªG§Ú­n©ì¦²¤@­Ó *.bmp picture, ©ì¦²´Á¶¡¤]­nÅã¥Ü³o­Ó bmp picture «ç»ò¿ì?

¦Ñ©Çµª¡G

¦pªG©ì¦²´Á¶¡¤]­nÅã¥Ü Bmp Picture ¡A§A¥²¶·¨Ï Dragmode ¤´ºû«ù¤â°Ê¡AµM«á¨Ï¥ÎObject.Drag vbBeginDrag ªº¤èªk¥h±Ò°Ê¤@­Ó Object ªº Drag µ{§Ç(ª`·N¡A¤£¯à¦b Form ªº Dragover_Event ùس]©w Object.Drag vbBeginDrag ¡A¦]¬°°£«D§A¥ý Object.Drag vbBeginDrag ¡A§_«h Form_Dragover ¸ò¥»¤£·|µo¥Í¡C) ¥H¤U¬O²³æªºµ{¦¡½X¡A§A¥i¥H°Ñ¦Ò¬Ý¬Ý¡C

Dim OldX As Single, OldY As Single

Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Source.Move Source.Left + X - OldX, Source.Top + Y - OldY
OldX = X
OldY = Y
End Sub

Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Drag vbBeginDrag
OldX = Image1.Left + X
OldY = Image1.Top + Y
End Sub

Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Drag vbEndDrag
End Sub

¡°¦Ñ©Ç½d¨Ò¤»¹ï©ó§ó¶¶ºZªº©ì¦²¹Ï¤ù¡A¦³§ó¦nªº¸Ñ¨M¤è®×¡A½Ð°Ñ¦Ò¡C¡°

¦^¯Á¤Þ


Drag ©M Move ªº¤ñ¸û


¥Á­ô ¼¶¼g©ó¤å³¹

¥H Object.Drag vbBeginDrag ´N¥i¥H¦Û°Ê©ì¦² Object.Picture¡A¦ý¬°¤°»ò¤£¦b MouseMove_Event ùس]©w Object.Move X,Y (¦ý¤ñ¸û¤£¶¶ºZ,¤£ª¾¹D¯à¤£¯à§ïµ½?) ½Ð°Ý¥Î³o¨âºØ¤èªk¦³®É»ò§Q¹ú?

¦Ñ©Çµª¡G

  1. Object_MouseMove ©M Form_DragOver ¤èªkªº¤ñ¸û¡ADragOver ªº¦n³B¬O¥Ñ VB ¬°§A³B²z¤F¤j³¡¥÷ Object.Move ªº¥\¯à¡A¦Ó¥B¥u­n¦b Form_DragOver ¨Æ¥ó¤W¼g¤@¦¸µ{¦¡¡A´N¥i¨Ñ©Ò¦³ªº Object §Q¥Î¡C¦ý¥L³Ì¤jªºÃa³B¬OÁöµM§Aªº¹Ï·|¸ò§Aªº·Æ¹««ü¼Ð¤@°_²¾°Ê¡A¦ý¨º­Ó³z©úªº¥|¤è®Ø¤´·|¶]¥X¨Ó¡A¦Ó¥B¦pªG§Aªº¹Ïµy¤j¡A·|¦³·Æ¹«¤w¶]¨ì§O³B¡A¦Ó§Aªº¹Ï¤´¯d¦b­ì³Bªº§xÂZ¡C
  2. ¦Ü©ó Mouse move ³Ì¤jªº¯Ê¾Ñ´N¬O¹Ï©M·Æ¹«ªº²¾°Ê¤£¬O¦P¨Bªº¡A©Ò¥H±`¦³¹Ï¸ò¦b·Æ¹««á­±°lªº²{¶H¡A³æ¯Â¨Ï¥Î VB ©R¥Oµª®×¬OµL¸Ñ¡A¦ý¦pªG§Q¥Î Windows ApiùØ MouseHook ªº¥\¯à¡A§â·Æ¹««ü¼ÐÂê¦b Object ¤W¡A´N¥i¥H§ïµ½¡C«ç°µ§A´N­n½Ð±ÐApi °ª¤â CWW¡A½Ð¨ì http://140.116.253.249/~cww/ §ä¬ÛÃö½d¨Ò¡C

¡°¦Ñ©Ç½d¨Ò¤»¹ï©ó§ó¶¶ºZªº©ì¦²¹Ï¤ù¡A¦³§ó¦nªº¸Ñ¨M¤è®×¡A½Ð°Ñ¦Ò¡C¡°

¦^¯Á¤Þ


VB 5.0 ¥i¥H¨Ï¥Îªº¹ÏÀɮ榡


°ÆÀɦW

¤j¤p­­¨î

¦â¼Æ¤W­­

¦V¶q©ÎÂI°}

³z©ú®ÄªG

¦sÀɮ榡

BMP µL ¥þ±m ÂI°} µL BMP
DIB µL ¥þ±m ÂI°} µL DIB
ICO 32*32 16 ÂI°} ¦³ ICO
CUR 32*32 2 ÂI°} ¦³ CUR
WMF µL ¥þ±m ¦V¶q ¦³ WMF
EMF µL ¥þ±m ¦V¶q ¦³ EMF
GIF µL 256 ÂI°} ¦³ BMP
JPG µL ¥þ±m ÂI°} µL BMP

¡°¦sÀɮ榡¬O«ü¥Î VB5 SavePicture ¦sÀɫ᪺Àɮ׮榡¡°

¦^¯Á¤Þ


¦p¦ó¦Û»s MetaFile


MetalFile ¡A´N¬O°ÆÀɦW WMF ©Î EMF ªº¦V¶q¹ÏÀÉ¡A¤]´N¬O¦b Office ùؼsªx±Ä¥Îªº¬ü¤u¹Ï®w¹Ï®×¡A¦³ÂI¯îÂÕªº¬O Office ¤Ñ¤Ñ¦b¥Î MetalFile¡A¥¦ªºÃ¸¹Ï¤u¨ãµe¥X¨Óªº¹Ï¤]¬O MetalFile¡A¥i´N¤£´£¨Ñ§â Office »s§@¥X¨Óªº¹Ï¦s¦¨ WMF Àɪº¥\¯à¡C³o¦b¨ä¥L¤£·| VB »y¨¥ªº·íµM¬OÃø¨Æ¤@¼Î¡A¦ý§A¥i¥H§Q¥ÎOffice ø¹Ï¤u¨ã§â¹Ïµe¦n¡A±N¥þ¹Ï¸s²Õ¤Æ«á¡A«ö½Æ»s¡A¦A¦b VB ¤¤°õ¦æ¥H¤Uªº»yªk¡A´N¥i¥H±o¨ì¿W¥ßªº WMF ¹Ï¦b VB ùØÀ³¥Î¡C

Private Sub Command1_Click()
    If Clipboard.GetFormat(vbCFMetafile) Then
        Set Picture1.Picture = Clipboard.GetData
        SavePicture Picture1.Picture, "c:\test\bin.wmf"
    End If
End Sub

¦^¯Á¤Þ


¦^­º­¶

1