我有BCB代码,你要吗?如果需要,给我发email。

解决方案 »

  1.   

    有没有delphi的如果没有bcb的也可以。能不能先贴一点看看,行的话就马上给分。
      

  2.   

    你响应的消息不对,应该是WM_MEASUREITEM和WM_DRAWITEM.变高亮是因为还是WINDOWS在帮你画,没自画.下面是我的VB代码
    Case WM_MEASUREITEM
            If wParam = 0 Then  'if the message is send by the OwnerDrawMenu
                Dim a As Long
                    a = 128         'fill the itemWidth
                    CopyMemory ByVal VarPtr(lParam) + 12, a, 4
                    a = 35         'fill the itemHeight
                    CopyMemory ByVal VarPtr(lParam) + 16, a, 4
                Exit Function
            End If          'if wParam=0Case WM_DRAWITEM
            If wParam = 0 Then  'if the message send by OwnDrawMenu
                'let myMenuStruct remember the DRAWITEMSTRUCT
                CopyMemory myMenuStruct, lParam, 48
                    If myMenuStruct.itemID = 2 Then
                    Select Case myMenuStruct.itemState
                    Case ODS_SELECTED   'Menu selected
                        strMenuTitle = "Open Data "
                        DrawHilight strMenuTitle, HilightOpenData
                        Exit Function
    ...........
    Sub DrawHilight(str As String, myIcon As Picture)
        Dim hdcMem As Long
        Dim OldBitmap As Long
    With myMenuStruct
        hdcMem = CreateCompatibleDC(0&)
        OldBitmap = SelectObject(hdcMem, myIcon.Handle)
        Call BitBlt(.hDC, .rcItem.Left, .rcItem.Top, 140, 35, hdcMem, 0, 0, SRCCOPY)
        Call SelectObject(hdcMem, OldBitmap)
        Call DeleteObject(OldBitmap)
    End With
    End Sub
      

  3.   

    我有BCB代码,你要吗?如果需要,给我发email。
      

  4.   

    程序员大本营2000有的是一个控件,我不要控件,我要用程序来实现,smartmachine的程序是对的这我在些朋友用vc作也是相同的方法来实现的。但的delphi中的方法不太一样,如果用你的方法,那就要自己来接管消息。在delphi中有drawitem和measureitem事件可是没有提供自画属性修改的方法。在delphi 5中有一个advancdrawitem用来补充drawitem没有自画属性缺点。可在delphi 4中如何实现?
      

  5.   

    我终于解决了,原来我字体的颜色没有在drawitem中指定,一但指定后不再出现字会变成高亮的情况了。谢谢大家!现在给分见者有份。
      

  6.   

    Dear ftnet!我来的太晚了,你的问题也是我一直在想的,你能不能
    给我一份源码,不胜感激!To Email: [email protected]
      

  7.   

    Dear ftnet!我来的太晚了,你的问题也是我一直在想的,你能不能
    给我一份源码,不胜感激!To Email: [email protected]