Jump to content

Any solution for flashing RichEdit scrollbar?


qwert
 Share

Recommended Posts

On several GUIs, I've used RichEdit controls with the $WS_EX_TRANSPARENT style so that they don't have the normal border and just fit in, better.  It works, mostly, but I always notice a flashing in the vertical scroll bar.  The script below shows the effect.  If you swap the _Create lines, you can see the normal control work properly.

;
;       Flashing scroll bar when using $WS_EX_TRANSPARENT
;
#include <WindowsConstants.au3>
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>

$text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " & _
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in " & _
"reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, " & _
"sunt in culpa qui officia deserunt mollit anim id est laborum."

$hGUI = GUICreate("Scroll Transparent", 400, 480, -1, -1, -1)
GUISetBkColor(0xFFFFFF)

$hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 20, 30, 362, 412, BitOR($ES_MULTILINE, $WS_VSCROLL), $WS_EX_TRANSPARENT)
;$hRichEdit = _GUICtrlRichEdit_Create($panel, "", 20, 30, 362, 412, BitOR($ES_MULTILINE, $WS_VSCROLL)) ; << this works properly

_GUICtrlRichEdit_SetText($hRichEdit, $text)
_GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & @CRLF & $text)
_GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & @CRLF & $text)

_GUICtrlRichEdit_SetSel($hRichEdit, 0, -1)                          ; select all
_GUICtrlRichEdit_SetFont($hRichEdit, 14, "Arial")                   ; set font
_GUICtrlRichEdit_SetSel($hRichEdit, 0, 0)                           ; set cursor to start

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Would anyone happen to know what's causing the flash effect?

Or is there a better way to define a borderless RichEdit control?  (My first-look impression is that there might be ways to alter the styles in the _WinAPI_CreateWindowEx statement in GUIRichEdit.au3.  Has anyone tried such a thing?)

Thanks in advance for any help.

 

 

 

Link to comment
Share on other sites

If you just want a RichEdit window without borders, you can do it this way:

;$hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 20, 30, 362, 412, BitOR($ES_MULTILINE, $WS_VSCROLL), $WS_EX_TRANSPARENT)
$hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 20, 30, 362, 412, BitOR($ES_MULTILINE, $WS_VSCROLL)) ; << this works properly
$iExStyte = _WinAPI_GetWindowLong( $hRichEdit, $GWL_EXSTYLE ) - $WS_EX_CLIENTEDGE
_WinAPI_SetWindowLong( $hRichEdit, $GWL_EXSTYLE, $iExStyte )

 

Link to comment
Share on other sites

Thank you for that method.  It gives a perfect result.  I had no idea it was that easy to "deduct" a standard style.  I was under the impression that styles had to be defined, initially ... "from the ground, up".

I appreciate your help.

 

Rich Without Borders.PNG

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...