Example #1
0
        private void StartSpriteControl_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            TransformGroup sprite1Transform = new TransformGroup();

            DrawUtils.DrawSprite(Sprite1, 0.15, 0.28, e.NewSize.Width, 35, sprite1Transform);


            TranslateTransform translate = new TranslateTransform();

            translate.X = (Sprite1.ActualWidth - Sprite1.Margin.Left - Sprite1.Margin.Right) / 1.17;
            sprite1Transform.Children.Add(translate);

            Sprite1.RenderTransform = sprite1Transform;


            TransformGroup sprite2Transform = new TransformGroup();

            DrawUtils.DrawSprite(Sprite2, 0.14, 0.3, e.NewSize.Width, 125, sprite2Transform);
            TranslateTransform translate2 = new TranslateTransform();

            translate2.X = -(Sprite2.ActualWidth - Sprite2.Margin.Left - Sprite2.Margin.Right) / 1.1;
            translate2.Y = (Sprite2.ActualHeight - Sprite2.Margin.Top - Sprite2.Margin.Bottom) / 2.8;
            sprite2Transform.Children.Add(translate2);

            Sprite2.RenderTransform = sprite2Transform;
            //Sprite2.Visibility = System.Windows.Visibility.Collapsed;
        }
        private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (m_presenter == null)
                return;

            m_presenter.SetSize((int)ActualWidth, (int)ActualHeight);
        }
        private void SizeChangedHandler(object sender, SizeChangedEventArgs e)
        {
            double actualWidth = ActualWidth;
            MetroProgressBar bar = this;

            bar.ResetStoryboard(actualWidth);
        }
Example #4
0
        public void SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            var ar = $"{e.NewSize.Width}:{e.NewSize.Height}";

            _logger.Info("{0} : changing aspect ratio to {1}", Channel, ar);
            //_vlcControl.SourceProvider.MediaPlayer.Video.AspectRatio = ar;
        }
Example #5
0
 private void onGridSizeChanged(object sender, SizeChangedEventArgs e) {
   Debug.WriteLine("width: " + LayoutRoot.ActualWidth + " height: " + LayoutRoot.ActualHeight);
   if (ball == null) {
     float width = (float)LayoutRoot.ActualWidth;
     float height = (float)LayoutRoot.ActualHeight;
     ballBody = BodyFactory.CreateBody(world, new Vector2(ConvertUnits.ToSimUnits(width / 2f), ConvertUnits.ToSimUnits(height / 2f)));
     ballBody.BodyType = BodyType.Dynamic;
     ballBody.LinearDamping = 1f;
     CircleShape circleShape = new CircleShape(ConvertUnits.ToSimUnits(8f), 1f);
     Fixture fixture = ballBody.CreateFixture(circleShape);
     fixture.OnCollision += OnBalCollision;
     ball = new Ball(canvas, 8, new System.Windows.Point(width / 2f, height / 2f));
   }
   if (level == null) {
     level = new Level(currentLevel, canvas);
     Body wallBody;
     System.Windows.Point position;
     foreach (Wall wall in level.getWalls()) {
       position = wall.getPosition();
       wallBody = BodyFactory.CreateRectangle(
         world, 
         ConvertUnits.ToSimUnits(wall.getWidth()),
         ConvertUnits.ToSimUnits(wall.getHeight()),
         0.001f,
         new Vector2(ConvertUnits.ToSimUnits(position.X + wall.getWidth() / 2f), ConvertUnits.ToSimUnits(position.Y + wall.getHeight() / 2f))
       );
       wallBody.Restitution = 0.25f;
     }
     ballBody.Position = new Vector2(ConvertUnits.ToSimUnits(level.getStart().X), ConvertUnits.ToSimUnits(level.getStart().Y));
     ball.setPosition(new System.Windows.Point(ConvertUnits.ToDisplayUnits(ballBody.Position.X), ConvertUnits.ToDisplayUnits(ballBody.Position.Y)));
   }
 }
        /// <summary>
        ///  this is needed for adapting the sfgrid directly to the tabitem
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GridDefaultBehavior_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            SfDataGrid grid = sender as SfDataGrid;

            grid.ColumnSizer = GridLengthUnitType.Star;
            grid.GridColumnSizer.Refresh();
        }
 private void LoadingBar_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (IsLoading)
     {
         Start(false);
     }
 }
 private void ControlHostElement_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (device != null)
     {
         needsResizing = true;
     }
 }
