Closed Ahmad45123 closed 8 years ago
I'm a little unclear on what you mean by "clear the style from only a specific region of code"... but take a look at the HotspotClick
and HotspotReleaseClick
events to see if that helps.
Ik that, I want to remove the hotspot styling when the mouse moves away.. but I can't find something like RemoveStyling
or ``
Oops
Could you be looking for Scintilla.Colorize
?
No lol, Is it really that complex ? xD I just did it without any on runtime colorzing and without the hotspots xD But if I got it working right, I will defo add it. https://github.com/JohnyMac/ExtremeStudio/blob/e81095abe5268241bae263d950aae89e17cc5dfb/ExtremeStudio/DockPanel%20Forms/MainForm%20Docks/EditorDock/EditorDock.vb#L746-L859
Look, How do I make hotspots ? I just make a custom styling with .Hotspot
set to true, right ? It doesn't work :/
Sorry dude... I guess I didn't understand the question...
You would use hotspots like this. Assume I'm using the VB lexer and I want all comments to be clickable hotspots, I would set up my styles like this (in addition to what is normally needed to set up lexers and styles):
scintilla.Styles[Style.Vb.Comment].Hotspot = true;
Then handle one of the hotspot click events such as this:
private void scintilla_HotspotReleaseClick(object sender, HotspotClickEventArgs e)
{
var startPos = scintilla.WordStartPosition(e.Position, true);
var endPos = scintilla.WordEndPosition(e.Position, true);
var text = scintilla.GetTextRange(startPos, endPos - startPos);
if (!string.IsNullOrEmpty(text))
{
MessageBox.Show(text);
}
}
Okay, that worked, I got an idea for it, Thanks.
I am trying to make something like CTRL+Click to navigate to functions declaration just like VS.
I have done this:
However, The hotspot styling doesn't appear.. I think its just because that place is already styled.. So, if thats correct, How to clear the style from only a specific region of code ?
After that, I want to clear the hotspot styling when the mouse go away from it.. Sooo, Any idea how I can do this ? :/