private void ButtonNext_Click(object sender, EventArgs e) { if (PartsPanel.AutoScrollPosition.X + PartsPanel.Width < _lastViewPoint) { PartsPanel.AutoScroll = true; PartsPanel.AutoScrollPosition = new Point(PartsPanel.AutoScrollPosition.X + 20, 0); //MainPanel.AutoScroll = false; PartsPanel.Invalidate(); } }
private void ButtonPrev_Click(object sender, EventArgs e) { if (PartsPanel.AutoScrollPosition.X > 0) { PartsPanel.AutoScroll = true; PartsPanel.AutoScrollPosition = new Point(PartsPanel.AutoScrollPosition.X - 20, 0); //MainPanel.AutoScroll = false; PartsPanel.Invalidate(); } }
void part_SizeChanged(object sender, EventArgs e) { WavePanel part = (WavePanel)sender; for (int i = (int)(part.Tag); i < _storedParts.Count; i++) { if (i > 0) { WavePanel wp = _storedParts[i]; WavePanel wpPrev = _storedParts[i - 1]; wp.Left = wpPrev.Left + wpPrev.Width + 6; } } PartsPanel.Refresh(); }
void updatePartsView() { for (int i = 0; i < _storedParts.Count; i++) { WavePanel wp = _storedParts[i]; wp.Tag = i; if (i > 0) { WavePanel wpPrev = _storedParts[i - 1]; wp.Left = wpPrev.Left + wpPrev.Width + 8; } else { wp.Left = 8; } } PartsPanel.Refresh(); }
void box_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { Label box = (Label)sender; int boxLeft = box.Width + 3; _storedParts.RemoveAt((int)box.Tag); box.Dispose(); PartsPanel.Refresh(); for (int i = (int)box.Tag; i < _storedParts.Count; i++) { _storedParts[i].Left -= boxLeft; _storedParts[i].Tag = (int)_storedParts[i].Tag - 1; } if (_storedParts.Count == 0) { info1.Visible = true; info2.Visible = true; info3.Visible = true; } PartsPanel.Refresh(); } }
private void addPart(byte [] bytes, Color color, int x, string name) { int idx = getPartIndex(x); int lastPos = (idx >= 0) ? _storedParts[idx].Left - 8 : (_storedParts.Count > 0) ? _storedParts[_storedParts.Count - 1].Location.X + _storedParts[_storedParts.Count - 1].Width : 0; WavePanel part = new WavePanel(); part.Name = ""; part.Init(this); part.Color = color; part.Location = new Point(lastPos + 8, 3); part.Height = SrcPanel.Height - 27; part.Parent = PartsPanel; part.Tag = _storedParts.Count; part.RememberEvent += new EventHandler(OnRememberEvent); part.DeleteEvent += new EventHandler(part_DeleteEvent); part.SaveEvent += new EventHandler(Pic_SaveEvent); part.BringToFront(); part.Resolution = _resolution; part.SetWave(bytes, false); part.SizeChanged += new EventHandler(part_SizeChanged); PartsPanel.Refresh(); if (idx >= 0) { _storedParts.Insert(idx, part); } else { _storedParts.Add(part); } updatePartsView(); info1.Visible = false; info2.Visible = false; }
void box_MouseEnter(object sender, EventArgs e) { PartsPanel.Focus(); }
void PartsPanel_DragDrop(object sender, DragEventArgs e) { DragDropWaveArgs args = (DragDropWaveArgs)e.Data.GetData("Voice.Visual.DragDropWaveArgs"); addPart(args.bytes, args.color, PartsPanel.PointToClient(Control.MousePosition).X, "name0"); }