NassauSky Posted March 19, 2024 Posted March 19, 2024 #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $hGUI, $hRichEdit $hGUI = GUICreate("Rich Edit Example", 400, 300) $hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 10, 10, 380, 280, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL, $ES_AUTOHSCROLL)) _GUICtrlRichEdit_SetText($hRichEdit, "Line 1" & @CRLF & _ "Line 2" & @CRLF & _ "Line 3" & @CRLF & _ "Line 4" & @CRLF & _ "Line 5" & @CRLF & _ "Line 6") _GUICtrlRichEdit_SetSel($hRichEdit, 0, 6) ; Select the entire text to start _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "+bo") _GUICtrlRichEdit_SetFont($hRichEdit, 12, "Comic Sans MS") _GUICtrlRichEdit_SetParaShading($hRichEdit, 100) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Seems like the _GUICtrlRichEdit_SetParaShading 2nd parameter is weight but maybe I'm implementing it wrong since it doesn't seem to do anything as I increase or decrease the value.
Nine Posted March 19, 2024 Posted March 19, 2024 Try : _GUICtrlRichEdit_SetSel($hRichEdit, 0, -1) ; Select the entire text to start “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
NassauSky Posted March 19, 2024 Author Posted March 19, 2024 (edited) Thanks @Nine To be clear, I am trying to just highlight and thicken the string on line 1 for now which is from char position 0 to 6. Two strange things I've noticed since playing with this richedit control. 1) Even though the character "1" is the 5th character on that line I need to use 6 as the end position to include it in my selection. 2) The function _GUICtrlRichEdit_SetParaShading doesnt seem to be adjusting the weight nor changing the foreground or background color of the selection. Strange. Edited March 19, 2024 by NassauSky
Nine Posted March 19, 2024 Posted March 19, 2024 (edited) Sorry, I got fooled by the comment on that line. 1. Help file and MSDN are not making it very clear. But I believe it is based on position of character and not character itself. One thing is clear though : Quote If the cpMin and cpMax members are equal, the range is empty So character position before 1st char is 0, and character position after 5th char is 6. I image like bars that are embedding the string, do you see that. 2. _GUICtrlRichEdit_SetParaShading is not working me either (example does not work also). I will need to invest more time to understand the issue. edit : help file says "Shading does not show in Rich Edit, but shading created here will show in Word" reedit : You will need to use EM_SETCHARFORMAT message with the $tagCHARFORMAT2. The wWeight member is what you are looking for Edited March 19, 2024 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now