Example #9
0
 private void OnSizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (this.sizeHasBeenSet)
     {
         Controller.NotifyOfWindowSizeChange(new Point(ActualWidth, ActualHeight));
     }
 }
Example #10
0
 private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (WindowState == WindowState.Minimized)
     {
         this.ShowInTaskbar = false;
     }
 }
Example #11
0
        /// <summary>
        /// Called when the window gets resized.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnWindowSizeChanged(object sender, SizeChangedEventArgs e)
        {
            var window = (Window) ((FrameworkElement) sender).TemplatedParent;

            // Update window's contraints like max height and width.
            UpdateWindowConstraints(window);

            // Get window sub parts
            var icon = (Image) window.Template.FindName("IconApp", window);

            // Adjust the window icon size
            if (icon != null)
            {
                if (window.WindowState == WindowState.Maximized)
                {
                    icon.Height = 20;
                    icon.Width = 20;
                    icon.Margin = new Thickness(10, 5, 0, 0);
                }
                else
                {
                    icon.Height = 24;
                    icon.Width = 24;
                    icon.Margin = new Thickness(10, 3, 0, 0);
                }
            }
        }
 private void OnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs)
 {
     if (this.ActualWidth < 700)
         _viewModel.IsSideBarVisible = false;
     else
         _viewModel.IsSideBarVisible = true;
 }
        /// <summary>
        ///     Event handler for TextBlock's SizeChanged routed event. Triggers evaluation of the
        ///     IsTextTrimmed attached property.
        /// </summary>
        /// <param name="sender">Object where the event handler is attached</param>
        /// <param name="e">Event data</param>
        public static void OnTextBlockSizeChanged(object sender, SizeChangedEventArgs e) {
            var textBlock = sender as TextBlock;
            if (null == textBlock)
                return;

            SetIsTextTrimmed(textBlock, TextTrimming.None != textBlock.TextTrimming && CalculateIsTextTrimmed(textBlock));
        }
Example #14
0
        private void chart_wave_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            var chart = sender as CartesianChart;

            chartHeight = chart.ActualHeight;
            chartWidth  = chart.ActualWidth;
        }
 void mainGrid_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     double width = e.NewSize.Width;
     double height = e.NewSize.Height;
     lineCounter.Update(height);
     lineNumbering.Text = lineCounter.textBlock.Text;
 }
 private void CounterView_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     /* 固定CounterContainer宽度。防止父元素宽度为auto时,不能换行。(针对yuyuvn版KCV等) */
     CounterContainer.ItemsSource = null;
     CounterContainer.Width = this.ActualWidth - 16;
     CounterContainer.ItemsSource = CounterViewModel.Instance.Counters;
 }
Example #17
0
 void PanelSizeChangedHandler(object sender, SizeChangedEventArgs e)
 {
     if ((sender as DragDockPanel).PanelMaximized == false)
     {
         PanelMinimizedHandler((sender as DragDockPanel), null);
     }
 }
Example #18
0
        private void PhoneSlider_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (e.NewSize.Width > 0 && e.NewSize.Height > 0)
            {
                Rect clipRect = new Rect(0, 0, e.NewSize.Width, e.NewSize.Height);
                if (Orientation == Orientation.Horizontal)
                {
                    clipRect.X -= 12;
                    clipRect.Width += 24;
                    object margin = Resources["PhoneHorizontalMargin"];
                    if (margin != null)
                    {
                        Margin = (Thickness)margin;
                    }
                }
                else
                {
                    clipRect.Y -= 12;
                    clipRect.Height += 24;
                    object margin = Resources["PhoneVerticalMargin"];
                    if (margin != null)
                    {
                        Margin = (Thickness)margin;
                    }
                }

                this.Clip = new RectangleGeometry() { Rect = clipRect };
            }
        }
 void ImportBox_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (ImportScrollViewer.DesiredSize.Height > 525)
         ImportScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
     else
         ImportScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
 }
