VB ActiveX ¨Ï¥Î¤èªk(¤T)

¦^­º­¶


¤ÀÃþ

¼ÐÃD

¤j·N

§@ªÌ

¤é´Á

MsFlexGrid ¦X¨ÖÀx¦s®æ MergeCells Äݩʪº¨Ï¥Î ¦Ñ©Ç 1999/6/13
MsFlexGrid ¦p¦óÁôÂÃÄæ¦ì ­Ý½× ColIsVisible ÄÝ©Ê ¦Ñ©Ç 1999/6/15
MsFlexGrid ¦p¦ó±oª¾§Ú Click ¨º­Ó Cell RowColChange ³qª¾ ¦Ñ©Ç 1999/6/16
MsFlexGrid ¦C¦L©Ò¦³ Cell ªº¤º®e TextMatrix ÄÝ©Ê ¦Ñ©Ç 1999/6/23
MsComm ¦p¦ó¤£°±ªº ReCheck ¿é¤J°Ï ¨Ï¥Î Timer ±±¥ó ¦Ñ©Ç 1999/6/15

¦X¨ÖÀx¦s®æ


'½d¨Ò¥\¯à¡GÀx¦s®æ¦X¨Ö
'´ú¸Õ¥»½d¨Ò½Ð©óªí³æ¨B¸m MsFlexGrid1¡BCommand1,2
Option Explicit
Private Sub Command1_Click()
    '¨S¦³¥ô¦ó¦X¨Ö
    MSFlexGrid1.MergeCells = 0
    MSFlexGrid1.MergeCol(0) = True
    MSFlexGrid1.MergeCol(1) = True
    MSFlexGrid1.MergeCol(2) = True
    MSFlexGrid1.MergeCol(3) = False
End Sub
Private Sub Command2_Click()
    '¦Û¥Ñ¦X¨Ö¼Ò¦¡
    MSFlexGrid1.MergeCells = 1
    MSFlexGrid1.MergeCol(0) = True
    MSFlexGrid1.MergeCol(1) = True
    MSFlexGrid1.MergeCol(2) = True
    MSFlexGrid1.MergeCol(3) = False
End Sub
Private Sub Form_Load()
Dim AddString As String
    Command1.Caption = "Àx¦s®æ¤£¨Ö"
    Command2.Caption = "Àx¦s®æ¦X¨Ö"

    MSFlexGrid1.Cols = 4
    MSFlexGrid1.Rows = 0

    AddString = "A" & Chr(9) & "Ap" & Chr(9) & "Aplle" & Chr(9) & "Good"
    MSFlexGrid1.AddItem AddString
    AddString = "A" & Chr(9) & "Ap" & Chr(9) & "Aplle" & Chr(9) & "Bad"
    MSFlexGrid1.AddItem AddString
    AddString = "A" & Chr(9) & "As" & Chr(9) & "Access" & Chr(9) & "Hard"
    MSFlexGrid1.AddItem AddString
    AddString = "B" & Chr(9) & "Bc" & Chr(9) & "BCB Builder" & Chr(9) & "Too
Hard"
    MSFlexGrid1.AddItem AddString
    AddString = "B" & Chr(9) & "Bi" & Chr(9) & "Bill" & Chr(9) & "Hurt"
    MSFlexGrid1.AddItem AddString
End Sub

¦^¯Á¤Þ


¦p¦óÁôÂÃÄæ¦ì


vespa ¼¶¼g©ó¤å³¹

MSHFlexGrid.ColIsVisible(index)¡A¨äindex­n¦p¦ó¥Î¡A¥¦ªº«¬ºA¬OLong¡A¦p§Ú³]MSHFlexGrid.ColIsVisible(1)  run®É·|§i¶D§Ú¡§¤£¥i«ü©w¦Ü±`¼Æ¡§¡A½Ð°Ý­n¦p¦ó³]¡H

¦Ñ©Çµª¡G

  1. ®£©È§A»~¸Ñ¤F MSHFlexGrid.ColIsVisible Äݩʪº§t·N¡A¥L©M¤@¯ë¨ä¥Lª«¥óªº Visible Äݩʤ£¤@¼Ë¡A©Ò¿×ªº ColIsVisible ¬O«ü¦pªG MSHFlexGrid ªºÁ`Äæ¦ì¼e«×¤j©ó¥LªºÅã¥Üµ¡®æ¡A¨º¸Ó Col(Index) ¬O¦bÅã¥Üµ¡®æ¤ºÁÙ¬O¦bÅã¥Üµ¡®æ¥~ªºÀˬd¼Ð°O¡A¤]´N¬O»¡¥¦¬O°ßŪ¦Ó¤£¯à¥Ñµ{³]®v³]©wªº¡C
  2. ¦¹¥~ MsFlexGrid ¤]¤£¹³ DBGrid ¦³ Column.Visible ÄÝ©Ê¡A©Ò¥H¥¦¨S¿ìªk Hide ¡A°ß¤@Åý¥¦¬Ý¤£¨£ªº¤èªk¬OÅýMsFlexGrid.ColWidth(Index)=0¡C
  3. §A¥[¤j MsFlexGrid.Cols ¼Æ¥Ø¡A¨Ï¥¦Åã¥Üµ¡®æµLªk§¹¥þÅã¥Ü¡AµM«á¶K¤J¤U­±³o¬q¡G
    Private Sub MSFlexGrid1_Scroll()
        Debug.Print MSFlexGrid1.ColIsVisible(MSFlexGrid1.Cols - 1)
    End Sub
    µM«á¥ª¥k©Ô¥Lªº±²°Ê¶b¡A§A´N¥i¬Ý¶¡ Debug µøµ¡ùØ®É¦Ó True ¡A®É¦Ó False¡C

¦^¯Á¤Þ


¦p¦ó¤£°±ªº ReCheck ¿é¤J°Ï


Private Sub Timer1_Timer()
    If MSComm1.InBufferCount >= 1 Then
        GotMessage
    End If
End Sub

Private Sub GotMessage()
Dim InString as String

    '¼È°± MsComm1 ¼È¦s°Ï¬d®Ö
    Timer.Enable=False

    ' Ū¨ú©Ò¦³¥i¥Î¸ê®Æ.
    MSComm1.InputLen = 0
    ' Read data.
    InString = MSComm1.Input
    Text1.Text=Text1.Text & InString
    Text1.SelStart=(Len(Text1.Text))

    '«ì´_ MsComm1 ¼È¦s°Ï¬d®Ö
    Timer.Enable=True
End Sub

¦^¯Á¤Þ


¦p¦ó±oª¾§Ú Click ¨º­Ó Cell


¤W¯Z±Ú(¤k) ¼¶¼g©ó¤å³¹

½Ð°Ý­Y§Ú­nÅý¬Y¤@¦CªºÄæ°ª¥[¤j(¦brun time®É)¡A­n«ç±oª¾¬Y­Ó®æ¤l³Qclick¤F¡H

¦Ñ©Çµª¡G

Private Sub MSFlexGrid1_RowColChange()
Debug.Print "Col=" & MSFlexGrid1.Col & "/Row=" & MSFlexGrid1.Row
End Sub

¦^¯Á¤Þ


¦C¦L©Ò¦³ Cell ªº¤º®e


Private Sub Command1_Click()
Dim I As Long, J As Long
Dim PrintString As String
    For I = 0 To MSFlexGrid1.Rows - 1
        PrintString = ""
        For J = 0 To MSFlexGrid1.Cols - 1
            PrintString = PrintString & MSFlexGrid1.TextMatrix(I, J) & "/"
        Next
        Printer.Print PrintString
    Next
    Printer.EndDoc
End Sub

¦^¯Á¤Þ


¦^­º­¶

1