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

¦^­º­¶


¤ÀÃþ

¼ÐÃD

¤j·N

§@ªÌ

¤é´Á

ÀÉ®× I/O ¤å¦rÀɪº©w¦ì®æ¦¡¤Æ¿é¥X Put # & Get # ªº¨Ï¥Î ¦Ñ©Ç 1998/4/30
ª«¥ó¥~Æ[ ª«¥ó¸I¼²µ{¦¡¸Õ§@(¤@) One Timer ¦Ñ©Ç 1998/4/30
ª«¥ó¥~Æ[ ª«¥ó¸I¼²µ{¦¡¸Õ§@(¤G) Two Timer ¦Ñ©Ç 1998/4/30
¹Ï§Î³B²z ¦p¦ó«O¯d Paintpictrue ¼v¹³ °õ¦æRefresh¤§«á¹Ï¤£¨£¤F ¦Ñ©Ç 1998/4/29
¹Ï§Î³B²z ¹Ï­±­I´º³z©úªº§Þ¥© ³z©ú¥|ªk ¦Ñ©Ç 1998/5/5
¹Ï§Î³B²z °Ï¶ô¨ú¹Ï»P°Ï¶ô¶K¹Ï PaintPicture() ªº°Ñ¼Æ¨Ï¥Î ¦Ñ©Ç 1998/5/5
®É¶¡´«ºâ ¤é´Á®É¶¡®æ¦¡ªº¸ê®Æ«¬ºA ¥H Now() ¨ç¼Æ¬°¨Ò ¦Ñ©Ç 1998/5/7
¦r¦ê³B²z ¥Î VB 5.0 ºâ¦r¦êªø«× StrConv() ªº LenB() ¨Ï¥Î ¦Ñ©Ç 1998/5/2
¦r¦ê³B²z TextBox ­­¿é¤J¼Æ¦r ¥H KeyPress Event ¬°¨Ò ¦Ñ©Ç 1998/5/15
¦r¦ê³B²z TextBox ­­¨î¿é¤Jªø«× ¥H TextBox_Change ¬°¨Ò ¦Ñ©Ç 1998/5/20
¦r¦ê³B²z ¦p¦óÅã¥Ü "&" ¦r¤¸ ¡@ ¦Ñ©Ç 1998/5/21
¦r¦ê³B²z ¼Æ¦r©Î¦r¥À§PÂ_ IsNumeric() ¨ç¼Æªº¨Ï¥Î ¦Ñ©Ç 1998/5/23
¦r¦ê³B²z ¬ð¯} TextBox 32 K ªº­­¨î Mid() ¨ç¼Æªº¨Ï¥Î ¦Ñ©Ç 1998/5/23
¦r¦ê³B²z ¦r¥ÀÂন´`§Ç¼Æ¦r Asc() ¨ç¼Æªº¨Ï¥Î ¦Ñ©Ç 1998/5/26
¦r¦ê³B²z °O¨Æ¥»½s¿è¥\¯à¼ÒÀÀ ClipBoard ª«¥óªº¨Ï¥Î ¦Ñ©Ç 1998/5/26
ÅܼƨϥΠ¦b°õ¦æ´Á²£¥Íª«¥ó As ©M As New ¦Ñ©Ç 1998/5/19
ª«¥ó¤Þ¥Î ¨Ï¥Î¶µ¥Ø»P¨Ï¥Î¤¸¥óªº¤À§O ¡@ ¦Ñ©Ç 1998/5/22
ÀH¾÷¨ú¼Ë ¦p¦ó§âµP¬~´²¬~¶Ã Randomize ©M Rnd() ¨Ï¥Î ¦Ñ©Ç 1998/5/23
¬É­±³B²z ¥H Code §R°£¦r¦ê Sendkeys ªº¨Ï¥Î ¦Ñ©Ç 1998/5/26
¬É­±³B²z TextBox.Text ªº¥þ¿ï¥\¯à SelStart & SelLength ÄÝ©Ê ¦Ñ©Ç 1998/5/26

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

¦^¯Á¤Þ


¦p¦ó«O¯d Paintpictrue ¼v¹³


ÀH½t¡B±¤½t ¼¶¼g©ó¤å³¹

§Ú¨Ï¥Î¦p¤Uªºµ{¦¡½X
Form1.PaintPicture Form2.Picture, 100, 100, Form2.Picture.Width, Form2.Picture.Height, , , , , vbSrcAnd
Form1.Refresh
¦b²Ä¤@­Óstatement°õ¦æ§¹¹Ï·|¶K¹L¨ìform1,¦ýform1°õ¦æRefresh¤§«á¹Ï¤S¤£¨£¤F,½Ð°Ý¬°¦ó·|¦p¦¹??ÁÙ¦³¨º¸Ì­nª`·Nªº¶Ü??

¦Ñ©Çµª¡G

  1. ¦b°µ Paintpicture °Ê§@®É§Ú­Ì­nª`·N¨ì Form ©M PictureBox ¦P®É¨ã¦³«e´º¹Ï¼h¤Î­I´º¹Ï¼h¨â­Ó¹Ï¼hªº¯S©Ê¡C
  2. form ©M picturebox ªº autoredraw ÄÝ©Ê¡A´N¬O¨M©w§Ú­Ì§â picture paint ¨ì¨º­Ó¹Ï¼hªºªº±±¨îÄÝ©Ê¡Aautoredraw=true ¬O paint ¨ì­I´º¹Ï¡Aautoredraw=false ¬Opaint ¨ì«e´º¹Ï¡C¤@¯ëform ©M picturebox autoredraw ªº¹w³]ÄݩʬO false¡A¤]´N¬Opaint ¨ì«e´º¹Ï¡C
  3. refresh ¤èªk°õ¦æªº°Ê§@´N¬O¥Î­I´º¹Ï»\±¼«e´º¹Ï¡A²{¦b§Aª¾¹D¬°¤°»ò refresh «á§Aªº form1 ·|ªÅµL¤@ª«¤F¶Ü¡H¦]¬°§Aªº­I´º¹ÏªÅµL¤@ª«¡A¦Ó Paint ¤S¥u¦b«e´ºªº½t¬G¡C§AÁÙ¥i¥H§â refresh «ü¥O¥h±¼¡AµM«á¥Î¥t¤@µøµ¡¾B¦í§A Form1 ªº¤@­Ó¨¤¡A·í²¾¶}¾B½ªªºµøµ¡«á¡A§A·|µoı form1 ªº¨º­Ó¨¤¤]³Q²MªÅ¤F¡C¥i¬O¦pªG§A¦b Paint ¤§«e§âautoredraw=true¡A¨º»ò¤£ºÞ¤W­±»\¦h¤Öµøµ¡¡A·í§Aªº Form1 GotFocus ¤§«á¡A¥L¨ÌµMµe­±¦p¬G¡A§A²{¦b¯à°÷¤F¸Ñ¡A¥u¦³­I´º¤~·|³Q­«Ã¸§a¡C
  4. ©Î³\§AÁÙ·|°Ý¡A§Ú form2.autoredraw ¤]µ¥©ó false°Ú¡A¬°¤°»ò´N¯à­«Ã¸¡H¦]¬°·í§A¥Î form2.picture=¬Y¹Ï ±Ô­z«á¡A¬Y¹Ï´N¤w¸g¦¨¬° form2 ªº­I´º¹Ï¡C

¦^¯Á¤Þ


¤å¦rÀɪº©w¦ì®æ¦¡¤Æ¿é¥X


Johnson ¼¶¼g©ó¤å³¹

¿é¥X¨ì¤å¦rÀÉ¡G

­Y¦³¤­­ÓÄæ¦ìªº¸ê®Æ¡A¦p¦ó°µ¨ì©w¦ìªº«ü©w¡A¦p¦b²Ä´X­Ó¦r¬°°_©lÂI¡A¹³c or fortran§@®æ¦¡¿é¥X¡A¥t¥~¦b³Ì«á¤@­Ó¸ê®Æ¿é¥X«á¡A¦p¦ó¸õ¨ì¤U¤@¦Cªº²Ä¤@­Ó¦r¤¸¡C½ÐÀ°¦£¤@¤U¡C

¦Ñ©Çµª¡G

'«Å§i¤@­Ó¥]§t¤­­ÓÄæ¦ìªº¦Û­q§ÎºAÅܼÆ
Private Type Mytype
    FirstName As String * 4
    LastName As String * 4
    ID_No As String * 10
    Salary As Long
    BirthDay As Date
End Type

'¦s©ñ¶}ÀÉ¥N¸¹ªºÅܼÆ
Dim F_Handle As Integer
'«Å§i MyRec ¬°¦Û­q§ÎºAÅܼÆ
Dim MyRec As Mytype

Private Sub Form_Load()
¡@'¥Î Freefile ¨ç¼Æ¨ú±o¶}ÀÉ¥N¸¹
¡@F_Handle = FreeFile()
¡@' For Random ¬O±Ä¥Î¶}ÀH¾÷ÀɼҦ¡¡ALen(MyRec) «h¬O«ü©w¨C¦¸Åª¤J Mytype §ÎºA
¡@'¦Û©wÅܼƤ§¼e«×
    Open "c:\temp\temp.txt" For Random As #F_Handle Len = Len(MyRec)
¡@' ÀH«K¿é¤J¨Ç¸ê®Æ¡A¥H«KÆ[´ú¼g¤JÀɮפ§¥Î
    MyRec.FirstName = "¹Å"
    MyRec.LastName = "¾G"
    MyRec.ID_No = "A1234"
    MyRec.Salary = 5000
    MyRec.BirthDay = #2/14/60#
¡@' ¥Î Put ¤èªk¡A§â MyRec ùتº¸ê®Æ¼g¨ì "c:\temp\temp.txt" ùØ
    Put #F_Handle, 1, MyRec
¡@'Éi¤W
    MyRec.FirstName = "¥É"
    MyRec.LastName = "¾G"
    MyRec.ID_No = "A0034"
    MyRec.Salary = 8000
    MyRec.BirthDay = #5/15/60#
    Put #F_Handle, 2, MyRec

¡@'¥Î Get ¤èªk±q "c:\temp\temp.txt" ÀÉùØ®³¸ê®Æ¡A©ñ¨ì MyRec ùØ¡C
    ' [2] ªí¥Ü¨ú²Ä¤Gµ§°O¿ý
    Get #F_Handle, 2, MyRec

    Me.Show

    Print "[³o¬O²Ä¤Gµ§°O¿ý]"
    Print MyRec.FirstName
    Print MyRec.LastName
    Print MyRec.ID_No
    Print MyRec.Salary
    Print MyRec.BirthDay

¡@' [1] ªí¥Ü¨ú²Ä¤@µ§°O¿ý
    Get #F_Handle, 1, MyRec

    Print "[³o¬O²Ä¤@µ§°O¿ý]"
    Print MyRec.FirstName
    Print MyRec.LastName
    Print MyRec.ID_No
    Print MyRec.Salary
    Print MyRec.BirthDay

¡@' Ãö³¬©Ò¶}¤§ÀÉ®×
    Close #F_Handle
End Sub

¦^¯Á¤Þ


ª«¥ó¸I¼²µ{¦¡¸Õ§@(¤@)


VERSION 5.00
Begin VB.Form flishape
   BackColor       =   &H00FFFF80&
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '¨t²Î¹w³]­È
   Begin VB.Timer Timer1
      Interval        =   1
      Left            =   1800
      Top             =   1320
   End
   Begin VB.Shape Shape2
      BorderWidth     =   3
      FillColor       =   &H000000FF&
      FillStyle       =   0  '¹ê¤ß
      Height          =   855
      Left            =   3360
      Shape           =   4  '¶ê¨¤¯x§Î
      Top             =   2040
      Width           =   855
   End
   Begin VB.Shape Shape1
      BorderWidth     =   3
      FillColor       =   &H0000FFFF&
      FillStyle       =   0  '¹ê¤ß
      Height          =   855
      Left            =   600
      Shape           =   4  '¶ê¨¤¯x§Î
      Top             =   240
      Width           =   855
   End
End
Attribute VB_Name = "flishape"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Go_Oridging()
'Shape Âk¦ì¤èªk¡A¥Øªº¦b§ïÅܵøµ¡¤j¤p«á¡A_
'ÁקK Shape ±¼¨ìµøµ¡¥~
    Shape1.Move 0, 0
    Shape2.Move Me.ScaleWidth - Shape2.Width, _
            Me.ScaleHeight - Shape2.Height
End Sub
Private Sub Form_Load()
    Go_Oridging
End Sub

Private Sub Form_Resize()
    Go_Oridging
End Sub

Private Sub Timer1_Timer()
'¨â­Ó Shape ªº¥¿­t¦V«ü¼Ð
Static Shp1XFwd As Integer, Shp1YFwd As Integer
Static Shp2XFwd As Integer, Shp2YFwd As Integer
'¨C¨B¨B¥ï
Static l_go As Integer

    '³]©w¥¿­t¦Vªì­È
    If Shp1XFwd = 0 Then Shp1XFwd = 1
    If Shp1YFwd = 0 Then Shp1YFwd = 1
    If Shp2XFwd = 0 Then Shp2XFwd = -1
    If Shp2YFwd = 0 Then Shp2YFwd = -1

    l_go = 120

    'Shape1 ªºÃä¬É³B²z
    With Shape1
        If .Left <0 Or .Left> Me.ScaleWidth - .Width Then _
                Shp1XFwd = Shp1XFwd * -1
        If .Top <0 Or .Top> Me.ScaleHeight - .Height Then _
                Shp1YFwd = Shp1YFwd * -1
    End With

    'Shape2 ªºÃä¬É³B²z
    With Shape2
        If .Left <0 Or .Left> Me.ScaleWidth - .Width Then _
                Shp2XFwd = Shp2XFwd * -1

        If .Top <0 Or .Top> Me.ScaleHeight - .Height Then _
                Shp2YFwd = Shp2YFwd * -1
    End With

    'Shape1 »P Shape2 ¸I¼²³B²z
    If (Shape1.Left + Shape1.Width - Shape2.Left) > 0 And _
            Shape1.Left <(Shape2.Width + Shape2.Left) And _
            (Shape1.Top + Shape1.Height - Shape2.Top) > 0 And _
            Shape1.Top <(Shape2.Height + Shape2.Top) Then

            '¸ô®|Âà¦V
            Shp1XFwd = Shp1XFwd * -1
            Shp2XFwd = Shp2XFwd * -1
            Shp1YFwd = Shp1YFwd * -1
            Shp2YFwd = Shp2YFwd * -1
    End If

    '²¾°Ê Shape1
    Shape1.Move Shape1.Left + (Shp1XFwd * l_go), _
            Shape1.Top + (Shp1YFwd * l_go)
    '²¾°Ê Shape2
    Shape2.Move Shape2.Left + (Shp2XFwd * l_go), _
            Shape2.Top + (Shp2YFwd * l_go)

End Sub

¦^¯Á¤Þ


ª«¥ó¸I¼²µ{¦¡¸Õ§@(¤G)


³o¬O¥Î¨â­Ó­p®É¾¹ªº¡A®ÄªG¤£¤@¼Ë¡C

VERSION 5.00
Begin VB.Form flishape
   BackColor       =   &H00FFFF80&
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '¨t²Î¹w³]­È
   Begin VB.Timer Timer2
      Interval        =   100
      Left            =   2400
      Top             =   1320
   End
   Begin VB.Timer Timer1
      Interval        =   10
      Left            =   1800
      Top             =   1320
   End
   Begin VB.Shape Shape2
      BorderWidth     =   3
      FillColor       =   &H000000FF&
      FillStyle       =   0  '¹ê¤ß
      Height          =   855
      Left            =   3360
      Shape           =   4  '¶ê¨¤¯x§Î
      Top             =   2040
      Width           =   855
   End
   Begin VB.Shape Shape1
      BorderWidth     =   3
      FillColor       =   &H0000FFFF&
      FillStyle       =   0  '¹ê¤ß
      Height          =   855
      Left            =   600
      Shape           =   4  '¶ê¨¤¯x§Î
      Top             =   240
      Width           =   855
   End
End
Attribute VB_Name = "flishape"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Go_Oridging()
'Shape Âk¦ì¤èªk¡A¥Øªº¦b§ïÅܵøµ¡¤j¤p«á¡A_
'ÁקK Shape ±¼¨ìµøµ¡¥~
    Shape1.Move 0, 0
    Shape2.Move Me.ScaleWidth - Shape2.Width, _
            Me.ScaleHeight - Shape2.Height
End Sub
Private Sub Form_Load()
    Go_Oridging
End Sub

Private Sub Form_Resize()
    Go_Oridging
End Sub

Private Sub Timer1_Timer()
'Shape ªº¥¿­t¦V«ü¼Ð
Static Shp1XFwd As Integer, Shp1YFwd As Integer
'¨C¨B¨B¥ï
Dim l_go As Integer

    '³]©w¥¿­t¦Vªì­È
    If Shp1XFwd = 0 Then Shp1XFwd = 1
    If Shp1YFwd = 0 Then Shp1YFwd = 1

    l_go = 120

    'Shape1 ªºÃä¬É³B²z
    With Shape1
        If .Left <0 Or .Left> Me.ScaleWidth - .Width Then _
                Shp1XFwd = Shp1XFwd * -1
        If .Top <0 Or .Top> Me.ScaleHeight - .Height Then _
                Shp1YFwd = Shp1YFwd * -1
    End With


    'Shape1 »P Shape2 ¸I¼²³B²z
    If (Shape1.Left + Shape1.Width - Shape2.Left) > 0 And _
            Shape1.Left <(Shape2.Width + Shape2.Left) And _
            (Shape1.Top + Shape1.Height - Shape2.Top) > 0 And _
            Shape1.Top <(Shape2.Height + Shape2.Top) Then

            '¸ô®|Âà¦V
            Shp1XFwd = Shp1XFwd * -1
            Shp1YFwd = Shp1YFwd * -1
    End If

    '²¾°Ê Shape1
    Shape1.Move Shape1.Left + (Shp1XFwd * l_go), _
            Shape1.Top + (Shp1YFwd * l_go)
End Sub

Private Sub Timer2_Timer()
Static Shp2XFwd As Integer, Shp2YFwd As Integer
Dim l_go As Integer

    If Shp2XFwd = 0 Then Shp2XFwd = -1
    If Shp2YFwd = 0 Then Shp2YFwd = -1

    l_go = 120
        'Shape2 ªºÃä¬É³B²z

    With Shape2
        If .Left <0 Or .Left> Me.ScaleWidth - .Width Then _
                Shp2XFwd = Shp2XFwd * -1
        If .Top <0 Or .Top> Me.ScaleHeight - .Height Then _
                Shp2YFwd = Shp2YFwd * -1
    End With

    'Shape1 »P Shape2 ¸I¼²³B²z
    If (Shape1.Left + Shape1.Width - Shape2.Left) > 0 And _
            Shape1.Left <(Shape2.Width + Shape2.Left) And _
            (Shape1.Top + Shape1.Height - Shape2.Top) > 0 And _
            Shape1.Top <(Shape2.Height + Shape2.Top) Then

            '¸ô®|Âà¦V
            Shp2XFwd = Shp2XFwd * -1
            Shp2YFwd = Shp2YFwd * -1
    End If

    '²¾°Ê Shape2
    Shape2.Move Shape2.Left + (Shp2XFwd * l_go), _
            Shape2.Top + (Shp2YFwd * l_go)

End Sub

¦^¯Á¤Þ


¥Î VB 5.0 ºâ¦r¦êªø«×


¶Àª÷²´ ¼¶¼g©ó¤å³¹

°²³]§ÚŪ¶i¤@­Ó¦r¦ê¡A¦¹¦r¦ê¥i¯à¤º§t¤¤¤å¦r¡A§Ú·Qºâ¥X¸Ó¦r¦êªºªø«×¡A¸Ó¦p¦ó³B²z¡CEX : "abc¤¤¤å" ªºªø«×§Ú·Qºâ¦¨ 7¡C

¦Ñ©Çµª¡G

  1. Ex="abc¤¤¤å"
  2. LenB(StrConv(Ex, vbFromUnicode))

¦^¯Á¤Þ


¹Ï­±­I´º³z©úªº§Þ¥©


©p¬O§Ú¤µ¥Íªº·s®Q ¼¶¼g©ó¤å³¹

½Ð°Ý¤@ ¤U vb¤¤ ªº¹Ï­± [­I´º] ¥i¥H³]¦¨³z©úªº¹À?? ­Y¥i¥H¨º­n¦p¦ó¥Î©O???

¦Ñ©Çµª¡G

  1. ¨Ï¥Î³z©ú®æ¦¡¤§¹Ï¹³¡A¦p¡G

    GIF 89A
    MeTalFile (°ÆÀɦW *.wmf or *.emf)
    ¹Ï¥ÜÀÉ (°ÆÀɦW *.ico)

  2. ¤Þ¥Î Microsoft Windows Common Controls 5.0 ³o­Ó OCX
  3. §Q¥Î PictureBox ªº DrawMode ÄÝ©Ê©Î PaintPicture ªº Opcode ªº°Ñ¼Æ¡C
  4. §Q¥Î Windows Api ªº BitBlt ¶K¹Ï¨ç¼Æ¡C

¦^¯Á¤Þ


°Ï¶ô¨ú¹Ï»P°Ï¶ô¶K¹Ï


¨È¨È ¼¶¼g©ó¤å³¹

§Ú­n¦b picture1 ¤¤½Æ»s picture2 ªº¹Ï¡A¦ý¬O­n¥¦±qpicture1ªº¥k¤W¨¤¶}©l¥X²{¡A¬O¥ÎpaintPicture³o­Ó¤èªk¨Ó¼gªº³á¡I

¦Ñ©Çµª¡G

  1. PaintPicture »yªk¸ÑÄÀ¡G
  2. ¦p¦ó°Ï¶ô¨ú¹Ï¤Î¶K¹Ï¡G

    ²{¦b°²³]§Ú­Ì­n¨ú Picture2 ¥ª¤U¨¤¡A20 ¥­¤èÂIªº¹Ï¶K¦b picture1 ªº¥k¤W¨¤¡A¨º«ü¥O¬O³o¼Ë¤U¡G

    picture1.paintpicture picture2.picture,picture1.scalewidth-20,0,20,20,0,picture2.scaleheight-20,20,20

  3. ¨â­Ó picturebox.scalemode ­n¤@¼Ë¡A³Ì¦n³]¬°¹³¯À¡C

¦^¯Á¤Þ


¤é´Á®É¶¡®æ¦¡ªº¸ê®Æ«¬ºA


¥D¦®: Re: ½Ð°ÝVB5¤¤«ç»òºâ®É¶¡

¦Ñ©Çµª¡G

  1. VB ùØ©Ò¦³ªº¤é´Á®É¶¡®æ¦¡¨ä¹ê¥u¬O¤@­Ó­¿ºë«×¯BÂI¼Æ¡A¤]´N¬O Double ªº¸ê®Æ«¬ºA¡C
  2. ©Ò¿×ªº day(),time(),timer() ¤£¹L¬O¦b³o­Ó Double ùبú¥L»Ý­nªº¤@¬qÅã¥Ü¥X¨Ó¦Ó
    ¤w¡C
  3. ¦pªG­n¬Ý Now() ³o­Ó¥]§t¤é´Á»P®É¶¡¸ê®Æªº§¹¾ã¸ê®Æ¡A½Ð¥Î Cdbl(Now()) ¨Ó§âNow() ªº¸ê®ÆÂন Double ¸ê®Æ¡A´N·|¥X²{ 12345.1234567.... ªº¸ê®Æ¨Ó¡C
  4. ¤p¼ÆÂI«e¤­¦ì¬O¤é´Á¡A¤p¼ÆÂI«á¤­¦ì¬O®É¶¡¡A¦A«á­±ªº´N¬O¬í¥H¤Uªº­p®É¤F¡C
  5. ¤£©ú¥Õªº¸Ü½Ð°õ¦æ³o¤@¬q¡G
    Private Sub Form_Click()
    Dim Start As Double, Ending As Double, I As Long, J As Long
        For J = 0 To 9
            Start = CDbl(Now())
            For I = 0 To 1000000
            Next
            Ending = CDbl(Now())
            Print Ending - Start
        Next
    End Sub

¦^¯Á¤Þ


TextBox ­­¿é¤J¼Æ¦r


¨g¼É¤§¬P ¼¶¼g©ó¤å³¹

§Ú­n¦btext ¤U...°²¦p¬O­­¨î¼Æ¦r...¤£¯à¦³¦r¤¸..­n¥Î¤°»ò¨Ï¥Î...³Â·Ð¤@¤U..:

¦Ñ©Çµª¡G

Private Sub Text1_KeyPress(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

¦^¯Á¤Þ


¦b°õ¦æ´Á²£¥Íª«¥ó


³ßÅw¿ß«}ªº¶Àª÷¹«

½Ð°Ý¦U¦ì°ª¤â:VB 5.0 ­n¦p¦ó¦bRun Time, °ÊºACreate new Object? Thank you!

¦Ñ©Çµª¡G

§A¦b VB Run Time, ·Q°ÊºA Create new Object¡A­n¬Ý Object ªº¯S©Ê¡A¦pªG Object ¬O VB Global ùتº Object¡A¤£¨ã¦³ Control ªºÄÝ©Ê¡A¨º¥Î Dim YourObjectName As New VBObject ªº¤è¦¡«Å§i¡A¦pªG§A¥Îªº¬O VB5.0 ¡A¦b§A¿é¤J New ªÅ¤@®æ«á¡A¨t²Î·|³qª¾§A¨º¨Ç Object ¬O¥i¥H Dim As New ªº(¤£¤Ó¦h¡A¥u¦³´X¶µ)¡C

¦pªG§A­n«Å§iªº Object ¬O Control(´N¬O¥i¥H©ñ¨ì Form ­±ªO¤Wªº¨º¨ÇªFªF)¡A½Ð¥ý¦b³]­p¶¥¬q¥¬¸m¤@­Ó¦PÃþ«¬ªº Control ¨ì Form ¤W¡A¨Ã¦b Control.Index ÄݩʭȤWµ¹¤@­Ó¯Á¤Þ­È(³q±`¬O 0)¡A¨ì¤F°õ¦æ¶¥¬q¡A´N¥i¥H¤£»Ý¥ý¦æ«Å§i¡Aª½±µ¥H Load TestComman(1),Load TestCommand(2)......¡A¨Ó°ÊºA¼W¥[¡A¤£¹L¥Î§¹½Ð¥H Unload ÄÀ©ñ±¼¡A¥H¾i¦¨¸`¬Ù°O¾ÐÅ骺¨}¦n²ßºD¡C

¦³¤@ÂI­n¯S§Oª`·N¡A©Ò¦³ Load ¶i¨Óªº Control.Visible Äݩʳ£¬O False¡A­n§â¥¦§ï¦¨ True ¤~·|Åã²{¡A©Ò¥H Load §¹¥H«á¬Ý¤£¨£¡A¤£­n¥H¬°¬O Load ¥¢±Ñ¡A­è Load ¶i¨Óªº Control ªº¦ì¸m¬OÅ|¦b­ì Control ¤Wªº¡A­n°µ Move °Ê§@¤~·|¤À¬°¨â­Ó¡C

³Ì«á°µ¤@Á`¾ã²z¡G

  1. ¬°²{¦³ª«¥ó°µ°Ñ·Ó½Æ¥»¡G
  2. Run Time, °ÊºACreate new Object¡A¨Ì Object «¬ºA¤À¬°¡G

¦^¯Á¤Þ


TextBox ­­¨î¿é¤Jªø«×


±H¥óªÌ: Annie Chiu

¦bVB¤¤¨Ï¥Îtext ªºmaxlength ÄÝ©Ê,§Úªº¸ê®ÆÄæ¦ìªø«×¬°10, ¦p¦ó±±¨îtext ¥u¯à¿é¤J10­Ó­^¤å¦r, ©Î5­Ó¤¤¤å¦r©O¡H

¦Ñ©Çµª¡G

  1. ¥Î textbox.maxlength ªºÄÝ©Ê¡A¥¦ÁÙ¬O·|§â¨â byte ªº¤¤¤åºâ¤@­Ó¦r¡A§A°Ñ¦Ò¤U­±ªºµ{¦¡½X¡A©Î³\¯à¹F¦¨§Aªº¥Ø¼Ð¡C
  2. Private Sub Text1_Change()
    Static OldString As String
        If LenB(StrConv(Text1.Text, vbFromUnicode)) > 10 Then
            Text1.Text = OldString
        End If
        OldString = Text1.Text
    End Sub

¦^¯Á¤Þ


¦p¦óÅã¥Ü "&" ¦r¤¸


©ñ¤@Áû¤ß.. ¼¶¼g©ó¤å³¹

§Ú­n¦p¦ó¦bLabel¤¤Åã¥Ü"&"³o¤@­Ó¦r¤¸!!¦]¬°¦pªGª½±µ¥´"&"¦n¹³·|Åܦ¨under line.....

¦Ñ©Çµª¡G

³s¥´ "&&" ¨â­Ó¡C

¦^¯Á¤Þ


¨Ï¥Î¶µ¥Ø»P¨Ï¥Î¤¸¥óªº¤À§O


¤ß¥Xµo ¼¶¼g©ó¤å³¹

¦bvb5ªºÀô¹Ò¤U¡A±M®×/³]©w¨Ï¥Î¶µ¥Ø  »P ±M®×/³]©w¨Ï¥Î¤¸¥ó  ¦³¦ó¤£¦P©O¡H

¦Ñ©Çµª¡G

  1. ´N¦³µL¨Ï¥ÎªÌ¥iµø¬É­±¨Ó»¡
  2. ´Nª«¥óªº«Å§i¨Ó»¡
  3. ´N°õ¦æ´Á°ÊºA²£¥Íª«¥ó¨Ó»¡

¦^¯Á¤Þ


¦p¦ó§âµP¬~´²¬~¶Ã


¬~µPªº³]­p¼Ò«¬¡G

¨ä¹ê§âµP¬~´²¶}¨Ó¡A¬O¦³¥¦ªº¬~µP¼Ò«¬¦bªº¡A¾Ú¦Ñ©Ç©Ò·Q¨ìªº´N¦³¤U¦C´XºØ¡G

  1. .ÀH¾÷½Õ´«ªk¡G

    ¥i¥H·Q¹³¦¨ n ±iµP¤@¦r±Æ¶}¡A¥ô¨ú¨â±i¤¬´«¡A´«·U¦h¦¸µP·U¶Ã¡C

  2. .ÀH¾÷±Æ¦Cªk¡G

    ¥i¥H·Q¹³¦¨ n ±iµP´N¦³ n ­Ó¦ì¸m¡A¦Ó©Ò¦³ªºµP³£©ñ¦b¥t­Ó½c¤lùØ¡A¬~µP®É³v¤@¥ÑµP½c¤¤ÀH¾÷©â¥X¤@±i©ñ¦b¦ì¸m¤W¡A¨C¤@±iµP¤@©w·|³Q©â¨ì¤@¦¸¡A¦Ó¥B¥u·|³Q©â¨ì¤@¦¸¡A©âµP¦¸¼Æ´N¬OµP±i¼Æ¡C

  3. .¤ÁµP¼ÒÀÀªk¡G³o¬O¼ÒÀÀ¥´ Poker ®É¤HÃþªº¹ê»Ú¬~µP¤è¦¡¡A´N¬O©Ò¦³µP¤À¨â°ï¡A¥Î¶Ã¼Æ¨ú¶¡¹j¼Æ¡AµM«á¨Ì¶¡¹j¼Æ§â¨âÅ|µP´¡¦b¤@°_¡A´¡·U¦h¦¸µP·U¶Ã¡C

¬~µPªº³]­p¹ê¨Ò¡G

¤U­±¬O§Ú¥Î 2.ÀH¾÷±Æ¦Cªk©Ò¼g VB Code¡A½Ð²³®a°ª¤â«ü±Ð¡G

Option Explicit

'«Å§i¼³§JµP¥|­Óªá¦âªº±`¼Æ
Const CardSpear As Integer = 0
Const CardHeart As Integer = 1
Const CardDimond As Integer = 2
Const CardClub As Integer = 3

'«Å§i¤@­Ó¦s©ñ¼³§JµPªá¦â¡BÂI¼Æªº¦Û­qÅܼƫ¬ºA
Private Type GameCard
    '¼³§JµPªá¦â
    CardColor As Integer
    '¼³§JµPÂI¼Æ
    CardNum As Integer
End Type

'«Å§i¦s©ñ 52 ±i¼³§JµPªºÅܼÆ
Private Poker(51) As GameCard

Private Sub Command1_Click()
'I,J,K ¬Ò°µ¬°°j°é­p¼Æ¾¹¨Ï¥Î
Dim I As Long, J As Integer, K As Integer
'TempCard ¥Î¬°µP¸ê®Æ¤á´«ªº¼È¦s°Ï¡ARndRec Àx¦s¶Ã¼Æ­È¡C
Dim TempCard As GameCard, RndRec As Long
'§âªá¦â¥Nªí¼Æ´«¦^¦r¦êªº¼È¦sÅܼÆ
Dim ColorWord As String

    '±Ò°Ê¶Ã¼ÆºØ¤l
    Randomize

    '§â¦Uªá¦âµP¸Ë¶i Poker °}¦CùØ
    For J = 0 To 3
        For K = 1 To 13
            '¯Âºé¨¾¤î Poker ·¸¦ì¦Ó¤w¡A¦pªG§A½T©w¦Û¤v
            '­pºâµL»~¡A¥i¥H®³±¼³o­Ó§PÂ_¦¡
            If I > UBound(Poker) Then
                Exit For
            End If

            Poker(I).CardColor = J
            Poker(I).CardNum = K

            I = I + 1

        Next
    Next

    '¶}©l¥Î¶Ã¼Æ¬~µP¡A°ò¥»ªº³]­p­ì²z¬O°²³]¼³§J¬O©ñ¦b©â¨ú½cùØ¡A
    '­nµoµP®É¦A¤@±i±i¥Ñ½c¤¤ÀH¾÷©â¥X¡A¨Ì§Ç±Æ¦n¡A¯S¦â¬O½c¤¤©Ò¦³
    'ªºµP³£³Q©â¨ì¤@¦¸¡A¦Ó¥B¥u·|³Q©â¨ì¤@¦¸¡C
    For I = UBound(Poker) To 1 Step -1
        '¨ú¤@­Ó¾ã¼Æ¶Ã¼Æ¨Ó©â¤@±iµP
        RndRec = Int((I + 1) * Rnd)

        '§â¿ï¨ìªºµPªá¦â¤ÎÂI¼Æ¸ê®Æ¥æµ¹ TempCard
        TempCard.CardColor = Poker(RndRec).CardColor
        TempCard.CardNum = Poker(RndRec).CardNum

        '§â²Ä I ±iµPªº¸ê®Æ²¾¨ì¿ï¨ìªºµP¤W
        Poker(RndRec).CardColor = Poker(I).CardColor
        Poker(RndRec).CardNum = Poker(I).CardNum

        '§â TempCard ùتº¸ê®Æ²¾¨ì²Ä I ±iµP¤W
        Poker(I).CardColor = TempCard.CardColor
        Poker(I).CardNum = TempCard.CardNum
    Next

    '§â±Æ¦nªº Poker Åã¥Ü¤@¤U
    List1.Clear

    For I = 0 To UBound(Poker)
        Select Case Poker(I).CardColor
            Case CardSpear
                ColorWord = "Spear\"
            Case CardHeart
                ColorWord = "Heart\"
            Case CardDimond
                ColorWord = "Dimond\"
            Case CardClub
                ColorWord = "Club\"
        End Select

        List1.AddItem ColorWord & Poker(I).CardNum

        DoEvents

    Next

End Sub

¦^¯Á¤Þ


¼Æ¦r©Î¦r¥À§PÂ_


Â÷ ·T ¼¶¼g©ó¤å³¹ ...

½Ð°Ý§â¨Ï¥ÎªÌ©Ò¿é¤Jªº¤@¦ê¤å¦r,¦U§O©î¶}«á...¸Ó¦p¦ó §PÂ_­Ó§O¦r¥À¬O§_¬°¼Æ¦r©Î¦r¥À°Ú?!

¦Ñ©Çµª¡G

½Ð§Q¥Î IsNumeric ¨ç¼Æ¡A¨Ã°Ñ¦Ò¤U­± Vb Code

Dim I As Long, ShortString As String

    For I = 1 To Len(Text1.Text)
        ShortString = Mid(Text1.Text, I, 1)

        Debug.Print "[" & ShortString & "]" & _
            IIf(IsNumeric(ShortString), "¬O", "¤£¬O") & _
            "¼Æ¦r¦r¦ê"
    Next

¦^¯Á¤Þ


¬ð¯} TextBox 32 K ªº­­¨î


mason ¼¶¼g©ó¤å³¹

¦bVisual Basic¤¤,TextBox©Ò¯àÅã¥ÜªºText¥u¦³32K Bytes,­Y­n¦P®ÉÅã¥Ü 32K BytesªºText®É,­n¦p¦ó¸Ñ¨M???

¦Ñ©Çµª¡G

  1. «Å§i¤@­Ó As String ªº°ÊºA°}¦CÅܼƦp Dim LargeText as string
  2. LargeText="§A¶W¹L 32 K ªº¦r¦ê"
  3. Åã¥Ü 32K Bytes ¥H¤º¸ê®Æ®É¡Atext1.text=mid(largetext,1,32000)¡C
  4. ·í­nÅã¥Ü¶W¹L 32K Bytes ¥H¥~ªº¸ê®Æ®É¡Atext1.text=mid(largetext,32000,32000)¡C

¦^¯Á¤Þ


¦r¥ÀÂন´`§Ç¼Æ¦r


Â÷ ·T ¼¶¼g©ó¤å³¹ ...

½Ð±Ð¥ý¶i...¦p¦óÅý¨Ï¥ÎªÌ¿é¤Jªº¦r¤¸"A"Âন10,"B"Âন11, "C"Âন12....µ¥...¨Ì¦¹Ãþ±À©O?!

¦Ñ©Çµª¡G

¥Î asc() ¨ç¼Æ°µ§PÂ_¡G
dim yourword as string*1
dim yourcode as integer

yourword="§A¿é¤Jªº¤@­Ó¦r¤¸"

if asc(yourword)>=asc("A") and asc(yourword)<= asc("Z")
    yourcode=asc(yourword)-asc("A")+10
end if

debug.print yourcode

¦^¯Á¤Þ


¥H Code §R°£¦r¦ê


§Ú¤£¬O°¨©Ô«×¯Ç ªº¤å³¹¤¤´£¨ì:

¦³¨S¦³¨ç¼Æ¬O¥i¥H§R°£¿é¤Jªº¤W¤@­Ó¦r¤¸???(´N¹³«ö¤UBack Space¤@¼Ë)

¦Ñ©Çµª¡G

¨Ï¥Î Sendkeys ³¯­z¦¡¡A¦p¤U¡G
'Åý text1 ¨ú±oµJÂI¡A¥H«K±µ¦¬Áä½L¦r¤¸¡C
text1.setfocus
'¼ÒÀÀ¨Ï¥ÎªÌ«ö¤U backspace «öÁä
sendkeys "{Backspace}"

¦^¯Á¤Þ


TextBox.Text ªº¥þ¿ï¥\¯à


²y²y ¼¶¼g©ó¤å³¹

¦b¤å¦r®Ø§Ö³t«ö·Æ¹«¨â¤U, ¨t²Î´N·|¦Û°Ê®Ø¿ï¤å¦r®Ø¤º©Ò¦³ªº¤å¦r,­Y§Æ±æÂI«ö¤@¤U´N¯à¦Û°Ê®Ø¿ï¤å¦r®Ø¤º©Ò¦³ªº¤å¦r, µ{¦¡­n¦p¦ó¼g©O?

¦Ñ©Çµª¡G

Private Sub Text1_Click()
    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
End Sub

¦^¯Á¤Þ


°O¨Æ¥»½s¿è¥\¯à¼ÒÀÀ


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

½Ð°Ý¦pªG·Q­nVB 5.0¨Ó¼g¤@­Ó°O¨Æ¥»..¦Ó¸Ì­±ªº½Æ»s¡B¶K¤W­n¦p¦ó¼g©O...

¦Ñ©Çµª¡G

­n¨Ï¥Î ClipBoard ª«¥ó¨Ó¹F¦¨¡C

'½Æ»s
Private Sub mnuCopy_Click()
    Clipboard.SetText Text1.SelText
End Sub

'°Å¤U
Private Sub mnuCut_Click()
    Clipboard.SetText Text1.SelText
    Text1.SelText = ""
End Sub

'¶K¤W
Private Sub mnuPaste_Click()
    Text1.SelText = Clipboard.GetText
End Sub

'¥þ¿ï
Private Sub mnuAll_Click()
    Text1.SetFocus
    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
     Clipboard.SetText Text1.SelText
End Sub

¦^¯Á¤Þ


¦^­º­¶

1