Posted 19 years ago
by Jake Pearson
-
Software Developer,
Alion Science and Technology

Hi,
Support, feel free to ignore this message, but if anyone has an idea please let me know.
I am working on having a set of SyntaxEditor's share the same scroll bar. Basically we are stacking a few syntax editors in the same parent panel, when one editor gets taller it pushes down the editors below. This link points at a screen shot of my editors. The problem is typing in one of the syntax editors does not scroll the parent panel. I found an article on scrollbars on code project. I put some code into my editor like this:The "AutoScrollVerticalPosition" property calls some Win32 methods like this:
It works ok for the first few returns, but eventually it quits scrolling down. Does anyone have an idea what I am doing wrong?
thanks,
Jake
Support, feel free to ignore this message, but if anyone has an idea please let me know.
I am working on having a set of SyntaxEditor's share the same scroll bar. Basically we are stacking a few syntax editors in the same parent panel, when one editor gets taller it pushes down the editors below. This link points at a screen shot of my editors. The problem is typing in one of the syntax editors does not scroll the parent panel. I found an article on scrollbars on code project. I put some code into my editor like this:
private int lastLineCount = 1;
private void cSharpEditorCode_DocumentTextChanged(object sender, ActiproSoftware.SyntaxEditor.DocumentModificationEventArgs e)
{
UpdateHeights();
this.enableChangeEvents = false;
CodeProperty.SetValue(PropertyParent, cSharpEditorCode.Text, null);
this.enableChangeEvents = true;
if(lastLineCount != e.Document.Lines.Count)
{
int lineDelta = e.Document.Lines.Count - lastLineCount;
ExpandableEditorList list = Parent as ExpandableEditorList;
if(list == null)
{
return;
}
list.AutoScrollVerticalPosition += lineDelta*Editor.LineHeight;
lastLineCount = e.Document.Lines.Count;
}
}
public int AutoScrollVerticalPosition
{
get { return GetScrollPos(this.Handle, (int)SB_VERT); }
set
{
SetScrollPos(this.Handle, (int)SB_VERT, value, true);
SetDisplayRectLocation(DisplayRectangle.X, -value);
}
}
[DllImport("user32.dll")]
private static extern int SetScrollPos(System.IntPtr hWnd, int nBar, int nPos, bool bRedraw);
thanks,
Jake