Example #20
0
        private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            // Compare the current window to the ideal dimensions.
            double heightRatio = this.ActualHeight / idealPageSize.Height;
            double widthRatio = this.ActualWidth / idealPageSize.Width;

            // Create the transform.
            ScaleTransform scale = new ScaleTransform();

            // Determine the smallest dimension.
            // This preserves the aspect ratio.
            if (heightRatio < widthRatio)
            {
                scale.ScaleX = heightRatio;
                scale.ScaleY = heightRatio;
            }
            else
            {
                scale.ScaleX = widthRatio;
                scale.ScaleY = widthRatio;
            }

            // Apply the transform.
            this.RenderTransform = scale;
        }
 /// <summary>
 /// Event raised when the size of the ZoomAndPanControl changes.
 /// </summary>
 private void overview_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     //
     // Update the scale so that the entire content fits in the window.
     //
     overview.ScaleToFit();
 }
        void PlusMinusButton_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (m_brdrPlus != null)
            {
                double marg = Math.Round(Math.Max(1, this.ActualWidth / 9));
                m_brdrPlus.Width = marg;
                m_brdrPlus.Margin = new Thickness(0, marg, 0, marg);
            }
            if (m_brdrMinus != null)
            {
                double marg = Math.Round(Math.Max(1, this.ActualHeight / 9));
                m_brdrMinus.Height = marg;
                m_brdrMinus.Margin = new Thickness(marg, 0, marg, 0);
            }

            //border.BorderThickness = new Thickness(Math.Round(Math.Max(1, this.ActualHeight / 15)));
            //LayoutRoot.Margin = new Thickness(Math.Round(Math.Max(1, (2 * this.ActualHeight / 15))));

            ////if (this.ActualHeight % 2 != 0)
            //{
            //    LayoutRoot.ColumnDefinitions[1].Width = new GridLength(Math.Round(Math.Max(1, this.ActualHeight / 15)));
            //    LayoutRoot.RowDefinitions[1].Height = new GridLength(Math.Round(Math.Max(1, this.ActualHeight / 15)));
            //    //line1.StrokeThickness = 0.5 * this.ActualHeight / 13;
            //    //line2.StrokeThickness = 0.5 * this.ActualHeight / 13;
            //    border1.BorderThickness = new Thickness(Math.Round(Math.Max(1, this.ActualHeight / 15)));
            //    border2.BorderThickness = new Thickness(Math.Round(Math.Max(1, this.ActualHeight / 15)));
            //}
        }
Example #23
0
        void Home_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            PageScale.ScaleX = 1;
            PageScale.ScaleY = 1;

            // if the plugin is bigger than the minimum values set,
            // scale the contents of the silverlight application

            // get the ratios of plugin height/width to design-time height/width
            double heightRatio = e.NewSize.Height / this.canvasRoot.Height;
            double widthRatio = e.NewSize.Width / this.canvasRoot.Width;

            // if the height ratio is smaller than the width ratio
            if (heightRatio < widthRatio)
            {
                // set scale the content based on the height ratio
                PageScale.ScaleX = heightRatio;
                PageScale.ScaleY = heightRatio;
            }
            // if not, set scale based on the width ratio
            else
            {
                PageScale.ScaleX = widthRatio;
                PageScale.ScaleY = widthRatio;
            }
            // scale the content
            this.canvasRoot.RenderTransform = PageScale;
        }
Example #24
0
        void OnSizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            switch (this.Placement)
            {
            case PlacementMode.Left:
            case PlacementMode.Right:

                double targetHeight = 0;

                if (this.PlacementTarget is FrameworkElement)
                {
                    targetHeight = (this.PlacementTarget as System.Windows.FrameworkElement).ActualHeight;
                }

                // Arrow will be drawn on center of the tooltip content, move it up by half size
                this.VerticalOffset = -((this.ActualHeight / 2.0) - (targetHeight / 2.0) - (_arrow.ActualHeight / 2.0) + 1.0);

                break;

            case PlacementMode.Bottom:
            case PlacementMode.Top:
                double targetWidth = 0;

                if (this.PlacementTarget is FrameworkElement)
                {
                    targetWidth = (this.PlacementTarget as System.Windows.FrameworkElement).ActualWidth;
                }

                // Arrow will be drawn on center of the tooltip content, move it left by half size
                this.HorizontalOffset = -((this.ActualWidth / 2.0) - (targetWidth / 2.0) - (_arrow.ActualWidth / 2.0) + 1.0);

                break;
            }
        }
