Mam taką właśnie kontrolkę z zaznaczonym stylem multiline. Wpisuję do niej jakiś tekst w kilku linijkach. Jak spowodować podświetlenie którejś z tych linijek? :>
CRichEditCtrl ::
void SetSel( long nStartChar, long nEndChar );
Parameters
nStartChar
Zero-based index of the first character for the selection.
nEndChar
Zero-based index of the last character for the selection.
MSDN
Prawie. Raczej to powinna byc funkcja z klasy CEdit
CEdit:
void SetSel(
DWORD dwSelection,
BOOL bNoScroll = FALSE
);
void SetSel(
int nStartChar,
int nEndChar,
BOOL bNoScroll = FALSE
);
Ewentualnie mozna skorzystac z EM_SETSEL z PlatformSDK:
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) EM_SETSEL, // message ID
(WPARAM) wParam, // = (WPARAM) () wParam;
(LPARAM) lParam // = (LPARAM) () lParam;
);
wParam
Specifies the starting character position of the selection.
lParam
Specifies the ending character position of the selection.
Przyklad:
// The pointer to my edit.
extern CEdit* pmyEdit;
// Set the selection to be all characters after the current selection.
DWORD dwSel = pmyEdit->GetSel();
pmyEdit->SetSel(HIWORD(dwSel), -1);
witam !,
mam podobny problem, uzywam MFC,
zaznaczanie funkcjonuje wypas,
funkcjami SetSel(...) i Copy(), Paste().
Moge zaznaczac, kopiowac do bufora, etc.
Niestety na kontrolce tego nie widac.
Co zrobic, aby ten zaznaczony tekst podswietlic tudziez zamarkowac?
czy sa do tego jakies specjalne funkcje, w MSDN'ie nic nie znalazlem,
googlowanie tez nic nie daje.
Moze powinienem uzyc innego stylu?
(aktualnie:
ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_HSCROLL | WS_VSCROLL)
Z gory dziekuje
ok, problem sie juz rozwiazal:
zapomnialem dodac stylu ES_NOHIDESEL...