有“复选框”这个属性,可以点右键设置!
第二个问题在VB下无法解决,这就是VB的悲哀。谢谢给分。!!  :p

解决方案 »

  1.   

    回复人: xsf1(温州) (  ) 信誉:100  2002-04-28 08:44:00  得分:0  
     
     
      “复选框”只有在第一列中才有
    第二句的意思是标题栏和数据项的外观一样,一般标题栏的外观是突出的!
    ====================================================================
    是不是指标题栏是平面的?
      

  2.   

    如果是突出的:Listview1.View=lvwReport
      

  3.   

    将立体的ListView标题栏转换成平面式的标题栏 当你想将你的ListView控件的标题栏变为平面式且对鼠标单击不做出反应的话,就 
    试试下面的代码吧。通常立体的标题栏会让用户认为这一栏的数据可以排序。如果 
    改成平面式的,用户就不会这样想了。 Private Declare Function GetWindowLong Lib "user32" Alias " 
    GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias " 
    SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal 
    dwNewLong As Long) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( 
    ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As 
    Any) As Long Private Const GWL_STYLE = (-16) 
    Private Const LVM_FIRST = &H1000 
    Private Const LVM_GETHEADER = (LVM_FIRST + 31) 
    Private Const HDS_BUTTONS = &H2 Call ToggleHeader(ListView1.hWnd) Private Sub ToggleHeader(lsvhWnd As Long) Dim hHeader As Long, lStyle As Long hHeader = SendMessage(lsvhWnd, LVM_GETHEADER, 0, ByVal 0&) lStyle = GetWindowLong(hHeader, GWL_STYLE) SetWindowLong hHeader, GWL_STYLE, lStyle Xor HDS_BUTTONS End Sub
      

  4.   

    如果要平板式Header:Const SWP_DRAWFRAME = &H20
    Const SWP_NOMOVE = &H2
    Const SWP_NOSIZE = &H1
    Const SWP_NOZORDER = &H4
    Public Const SWP_FLAGS = SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_DRAWFRAME
    Public Declare Function SetWindowPos Lib "user32" _
       (ByVal hwnd As Long, _
        ByVal hWndInsertAfter As Long, _
        ByVal x As Long, ByVal Y As Long, _
        ByVal cx As Long, ByVal cy As Long, _
        ByVal wFlags As Long _
        ) As LongPublic Const HDS_BUTTONS = &H2
    Public Const LVM_GETHEADER = (LVM_FIRST + 31)
    Public Const GWL_STYLE = (-16)Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
       (ByVal hwnd As Long, _
        ByVal Msg As Long, _
        ByVal wParam As Long, _
        ByVal lParam As Long _
        ) As LongSub SetFlatHead()
         Dim r As Long
         Dim style As Long
         Dim hHeader As Long
        'get the handle to the listview header
         hHeader = SendMessageLong(ListView1.hwnd, LVM_GETHEADER, 0, ByVal 0&)
        'get the current style attributes for the header
         style = GetWindowLong(hHeader, GWL_STYLE)
        'modify the style by toggling the HDS_BUTTONS style
         style = style Xor HDS_BUTTONS     'set the new style and redraw the listview
         If style Then
             r = SetWindowLong(hHeader, GWL_STYLE, style)
             r = SetWindowPos(ListView1.hwnd, Form1.hwnd, 0, 0, 0, 0, SWP_FLAGS)
         End If
    End Sub
      

  5.   

    对于第一个问题
    估计只有通过自画ListView来解决了
    但是我还没见过自画ListView
    不能帮你了
      

  6.   

    在listview控件中的任意一列中添加复选框(checkbox)不行吧,你得自己做一个控件