Example #25
0
 private void ChangePictureSize(object sender, SizeChangedEventArgs e)
 {
     mainCanva.Width = mainGrid.ActualWidth - 175;
     mainCanva.Height = mainGrid.ActualHeight;
     schema.Width = mainGrid.ActualWidth - 175;
     schema.Height = mainGrid.ActualHeight;
 }
		private void OnParentSizeChanged(object sender, SizeChangedEventArgs e)
		{
			if (e.WidthChanged)
				Width = e.NewSize.Width - 45;
			if (e.HeightChanged)
				MaxHeight = e.NewSize.Height;
		}
Example #27
0
        void Control_SizeChanged(object sender, sw.SizeChangedEventArgs e)
        {
            // not loaded? don't worry about it.
            if (!Control.IsLoaded)
            {
                return;
            }
            var newDesiredHeight = Control.DesiredSize.Height;

            if (previousDesiredHeight == null)
            {
                // don't update preferred sizes when called the first time.
                // when there's many labels this causes a major slowdown
                // the initial size should already have been taken care of by
                // the initial layout pass.
                previousDesiredHeight = newDesiredHeight;
                return;
            }

            // ignore tiny changes as in some scales (e.g. 150%, 175%) it can cause an endless update cycle
            // Is this needed any more?  We are now only comparing desired size vs. actual, which doesn't
            // appear to have this problem
            if (Math.Abs(previousDesiredHeight.Value - newDesiredHeight) < 1)
            {
                return;
            }

            // update parents when the actual desired height has changed
            // otherwise parent containers won't shrink vertically when it gets wider when wrapped
            previousDesiredHeight = newDesiredHeight;
            if (Wrap != WrapMode.None)
            {
                UpdatePreferredSize();
            }
        }
Example #28
0
 void Surface_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
 {
     if (IsActive)
     {
         Surface.ViewController.ReloadItems();
     }
 }
Example #29
0
 private void OnHelpPageSizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (helpViewer != null && helpViewer.IsInitialized)
     {
         //helpViewer.Width = e.NewSize.Width;
     }
 }
        /// <summary>
        /// Handles the SizeChanged event of the OpenGLControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.SizeChangedEventArgs"/> instance containing the event data.</param>
        void OpenGLControl_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            //  Lock on OpenGL.
            lock (gl)
            {
                int width = (int)e.NewSize.Width;
                int height = (int)e.NewSize.Height;
                gl.SetDimensions(width, height);

                //	Set the viewport.
                gl.Viewport(0, 0, width, height);

                //  If we have a project handler, call it...
                if (width != -1 && height != -1)
                {
                    var handler = Resized;
                    if (handler != null)
                        handler(this, eventArgsFast);
                    else
                    {
                        //  Otherwise we do our own projection.
                        gl.MatrixMode(SharpGL.OpenGL.GL_PROJECTION);
                        gl.LoadIdentity();

                        // Calculate The Aspect Ratio Of The Window
                        gl.Perspective(45.0f, (float)width / (float)height, 0.1f, 100.0f);

                        gl.MatrixMode(SharpGL.OpenGL.GL_MODELVIEW);
                        gl.LoadIdentity();
                    }
                }
            }
        }
 private void NotificationWindowSizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (e.NewSize.Height != 0.0)
         return;
     var element = sender as Grid;
     RemoveNotification(Notifications.First(n => n.Id == Int32.Parse(element.Tag.ToString())));
 }
Example #32
0
        void Control_SizeChanged(object sender, sw.SizeChangedEventArgs e)
        {
            // not loaded? don't worry about it.
            if (!Control.IsLoaded)
            {
                return;
            }
            var newWidth = Control.ActualWidth;

            if (previousWidth == null)
            {
                // don't update preferred sizes when called the first time.
                // when there's many labels this causes a major slowdown
                // the initial size should already have been taken care of by
                // the initial layout pass.
                previousWidth = newWidth;
                return;
            }

            // ignore tiny changes as in some scales (e.g. 150%, 175%) it can cause an endless update cycle
            if (Math.Abs(previousWidth.Value - newWidth) < 1)
            {
                return;
            }
            // update parents when the actual width has changed
            // otherwise it won't shrink vertically when it gets wider
            // when wrapped
            previousWidth = newWidth;
            if (Wrap != WrapMode.None)
            {
                UpdatePreferredSize();
            }
        }
