Beispiel #1
0
 public void ShowAmplitudes(byte [] bytes, string name)
 {
     SrcPic.Name  = name;
     SrcPic.Color = _colors[_colorID];
     SrcPic.SetWave(bytes, true);
     _colorID = (_colorID + 1) % _colors.Length;
 }
        private void MainPic_MouseDown(object sender, MouseEventArgs e)
        {
            if (_img == null)
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                if (e.X > _partStart && e.X < _partEnd)
                {
                    //copy image part
                    copyImagePart(_partStart, _partEnd);
                }
                else
                {
                    _partStart = e.X;
                    _partEnd   = 0;
                    //SrcPic.Image = (Image)_img.Clone();
                    SrcPic.Refresh();
                }
                //MessageBox.Show("Left: " + e.Location.ToString() + ". clicks: " + e.Clicks.ToString());
            }
            else if (e.Button == MouseButtons.Right)
            {
                //MessageBox.Show("Right: " + e.Location.ToString());
                // delete image part
                //SrcPic.Image = (Image)_img.Clone();
            }
        }
        private void MainPic_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left && _img != null)
            {
                SrcPic.Image = (Image)_img.Clone();
                Graphics graph = Graphics.FromImage(SrcPic.Image);

                Pen pen = new Pen(Color.Black);
                _partEnd = e.X;
                int start = (_partStart < e.X) ? _partStart : e.X;
                int end   = (_partStart > e.X) ? _partStart : e.X;
                graph.DrawRectangle(pen, start, 0, end - start, SrcPic.Height - 1);
                graph.FillRectangle(_brushChoose, start + 1, 1, end - start - 2, SrcPic.Height - 3);
                SrcPic.Refresh();
                //MainPic.Image = (Image)graph;
            }
        }
Beispiel #4
0
 public SoundEditor(Control parent)
 {
     this.Parent = parent;
     InitializeComponent();
     SrcPic.Init(parent);
     ResultPic.Init(parent);
     // pixels per second
     ToolButton100MS.Tag = 1000;
     ToolButton1S.Tag    = 100;
     ToolButton10S.Tag   = 10;
     initPanels();
     SrcPic.Location          = new Point(8, 2);
     ResultPic.Location       = new Point(8, 2);
     SrcPic.RememberEvent    += new EventHandler(OnRememberEvent);
     ResultPic.RememberEvent += new EventHandler(OnRememberEvent);
     SrcPic.SaveEvent        += new EventHandler(Pic_SaveEvent);
     ResultPic.SaveEvent     += new EventHandler(Pic_SaveEvent);
     ResultPic.Name           = "";
     _colors      = new Color[] { Color.Violet, Color.LimeGreen, Color.Blue, Color.Orange, Color.DarkTurquoise, Color.Red };
     _brushChoose = new HatchBrush(HatchStyle.Percent10, Color.Orange, Color.Transparent);
     _storedParts = new List <WavePanel>();
 }