Win32: How to custom draw an Edit control?

后端 未结 5 1504
面向向阳花
面向向阳花 2020-12-11 02:41

i need to implement the functionality of EM_SETCUEBANNER, where a text hint appears inside an Edit control:

\"Ex

5条回答
  •  感情败类
    2020-12-11 02:54

    And I also need to find a way to display the caret in the control, since I haven't found a way to allow Windows to do that for me without also painting the white bar I mentioned.

    If you want to handle WM_PAINT by yourself without forwarding the message to the original windowproc of your superclass, you should not forget to call DefWindowProc. So that the caret will be drawn. To avoid the white bar you should remove class brush with SetClassLongPtr. And somehow keep your DC's clipping region to clip Edit controt's ExtTextOut outputs. The white bar may be the result of OPAQUE option passed to ExtTextOut by Edit control.

    Conclusion: Write your own control. No pain, no gain.

提交回复
热议问题