Esempio n. 1
0
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            SplitterPanel panel1 = splitContHorizLeft.Panel1;

            panel1.Focus();
            try
            {
                if (e.Button == MouseButtons.Left)
                {
                    Point  ptDiff      = new Point(e.Location.X - _mousePositionPrev.X, e.Location.Y - _mousePositionPrev.Y);
                    double aspectRatio = 1.0;

                    Box2D box = _picGraphics.DrawingBox;
                    box.Center = new Vector2D(
                        box.Center.X - ptDiff.X * box.Width / (double)panel1.ClientSize.Width
                        , box.Center.Y + ptDiff.Y * box.Height / ((double)panel1.ClientSize.Height * aspectRatio));
                    _picGraphics.DrawingBox = box;

                    panel1.Invalidate();
                }
                _mousePositionPrev = e.Location;
            }
            catch (InvalidBoxException /*ex*/) { _computeBbox = true; }
            catch (Exception ex) { log.Debug(ex.ToString()); }
            finally { }
        }
Esempio n. 2
0
        private void PopulateControls(List <InfosThumbnail> _infosThumbQueue)
        {
            // Unqueue bitmaps and populate the controls
            for (int i = _infosThumbQueue.Count - 1; i >= 0; i--)
            {
                // Double check.
                if (m_iLastFilled + 1 < m_Panel.Controls.Count)
                {
                    m_iLastFilled++;
                    ThumbListViewItem tlvi = m_Panel.Controls[m_iLastFilled] as ThumbListViewItem;
                    if (tlvi != null)
                    {
                        if (_infosThumbQueue[i] != null)
                        {
                            if (_infosThumbQueue[i].Thumbnails.Count > 0)
                            {
                                tlvi.Thumbnails = _infosThumbQueue[i].Thumbnails;
                                if (_infosThumbQueue[i].IsImage)
                                {
                                    tlvi.IsImage  = true;
                                    tlvi.Duration = "0";
                                }
                                else
                                {
                                    tlvi.Duration = TimeHelper.MillisecondsToTimecode((double)_infosThumbQueue[i].iDurationMilliseconds, false, true);
                                }

                                tlvi.ImageSize = (Size)_infosThumbQueue[i].imageSize;
                                tlvi.HasKva    = _infosThumbQueue[i].HasKva;
                            }
                            else
                            {
                                tlvi.DisplayAsError();
                            }
                        }
                        else
                        {
                            tlvi.DisplayAsError();
                        }

                        // Issue: We computed the .top coord of the thumb when the panel wasn't moving.
                        // If we are scrolling, the .top of the panel is moving,
                        // so the thumbnails will be activated at the wrong spot.
                        if (m_Panel.AutoScrollPosition.Y != 0)
                        {
                            tlvi.Top = tlvi.Top + m_Panel.AutoScrollPosition.Y;
                        }

                        m_Panel.Controls[m_iLastFilled].Visible = true;
                    }

                    _infosThumbQueue.RemoveAt(i);
                }
            }
            m_Panel.Invalidate();
        }
Esempio n. 3
0
 private void Visualize(TestCase testCase)
 {
     ClearTestCaseView();
     using (Graphics g = Graphics.FromImage(bitmap))
     {
         Brush brush = testCase.LastResult == TestResult.OK ? Brushes.Aquamarine : (testCase.LastResult == TestResult.Failed ? Brushes.LightPink : Brushes.LightGoldenrodYellow);
         g.FillRectangle(brush, 0, 0, bitmap.Width, bitmap.Height);
     }
     using (var ui = new TestCaseUI(bitmap, logTextBox))
         testCase.Visualize(ui);
     pictureContainer.Invalidate();
 }