jacobslusser / ScintillaNET

A Windows Forms control, wrapper, and bindings for the Scintilla text editor.
MIT License
963 stars 243 forks source link

darkmode #463

Closed MaticBabnik closed 2 years ago

MaticBabnik commented 5 years ago

Can't set MarginType.Symbol; back color. Also any way to make dark mode scrollbars.

xv commented 5 years ago

Use margin.Type = MarginType.Color if you want a margin that display symbols with a specific background color. Then you can set the color with margin.BackColor = Color.Whatever;

The scrollbar color/style is determined by the operating system and cannot be changed.

MaticBabnik commented 5 years ago

Only works if mask isnt set to maskall. makes it kinda useless

viebrix commented 4 years ago

@MaticBabnik You can disable Scrollbars in ScintillaNET and add own custom scrollbar controls.

Editor.VScrollBar = false;
Editor.HScrollBar = false;
Editor.UpdateUI += new System.EventHandler<ScintillaNET.UpdateUIEventArgs>(editor_UpdateUI);

vscrollBar = new MyCustomVScrollbar(); //has to be implemented, but there are also some open source projects 
hscrollBar = new MyCustomHScrollbar(); //has to be implemented, but there are also some open source projects 

vscrollBar.Scroll += new EventHandler(vscrollBar_OnScroll);
hscrollBar.Scroll += new EventHandler(hscrollBar_OnScroll);

private void hscrollBar_OnScroll(object sender, EventArgs e)
{
            if(Editor!=null)
                Editor.XOffset = hscrollBar.Value;
}
private void vscrollBar_OnScroll(object sender, EventArgs e)
{
            if(Editor!=null)
                Editor.FirstVisibleLine = vscrollBar.Value;
}
private void editor_UpdateUI(object sender, UpdateUIEventArgs e)
{
if ((e.Change & UpdateChange.VScroll) > 0)
            {
                vscrollBar.Minimum = 0;
                vscrollBar.Maximum = Editor.Lines.Count;
                vscrollBar.LargeChange = Editor.LinesOnScreen;
                vscrollBar.Value = Editor.FirstVisibleLine;
            }
            if ((e.Change & UpdateChange.HScroll) > 0)
            {
                hscrollBar.Minimum = 0;
                hscrollBar.Maximum = Math.Max(Editor.XOffset,Editor.ScrollWidth);

                hscrollBar.Value = Editor.XOffset;
            }
}
Snobbish-slob commented 2 years ago

@MaticBabnik You can disable Scrollbars in ScintillaNET and add own custom scrollbar controls.

Editor.VScrollBar = false;
Editor.HScrollBar = false;
Editor.UpdateUI += new System.EventHandler<ScintillaNET.UpdateUIEventArgs>(editor_UpdateUI);

vscrollBar = new MyCustomVScrollbar(); //has to be implemented, but there are also some open source projects 
hscrollBar = new MyCustomHScrollbar(); //has to be implemented, but there are also some open source projects 

vscrollBar.Scroll += new EventHandler(vscrollBar_OnScroll);
hscrollBar.Scroll += new EventHandler(hscrollBar_OnScroll);

private void hscrollBar_OnScroll(object sender, EventArgs e)
{
            if(Editor!=null)
                Editor.XOffset = hscrollBar.Value;
}
private void vscrollBar_OnScroll(object sender, EventArgs e)
{
            if(Editor!=null)
                Editor.FirstVisibleLine = vscrollBar.Value;
}
private void editor_UpdateUI(object sender, UpdateUIEventArgs e)
{
if ((e.Change & UpdateChange.VScroll) > 0)
            {
                vscrollBar.Minimum = 0;
                vscrollBar.Maximum = Editor.Lines.Count;
                vscrollBar.LargeChange = Editor.LinesOnScreen;
                vscrollBar.Value = Editor.FirstVisibleLine;
            }
            if ((e.Change & UpdateChange.HScroll) > 0)
            {
                hscrollBar.Minimum = 0;
                hscrollBar.Maximum = Math.Max(Editor.XOffset,Editor.ScrollWidth);

                hscrollBar.Value = Editor.XOffset;
            }
}

and how do I apply this? sry if this sounds dumb and how do I change the color of these