我想在ComboBox的非下拉列表框的位置作图(也就是高度位于下拉箭头的那个类似于EDIT的框内作图)。
可是每次画出来的东西都被系统自己画的那个EDIT框给抹掉了。
不知道有什么方法可以在这个位置作图!
谢谢!

解决方案 »

  1.   

    哈哈哈!欧已经搞定了。
    Application developers do not need to implement IAccessible to expose the items in an owner-drawn combo box that has the style CBS_HASSTRINGS because Active Accessibility exposes the items in combo boxes with this style. The items in an owner-drawn combo box with the CBS_HASSTRINGS style are displayed as text. However, this style is also used with owner-drawn combo boxes that do not display text so that the combo box items are exposed by Active Accessibility.To allow Active Accessibility to expose the items in an owner-drawn combo box that does not display text: Use the CBS_HASSTRINGS style when creating the combo box. 
    Create a textual counterpart that names or describes each item in the combo box. 
    When adding items to the owner-drawn combo box, use the CB_ADDSTRING message to add the text that you want Active Accessibility to expose. This text is not displayed, so it must not be part of the owner-drawn data. Add the owner-drawn item data using the CB_SETITEMDATA message. 
    When using the above method, note the following: If you use the CBS_SORT style, the combo box is sorted using the supplied strings and not the WM_COMPAREITEM callback procedure. 
    With owner-drawn variable combo boxes created with the style CBS_OWNERDRAWVARIABLE, use a global variable or some other mechanism to keep track of when the itemData member of the MEASUREITEMSTRUCT is valid. The global variable is required because the system sends the WM_MEASUREITEM message as soon as the string is added but before the item data is attached, and at this point the itemData member is not valid. 
    To change the string for an item in a combo box with the CBS_HASSTRINGS style, delete the item with the CB_DELETESTRING message and add the new string with the CB_ADDSTRING message. 可不可以给自己加分呀!
    呵呵!
      

  2.   

    既然是combobox自己有个子Edit.
    那么你应该在这个Edit上画图才对。
    因为这个Edit拿combobox来当容器。而edit有自己的onpaint处理。
    要不然就自己继承一个Edit,在这个edit里画上图。来代替combobox里的Edit.