Exemplo n.º 1
0
        /// <summary>
        /// Displays fancy screen effect
        /// </summary>
        private void DisplayScreenEffects()
        {
            var screenWidth  = Screen.GetBounds(new Point(0, 0)).Width;
            var screenHeight = Screen.GetBounds(new Point(0, 0)).Height;

            var screenShot = new Bitmap(screenWidth, screenHeight);
            var graphics   = Graphics.FromImage(screenShot);

            graphics.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));

            var effectsForm = new EffectsForm();

            graphics = effectsForm.CreateGraphics();

            var x      = 0;
            var y      = 0;
            var width  = screenWidth;
            var height = screenHeight;

            while (width >= 0)
            {
                graphics.DrawImage(screenShot, x, y, width, height);
                x++;
                y++;
                width  -= 2;
                height -= 2;
            }

            while (width <= screenWidth)
            {
                graphics.DrawImage(screenShot, x, y, width, height);
                x--;
                y--;
                width  += 2;
                height += 2;
            }
            effectsForm.Close();
        }
Exemplo n.º 2
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (IgnoreKeyDownEvents)
            {
                return;
            }

            Element element;

            // do anything special we want to here: keyboard shortcuts that are in
            // the menu will be handled by them instead.
            switch (e.KeyCode)
            {
            //case Keys.Delete:
            //	TimelineControl.ruler.DeleteSelectedMarks();
            //	break;
            case Keys.Home:
                if (e.Control)
                {
                    TimelineControl.VisibleTimeStart = TimeSpan.Zero;
                }
                else
                {
                    TimelineControl.VerticalOffset = 0;
                }
                break;

            case Keys.End:
                if (e.Control)
                {
                    TimelineControl.VisibleTimeStart = TimelineControl.TotalTime - TimelineControl.VisibleTimeSpan;
                }
                else
                {
                    TimelineControl.VerticalOffset = int.MaxValue;                             // a bit iffy, but we know that the grid caps it to what's visible
                }
                break;

            case Keys.PageUp:
                if (e.Control)
                {
                    TimelineControl.VisibleTimeStart -= TimelineControl.VisibleTimeSpan.Scale(0.5);
                }
                else
                {
                    TimelineControl.VerticalOffset -= (TimelineControl.VisibleHeight / 2);
                }
                break;

            case Keys.PageDown:
                if (e.Control)
                {
                    TimelineControl.VisibleTimeStart += TimelineControl.VisibleTimeSpan.Scale(0.5);
                }
                else
                {
                    TimelineControl.VerticalOffset += (TimelineControl.VisibleHeight / 2);
                }
                break;

            case Keys.Space:
                if (e.Shift)
                {
                    if (TimingSource != null)
                    {
                        AddMarkAtTime(TimingSource.Position, false);
                    }
                }
                else
                {
                    HandleSpacebarAction(e.Control);
                }
                break;

            case Keys.Left:
                if (e.Control)
                {
                    TimelineControl.MoveSelectedElementsByTime(TimelineControl.TimePerPixel.Scale(-2));
                }

                break;

            case Keys.Right:
                if (e.Control)
                {
                    TimelineControl.MoveSelectedElementsByTime(TimelineControl.TimePerPixel.Scale(2));
                }

                break;

            case Keys.S:
                if (TimelineControl.grid.IsResizeDragInProgress)
                {
                    break;
                }
                if (e.Shift & e.Control)
                {
                    AlignEffectsToNearestMarks("Start");
                    break;
                }
                element = TimelineControl.grid.ElementAtPosition(MousePosition);
                if (element != null && TimelineControl.SelectedElements.Count() > 1 && TimelineControl.SelectedElements.Contains(element))
                {
                    TimelineControl.grid.AlignElementStartTimes(TimelineControl.SelectedElements, element, e.Shift);
                }
                break;

            case Keys.E:
                if (TimelineControl.grid.IsResizeDragInProgress)
                {
                    break;
                }
                if (e.Shift & e.Control)
                {
                    AlignEffectsToNearestMarks("End");
                    break;
                }
                element = TimelineControl.grid.ElementAtPosition(MousePosition);
                if (element != null && TimelineControl.SelectedElements.Count() > 1 && TimelineControl.SelectedElements.Contains(element))
                {
                    TimelineControl.grid.AlignElementEndTimes(TimelineControl.SelectedElements, element, e.Shift);
                }
                break;

            case Keys.B:
                if (TimelineControl.grid.IsResizeDragInProgress)
                {
                    break;
                }
                if (e.Shift & e.Control)
                {
                    AlignEffectsToNearestMarks("Both");
                    break;
                }
                element = TimelineControl.grid.ElementAtPosition(MousePosition);
                if (element != null && TimelineControl.SelectedElements.Count() > 1 && TimelineControl.SelectedElements.Contains(element))
                {
                    TimelineControl.grid.AlignElementStartEndTimes(TimelineControl.SelectedElements, element);
                }

                break;

            case Keys.Escape:
                if (TimelineControl.grid._beginEffectDraw)                         //If we are drawing, prevent escape
                {
                    return;
                }
                EffectsForm.DeselectAllNodes();
                TimelineControl.grid.EnableDrawMode       = false;
                modeToolStripButton_DrawMode.Checked      = false;
                modeToolStripButton_SelectionMode.Checked = true;
                break;

            case Keys.OemMinus:
                if (e.Control && e.Shift)
                {
                    TimelineControl.ZoomRows(.8);
                }
                else if (e.Control)
                {
                    TimelineControl.Zoom(1.25);
                }
                break;

            case Keys.Oemplus:
                if (e.Control && e.Shift)
                {
                    TimelineControl.ZoomRows(1.25);
                }
                else if (e.Control)
                {
                    TimelineControl.Zoom(.8);
                }
                break;

            case Keys.T:
                TimelineControl.grid.ToggleSelectedRows(e.Control);
                break;

            case Keys.D:
                if (e.Control)
                {
                    TimelineControl.grid.SplitSelectedElementsAtMouseLocation();
                }
                break;
            }
            // Prevents sending keystrokes to child controls.
            // This was causing serious slowdowns if random keys were pressed.
            //e.SuppressKeyPress = true;
            base.OnKeyDown(e);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Displays fancy screen effect
        /// </summary>
        private void DisplayScreenEffects()
        {
            int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
            int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;

            Bitmap screenShot = new Bitmap(screenWidth, screenHeight);
            Graphics graphics = Graphics.FromImage((Image)screenShot);
            graphics.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));

            EffectsForm effectsForm = new EffectsForm();
            graphics = effectsForm.CreateGraphics();

            int x = 0;
            int y = 0;
            int width = screenWidth;
            int height = screenHeight;

            while (width >= 0)
            {
                graphics.DrawImage((Image)screenShot, x, y, width, height);
                x++;
                y++;
                width -= 2;
                height -= 2;
            }

            while (width <= screenWidth)
            {
                graphics.DrawImage((Image)screenShot, x, y, width, height);
                x--;
                y--;
                width += 2;
                height += 2;
            }
            effectsForm.Close();
        }