Example #33
0
 void CalendarStrip_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (e.WidthChanged)
     {
         RecalculateDayWidth();
     }
 }
Example #34
0
 private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (ActualWidth > 500)
       {
     Grid.SetRowSpan(upper, 2);
     Grid.SetColumnSpan(upper, 1);
     Grid.SetRow(chat, 0);
     Grid.SetRowSpan(chat, 2);
     Grid.SetColumn(chat, 1);
     Grid.SetColumnSpan(chat, 1);
     Grid.SetColumnSpan(split, 1);
     Grid.SetRowSpan(split, 2);
     upper.Margin = new Thickness(0, 0, 3, 0);
     split.Cursor = Cursors.SizeWE;
     split.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
     split.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
       }
       else
       {
     Grid.SetRowSpan(upper, 1);
     Grid.SetColumnSpan(upper, 2);
     Grid.SetRow(chat, 1);
     Grid.SetRowSpan(chat, 1);
     Grid.SetColumn(chat, 0);
     Grid.SetColumnSpan(chat, 2);
     Grid.SetColumnSpan(split, 2);
     Grid.SetRowSpan(split, 1);
     upper.Margin = new Thickness(0, 0, 0, 3);
     split.Cursor = Cursors.SizeNS;
     split.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
     split.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
       }
 }
        private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            LeftFrame.X1 = 0;
            LeftFrame.X2 = 0;
            LeftFrame.Y1 = 0;
            LeftFrame.Y2 = this.ActualHeight;

            TopFrame.X1 = 0;
            TopFrame.X2 = this.ActualWidth;
            TopFrame.Y1 = 0;
            TopFrame.Y2 = 0;

            RightFrame.X1 = this.ActualWidth;
            RightFrame.X2 = this.ActualWidth;
            RightFrame.Y1 = 0;
            RightFrame.Y2 = this.ActualHeight;

            BottomFrame.X1 = 0;
            BottomFrame.X2 = this.ActualWidth;
            BottomFrame.Y1 = this.ActualHeight;
            BottomFrame.Y2 = this.ActualHeight;

            if (!(myProp is ReportCalibrationDataProp))
                setFrame();
        }
Example #36
0
        private void FloorPlannerDemo_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            var    count      = Math.Round(e.NewSize.Width / 196);
            double marginLeft = (e.NewSize.Width - (((count > 3 ? count - 2 : count - 1) * 196) + 30)) * 0.5;

            this.BackStageArea.Margin = new Thickness(marginLeft, 48, marginLeft, 48);
        }
Example #37
0
        private void this_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            if (!initialSized)
            {
                initialSized = true;
                return;
            }

            terminalControl.Width  = double.NaN;
            terminalControl.Height = double.NaN;

            IntPtr hwnd = new WindowInteropHelper(this).Handle;

            var    transformer    = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice;
            var    stops          = transformer.Transform(new System.Windows.Point(terminalControl.CharWidth, terminalControl.CharHeight));
            double horizontalStop = stops.X;
            double verticalStop   = stops.Y;

            var terminalOffset = terminalControl.TransformToAncestor(root).Transform(new System.Windows.Point(0, 0));

            NativeMethods.RECT windowRect;
            NativeMethods.GetWindowRect(hwnd, out windowRect);

            NativeMethods.RECT clientRect;
            NativeMethods.GetClientRect(hwnd, out clientRect);

            int newCols = (int)((clientRect.right - terminalOffset.X - SystemParameters.ScrollWidth + 1f) / horizontalStop);
            int newRows = (int)((clientRect.bottom - terminalOffset.Y + 1f) / verticalStop);

            viewModel.ChangeSize(newCols, newRows);
        }
Example #38
0
 private void ContentControl_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (this.ClipContent)
     {
         this.UpdateClipSize(new Size(base.ActualWidth, base.ActualHeight));
     }
 }
Example #39
0
 private void ClippingBorder_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (this.ClipContent)
     {
         this.UpdateClipSize(e.NewSize);
     }
 }
Example #40
0
 private void Viewer_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
 {
     if (PropertyChanged != null)
     {
         PropertyChanged(this, new PropertyChangedEventArgs("Scaling"));
     }
 }
Example #41
0
 void ContentGridSizeChanged(object sender, SizeChangedEventArgs e)
 {
     this.sizeValue = this.mainWindow.ActualWidth <= this.mainWindow.ActualHeight ? this.mainWindow.ActualWidth : this.mainWindow.ActualHeight;
     this.startButton.Width = this.sizeValue / 3.5;
     this.startButton.Height = this.sizeValue / 3.5;
     this.startButton.FontSize = this.mainWindow.ActualHeight / 17.5;
 }
Example #42
0
 /// <summary>
 /// WORKAROUND. To show typing text in its current place.
 /// </summary>
 private void MessageTextBox_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
 {
     // if cursor is at the end of the text, scroll the ScrollViewer to the end
     if (MessageTextBox.SelectionStart == MessageTextBox.Text.Length)
     {
         scroller.ScrollToVerticalOffset(MessageTextBox.ActualHeight);
     }
 }
Example #43
0
        private void onSizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            MandelbrotCanvas.Width  = e.NewSize.Width - 20;
            MandelbrotCanvas.Height = e.NewSize.Height - 130;

            m = new Mandelbrot.Mandelbrot((int)MandelbrotCanvas.Width, (int)MandelbrotCanvas.Height,
                                          m.Zoom, m.Center);
        }
Example #44
0
 private void NotPage_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
 {
     // 设置控件的宽度,高度默认即可
     //foreach (var btn in CurCtrl)
     //{
     //    btn.Width = this.Width;
     //}
 }
Example #45
0
        void thumb_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            Thumb thumb = sender as Thumb;
            var   item  = thumb.DataContext as PrintTemplateItemViewModelCommon;

            item.Width  = (int)thumb.Width;
            item.Height = (int)thumb.Height;
        }
Example #46
0
        private void OnCanvasSizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            // Recalculate properties
            CalculateCanvasProperties();

            // Redraw current vessels
            DrawVessels(currentVessels);
        }
Example #47
0
 void Control_SizeChanged(object sender, sw.SizeChangedEventArgs e)
 {
     SetMaxTiles();
     UpdateTiles(true);
     Invalidate();
     content.Width  = e.NewSize.Width;
     content.Height = e.NewSize.Height;
 }
Example #48
0
        private void Knob_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            zeroAnglePoint = new Point(this.Width / 2, 0);
            centerPoint    = new Point(this.Width / 2, this.Height / 2);

            controlWidth  = this.RenderSize.Width;
            controlHeight = this.RenderSize.Height;
        }
Example #49
0
 private void drawingSurface_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
 {
     if (_simulation == null)
     {
         return;
     }
     _simulation.Boundry = new Rect(0, 0, drawingSurface.ActualWidth, ActualHeight);
     aspectRatio         = (float)(drawingSurface.ActualWidth / drawingSurface.ActualHeight);
 }
Example #50
0
        void LcdSizeBehavior_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            var xscale = Math.Floor(e.NewSize.Width / LcdDevice.Width);
            var yscale = Math.Floor(e.NewSize.Height / LcdDevice.Height);
            var scale  = Math.Min(xscale, yscale);
            var image  = AssociatedObject as Image;

            image.Width  = scale * LcdDevice.Width;
            image.Height = scale * LcdDevice.Height;
        }
Example #51
0
 private void UserControl_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
 {
     // try
     // {
     //document.getElementById("silverlightControlHost").style.height="300px";
     HtmlPage.Plugin.SetProperty("height", e.NewSize.Height);
     //Dispatcher.BeginInvoke(() => { MessageBox.Show("Control resized"); });
     //}
     // catch { }
 }
Example #52
0
        private void AttachedCanvas_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            if (Config != null) // this should only fail first time w/ no configuration
            {
                Config.Recompute(AttachedCanvas.ActualWidth, AttachedCanvas.ActualHeight);
            }

            DrawGrid();
            AdjustLocationsAfterResize();
        }
        private async void GifImage_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            if (this.DataContext != null && this.GifImage != null && this.GifImage.Source != null && this.GifImage.Source.Height > 10)
            {
                this.GroupBox.Visibility = Visibility.Visible;
                await Task.Delay(9000);

                this.GroupBox.Visibility = Visibility.Hidden;
                this.DataContext         = null;
            }
        }
Example #54
0
 public void ReSizeEventArgs(object sender, System.Windows.SizeChangedEventArgs e)
 {
     if (e.WidthChanged)
     {
         this.Height = ((this.Width) / bitmap.Width) * bitmap.Height;
     }
     if (e.HeightChanged)
     {
         this.Width = ((this.Height) / bitmap.Height) * bitmap.Width;
     }
 }
        private void MainCanvas_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            var width = e.NewSize.Width;// - MainCanvas.Margin.Left - MainCanvas.Margin.Right;

            if (width < MainCanvas.MinWidth)
            {
                width = MainCanvas.MinWidth;
            }
            if (width > MainCanvas.MaxWidth)
            {
                width = MainCanvas.MaxWidth;
            }
            //MainCanvas.Width = width;

            var height = e.NewSize.Height;// - MainCanvas.Margin.Top - MainCanvas.Margin.Bottom;

            if (height < MainCanvas.MinHeight)
            {
                height = MainCanvas.MinHeight;
            }
            if (height > MainCanvas.MaxHeight)
            {
                height = MainCanvas.MaxHeight;
            }
            //MainCanvas.Height = height;

            double widthDelta  = 1.0;
            double heightDelta = 1.0;

            if (e.PreviousSize.Width != 0 && e.PreviousSize.Height != 0)
            {
                widthDelta  = e.NewSize.Width / e.PreviousSize.Width;
                heightDelta = e.NewSize.Height / e.PreviousSize.Height;
            }
            else
            {
                widthDelta  = e.NewSize.Width / BezierWidth;
                heightDelta = e.NewSize.Height / BezierHeight;
            }

            BezierWidth  = width;
            BezierHeight = height;

            for (int i = 0; i < mBezierPoints.Count; i++)
            {
                var bzPoint = mBezierPoints[i] as BezierPoint;
                bzPoint.OpYPosition     = new Point(bzPoint.OpYPosition.X * widthDelta, bzPoint.OpYPosition.Y * heightDelta);
                bzPoint.OpYControlPoint = new Point(bzPoint.OpYControlPoint.X * widthDelta, bzPoint.OpYControlPoint.Y * heightDelta);
            }

            UpdateKeyPoint(true);
            UpdateLineXBezierShow();
        }
Example #56
0
        void UiPreviewCanvasSizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            if (_myShapeListRef != null)
            {
                // Trovo ingombro della scena , serve per la normalizzazione delle coordinate
                _latoMaxScena = 0;

                FindMaxExtensionsFromList(_myShapeListRef, ref _latoMaxScena);

                DrawScene();
            }
        }
Example #57
0
 void Control_SizeChanged(object sender, sw.SizeChangedEventArgs e)
 {
     if (previousRenderSize == Control.RenderSize)
     {
         return;
     }
     // update parents only when the render size has changed
     previousRenderSize = Control.RenderSize;
     if (Wrap != WrapMode.None)
     {
         UpdatePreferredSize();
     }
 }
Example #58
0
        private void Window_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            if (AssociatedObject.Parent != null)
            {
                var newOrientation = Window.Width >= Window.Height ? Orientation.Horizontal : Orientation.Vertical;

                if (!CurrentOrientation.HasValue || CurrentOrientation.Value != newOrientation)
                {
                    CurrentOrientation = newOrientation;
                    ApplyPanelOrientation();
                }
            }
        }
Example #59
0
        void Control_SizeChanged(object sender, sw.SizeChangedEventArgs e)
        {
            if (virtualChildren == null)
            {
                return;
            }
            UpdateCanvas();
            var parent = Control.GetParent <Microsoft.Sample.Controls.VirtualCanvas> ();

            if (parent != null)
            {
                parent.InvalidateArrange();
                //parent.InvalidateVisual ();
            }
        }
Example #60
0
        private void StatsDataGrid_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            if (!(sender is DataGrid dataGrid))
            {
                return;
            }

            var availableColumnSpace = GetCombinedColumnWidth();
            var rowCount             = dataGrid.Items.Count;

            // Calculate how wide the columns should be, rounding down
            var targetColumnWidth = (int)(availableColumnSpace / rowCount);

            dataGrid.RowHeight = targetColumnWidth;
        }