As an alternative you can use a tRichEdit with WantReturns=False. A standard tEdit does not have support for custom drawing or having text with multiple colors. Procedure TEdit.WndProc(var Message: TMessage) ĬM_MOUSEENTER, CM_MOUSELEAVE, WM_LBUTTONUP, WM_LBUTTONDOWN, Procedure TEdit.WMPaint(var Message: TWMPaint) ĬontrolState := ControlState+ ĬontrolState := ControlState. Procedure PaintWindow(DC: HDC) override Ĭonstructor Create(AOwner: TComponent) override Ĭonstructor TEdit.Create(AOwner: TComponent) ĭrawText(Canvas.Handle, PChar(S), -1, R, DT_LEFT or DT_NOPREFIX orĭT_WORDBREAK or DrawTextBiDiModeFlagsReadingOnly) Procedure WndProc(var Message: TMessage) override Procedure WMPaint(var Message: TWMPaint) message WM_PAINT Here is a code sample using an interposer class (still needs to implement selection but the custom drawing works when the caret is in the control): type I was also interested to find out how deep the rabbit hole goes, so, However, it doesn't work for edit controls and with regards to the list control, it works only for report-view style Note that owner-draw will work for most controls. From the docs: Developing Custom Draw Controls in Visual C++: It's doable, but it would be a world of pain to actually implement 100% correctly. Edit controls do not have owner-draw support, but you can custom-draw it by sub-classing it and handling WM_PAINT (among many other messages).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |