Exemplo n.º 1
0
        //============================================================
        // <T>鼠标按键放开的</T>
        //
        // @author DYWEN 20120531
        //============================================================
        void button_MouseUp(object sender, MouseEventArgs e)
        {
            // 移动的时候后一个控件不能超过前面的一个控件
            FRsResourceFrame freams = _button.Tag as FRsResourceFrame;
            int index = freams.Index - 1;

            if (index >= 0)
            {
                int conLocation = _controls[index].Location.X;
                if (conLocation > _button.Location.X)
                {
                    _button.Location = new Point(conLocation, 0);
                }
            }
            if (_button.Location.X <= 0)
            {
                _button.Location = new Point(0, 0);
            }
            if (_button.Location.X >= labTimeAxisWidth)
            {
                _button.Location = new Point(labTimeAxisWidth - 10, 0);
            }
            if (sender != null)
            {
                _button = (Button)sender;
                isMove  = false;
            }
            // 向右移动的时候当前控件之后的控件同时移动
            newLocationX = _button.Location.X;
            if (newLocationX > oldLocationX)
            {
                int w = newLocationX - oldLocationX;
                int j = freams.Index + 1;
                for (int n = j; n < _controls.Count; n++)
                {
                    int loc = _controls[n].Location.X;
                    p.X = loc + w;
                    if (p.X <= labTimeAxisWidth)
                    {
                        _controls[n].Location = p;
                    }
                }
            }
            if (newLocationX < oldLocationX)
            {
                int w = oldLocationX - newLocationX;
                int j = freams.Index + 1;
                for (int n = j; n < _controls.Count; n++)
                {
                    int loc = _controls[n].Location.X;
                    p.X = loc - w;
                    if (p.X <= labTimeAxisWidth)
                    {
                        _controls[n].Location = p;
                    }
                }
            }
            distance(newLocationX);
            txtFrameDelayEdit.Text = _button.Location.X.ToString();
        }
Exemplo n.º 2
0
        //============================================================
        public void CreateFream(FRsResourceFrame fream, int index)
        {
            Button button = new Button();

            button.Width  = 10;
            button.Height = 20;
            button.Tag    = fream;
            int freamDelay = fream.Delay;
            int cellIndex  = 1500 / fream.Delay;

            button.MouseDown  += new MouseEventHandler(button_MouseDown);
            button.MouseMove  += new MouseEventHandler(button_MouseMove);
            button.MouseUp    += new MouseEventHandler(button_MouseUp);
            button.MouseWheel += new MouseEventHandler(button_MouseWheel);
            int   x = index * cellIndex * 15 + labTimeAxis.Left;
            Point p = new Point(x, 0);

            button.Location = p;
            if (!_isFirst)
            {
                _button  = button;
                _isFirst = true;
            }
            Controls.Add(button);
            _controls.Push(button);
        }
Exemplo n.º 3
0
        //============================================================
        public void DoPause()
        {
            FRsResourceFrame frame = _clip.Frames[_frameCurrent];

            _btindex = frame.Index;
            timPlay.Stop();
            BtIndex();
        }
Exemplo n.º 4
0
        //============================================================
        public void LoadInfomation(FRsResourceClip clip)
        {
            int freamCount = clip.FrameCount;

            for (int n = 0; n < freamCount; n++)
            {
                FRsResourceFrame fream = clip.Frames[n];
                CreateFream(fream, n + 1);
            }
        }
Exemplo n.º 5
0
 //============================================================
 // <T>控制帧的播放速度</T>
 //
 // @author DYWEN 20120605
 //============================================================
 public void DrawFrame()
 {
     if (null != _clip && !_clip.IsReversed)
     {
         _clip.Open();
         using (Graphics g = Graphics.FromImage(_bitmap.Native)) {
             g.Clear(BackColor);
             FRsResourceFrame frame = _clip.Frames[_frameCurrent];
             //加载耽搁pose的延迟
             this.timPlay.Interval = frame.Delay;
             int x = (int)((frame.ValidRectangle.Left - Clip.ValidRectangle.Left) * _clipScale);
             int y = (int)((frame.ValidRectangle.Top - Clip.ValidRectangle.Top) * _clipScale);
             int w = (int)(frame.ValidRectangle.Width * _clipScale);
             int h = (int)(frame.ValidRectangle.Height * _clipScale);
             if (!frame.ValidRectangle.IsEmpty)
             {
                 g.DrawImage(frame.ValidBitmap, x, y, w, h);
             }
             if (_showBarycenter)
             {
                 Pen p = new Pen(Color.Red, 10);
                 g.FillEllipse(p.Brush, _barycenter.X - 5, _barycenter.Y - 5, 10, 10);
             }
             if (_showRidePoint)
             {
                 Pen p = new Pen(Color.Blue, 10);
                 g.FillEllipse(p.Brush, _ridePoint.X - 5, _ridePoint.Y - 5, 10, 10);
             }
             if (_showBloodPoint)
             {
                 Pen p = new Pen(Color.Black, 10);
                 g.FillEllipse(p.Brush, _bloodPoint.X - 5, _bloodPoint.Y - 5, 10, 10);
             }
             if (_showOrnamentsPoint)
             {
                 Pen p = new Pen(Color.Green, 10);
                 g.FillEllipse(p.Brush, _ornamentsPoint.X - 5, _ornamentsPoint.Y - 5, 10, 10);
             }
             if (_showWingPoint)
             {
                 Pen p = new Pen(Color.Yellow, 10);
                 g.FillEllipse(p.Brush, _wingPoint.X - 5, _wingPoint.Y - 5, 10, 10);
             }
         }
         _frameCurrent++;
         if (_frameCurrent >= _clip.Frames.Count)
         {
             _frameCurrent = 0;
         }
         //pbxViewer.Invalidate();
         pbxViewer.Invalidate(new Rectangle(0, 0, pbxViewer.Width, pbxViewer.Height), false);
     }
 }
Exemplo n.º 6
0
        //============================================================
        // 滚轮向右滚动的时候控件移动
        //============================================================
        public void rightPoint()
        {
            FRsResourceFrame fream = _button.Tag as FRsResourceFrame;
            int j = fream.Index + 1;

            for (int n = j; n < _controls.Count; n++)
            {
                int loc = _controls[n].Location.X;
                p.X = loc + 10;
                _controls[n].Location = p;
            }
        }
Exemplo n.º 7
0
        //============================================================
        public void button_MouseWheel(object sender, MouseEventArgs e)
        {
            int width = labTimeAxis.Width + 20;
            int count = e.Delta;
            //bool result = false;
            FRsResourceFrame fream = _button.Tag as FRsResourceFrame;
            Point            point = new Point();
            int n = fream.Index - 1;

            if (n >= 0)
            {
                int index = Controls.IndexOf(_controls[n]);
                point = _controls[n].Location;
            }
            if (count == 120)
            {
                p.X = _button.Location.X + 10;
                p.Y = _button.Location.Y;
                if (p.X > width)
                {
                    p.X = width;
                }
                _button.Location = p;
                rightPoint();
            }
            if (count == -120)
            {
                p.X = _button.Location.X - 10;
                p.Y = _button.Location.Y;
                if (p.X < labTimeAxis.Left)
                {
                    p.X = labTimeAxis.Left;
                }
                if (p.X <= point.X)
                {
                    p.X = point.X + 10;
                }
                _button.Location = p;
                leftPoint();
            }
        }
Exemplo n.º 8
0
        //============================================================
        // <T>鼠标移动的时候发生。</T>
        //
        // @author DYWEN 20120531
        //============================================================
        public void button_MouseMove(object sender, MouseEventArgs e)
        {
            _button.SuspendLayout();
            txtFrameDelayEdit.Text = _button.Location.X.ToString();
            // 移动的时候后一个控件不能超过前面的一个控件
            FRsResourceFrame freams = _button.Tag as FRsResourceFrame;
            int index = freams.Index - 1;

            if (index >= 0)
            {
                int conLocation = _controls[index].Location.X;
                if (conLocation > _button.Location.X)
                {
                    _button.Location = new Point(conLocation, 0);
                }
            }
            _button = sender as Button;
            int bw = _button.Size.Width;
            int cx = _button.Location.X;

            // 移动控件
            if (isMove == true)
            {
                // 向左移动
                if (_button.Location.X <= 0)
                {
                    _button.Location = new Point(0, 0);
                }
                // 右移动
                if (_button.Location.X >= labTimeAxisWidth)
                {
                    _button.Location = new Point(labTimeAxisWidth - 10, 0);
                }
                p.X = cx + e.X - bw / 2;
                p.Y = 0;
                _button.Location = p;
            }
            _button.ResumeLayout();
        }
Exemplo n.º 9
0
        //============================================================
        // <T>调整单个控件的位置</T>
        //
        // @author DYWEN 20120625
        //============================================================
        private void txtFrameDelayEdit_KeyDown(object sender, KeyEventArgs e)
        {
            FRsResourceFrame fream = _button.Tag as FRsResourceFrame;
            int en = fream.Index + 1;
            int ba = fream.Index - 1;

            if (e.KeyValue == 13)
            {
                int locX = RInt.Parse(txtFrameDelayEdit.Text.ToString());
                if (locX > _controls[en].Location.X)
                {
                    MessageBox.Show("亲,超出范围!");
                    return;
                }
                if (locX < _controls[ba].Location.X)
                {
                    MessageBox.Show("亲,超出范围!");
                    return;
                }
                p.X = locX;
                _button.Location = p;
            }
        }
Exemplo n.º 10
0
        //============================================================
        // <T>计算控件之间的距离</T>
        //
        // @author DYWEN 20120531
        //============================================================
        private void distance(int newdataX)
        {
            FRsResourceFrame fream = _button.Tag as FRsResourceFrame;
            int index = fream.Index;

            if (index == 0)
            {
                _button    = (Button)_controls[index];
                _distanceX = newdataX - 0;
            }
            if (index >= 1)
            {
                _button        = (Button)_controls[index - 1];
                beforeControlX = _button.Location.X;
                // 计算当前控件和相邻上个控件的距离
                _distanceX = newdataX - beforeControlX;
            }
            if (_distanceX > 0)
            {
                fream.Delay        = _distanceX;
                txtFrameDelay.Text = _distanceX.ToString();
            }
        }