public ScScrollContainer(int w, int h) { Width = w; Height = h; wrapper = new ScWrapper(w, h); wrapper.Location = new PointF(0, 0); Add(wrapper); hScrollBar = new ScScrollBar(8, h); hScrollBar.Location = new Point(w - 8, 0); hScrollBar.Visible = false; hScrollBar.IsHitThrough = false; hScrollBar.scrollContainer = this; hScrollBar.SetScrollContainerMoveEvent(); Add(hScrollBar); hScrollBar.SliderMoveEvent += HScrollBar_SliderMoveEvent; hScrollBar.SliderDownEvent += HScrollBar_SliderDownEvent; MouseDown += ScScrollContainer_MouseDown; MouseMove += ScScrollContainer_MouseMove; MouseUp += ScScrollContainer_MouseUp; mouseHook.MouseWheel += MouseHook_MouseWheel; // mouseHook.Start(); }
public ScScrollContainer() { view = new ScLayer(); Add(view); wrapper = new ScWrapper(); view.Add(wrapper); hScrollBar = new ScScrollBar(); hScrollBar.Visible = false; hScrollBar.IsHitThrough = false; hScrollBar.scrollContainer = this; hScrollBar.SetScrollContainerMoveEvent(); Add(hScrollBar); hScrollBar.SliderMoveEvent += HScrollBar_SliderMoveEvent; hScrollBar.SliderDownEvent += HScrollBar_SliderDownEvent; MouseDown += ScScrollContainer_MouseDown; MouseMove += ScScrollContainer_MouseMove; MouseUp += ScScrollContainer_MouseUp; mouseHook.MouseWheel += MouseHook_MouseWheel; // mouseHook.Start(); SizeChanged += ScScrollContainer_SizeChanged; }
private void ScrollContainer_ContainerMoveEvent(float yMoveValue) { ScWrapper container = scrollContainer.GetContainer(); float yoffset = Height / container.Height * yMoveValue; float y = locationSliderY - yoffset; if (y < 0) { y = 0; } else if (y + slider.Height > Height) { y = Height - slider.Height; } slider.Location = new PointF(slider.Location.X, y); Refresh(); }