void ltv_ViewportChanged(object sender, EventArgs e) { if (!ignoreViewportChanged) { ignoreViewportChanged = true; LargeTextViewer ltv = (LargeTextViewer)sender; if (ltv == ltv1) { ltv2.UpdateViewportFrom(ltv1); } else { ltv1.UpdateViewportFrom(ltv2); } ignoreViewportChanged = false; } }
void ltv_SelectedIndexChanged(object sender, EventArgs e) { if (!ignoreSelectIndexChange) { ignoreSelectIndexChange = true; LargeTextViewer ltv = (LargeTextViewer)sender; if (ltv == ltv1) { ltv2.SelectedIndex = ltv.SelectedIndex; } else { ltv1.SelectedIndex = ltv.SelectedIndex; } ignoreSelectIndexChange = false; string[] sa1 = ltv1.GetLines(ltv.SelectedIndex, 1); string[] sa2 = ltv2.GetLines(ltv.SelectedIndex, 1); ltvRes.Text = sa1[0] + Environment.NewLine + sa2[0]; } }