当前位置: 首页>>代码示例>>C#>>正文


C# UIElement.Arrange方法代码示例

本文整理汇总了C#中UIElement.Arrange方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.Arrange方法的具体用法?C# UIElement.Arrange怎么用?C# UIElement.Arrange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIElement的用法示例。


在下文中一共展示了UIElement.Arrange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArrangeChild

		private void ArrangeChild(int itemIndex, UIElement child, Size finalSize) {
			if (Tile) {
				var num = CalculateChildrenPerRow(finalSize);
				var num2 = itemIndex / num;
				var num3 = itemIndex % num;
				child.Arrange(new Rect(num3 * ChildHeight, num2 * ChildHeight, ChildHeight, ChildHeight));
			}
			else {
				var width = CalculateChildWidth(finalSize);
				var num5 = itemIndex / Columns;
				var num6 = itemIndex % Columns;
				child.Arrange(new Rect(num6 * width, num5 * ChildHeight, width, ChildHeight));
			}
		}
开发者ID:CyberFoxHax,项目名称:PCSXBonus,代码行数:14,代码来源:VirtualizingTilePanel.cs

示例2: Arrange

			public override void Arrange(AdornerPanel panel, UIElement adorner, Size adornedElementSize)
			{
				adorner.Arrange(new Rect(column.Offset - GridRailAdorner.SplitterWidth / 2,
				                         -(GridRailAdorner.RailSize + GridRailAdorner.RailDistance),
				                         GridRailAdorner.SplitterWidth,
				                         GridRailAdorner.RailSize + GridRailAdorner.RailDistance + adornedElementSize.Height));
			}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:GridAdornerProvider.cs

示例3: ArrangeChild

 private void ArrangeChild(int itemIndex, UIElement child, Size finalSize)
 {
     if (this.Tile)
     {
         int num = this.CalculateChildrenPerRow(finalSize);
         int num2 = itemIndex / num;
         int num3 = itemIndex % num;
         child.Arrange(new Rect(num3 * this.ChildHeight, num2 * this.ChildHeight, this.ChildHeight, this.ChildHeight));
     }
     else
     {
         double width = this.CalculateChildWidth(finalSize);
         int num5 = itemIndex / this.Columns;
         int num6 = itemIndex % this.Columns;
         child.Arrange(new Rect(num6 * width, num5 * this.ChildHeight, width, this.ChildHeight));
     }
 }
开发者ID:CyberFoxHax,项目名称:PCSXBonus,代码行数:17,代码来源:VirtualizingTilePanel.cs

示例4: InvalidateArrange

		private void InvalidateArrange(UIElement uiElement) {
			if (plotter == null)
				return;

			var transform = plotter.Transform;
			var childBounds = GetElementBounds(transform, uiElement);

			uiElement.Arrange(childBounds);
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:9,代码来源:ViewportRectPanel.cs

示例5: PopupRoot

        public PopupRoot(Point location, UIElement child)
        {
            this.PresentationSource = PlatformInterface.Instance.CreatePopupPresentationSource();
            this.PresentationSource.RootVisual = this;
            this.Child = child;

            Size clientSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
            child.Measure(clientSize);
            child.Arrange(new Rect(child.DesiredSize));

            this.PresentationSource.BoundingRect = new Rect(location, child.RenderSize);

            this.PresentationSource.Show();
            child.InvalidateVisual();
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:15,代码来源:PopupRoot.cs

示例6: ArrangeChild

 /// Position a child
 private void ArrangeChild(int itemIndex, UIElement child, Size finalSize)
 {
     int childrenPerRow = CalculateChildrenPerRow(finalSize);
     int row = itemIndex/childrenPerRow;
     int column = itemIndex%childrenPerRow;
     child.Arrange(new Rect(column*ChildWidth, row*ChildHeight, ChildWidth, ChildHeight));
 }
开发者ID:jonbonne,项目名称:OCTGN,代码行数:8,代码来源:VirtualizingWrapPanel.cs

示例7: ArrangeChild

 private void ArrangeChild(UIElement child, double finalMainStart, double finalCrossStart, double finalMainLength, double finalCrossLength)
 {
     child.Arrange(Orientation == Orientation.Horizontal ?
         new Rect(finalMainStart, finalCrossStart, finalMainLength.Max(0), finalCrossLength.Max(0)) :
         new Rect(finalCrossStart, finalMainStart, finalCrossLength.Max(0), finalMainLength.Max(0)));
 }
开发者ID:highzion,项目名称:Granular,代码行数:6,代码来源:Track.cs

示例8: OptimizeSize

        /// <summary>
        /// Optimizes the size of a panel.
        /// </summary>
        /// <param name="panel">The panel to optimize.</param>
        /// <param name="minWidth">The minimum width.</param>
        /// <param name="maxWidth">The maximum width.</param>
        /// <returns>The desired size.</returns>
        private static double OptimizeSize(UIElement panel, double minWidth, double maxWidth)
        {
            double width;

            // optimize size
            for (width = minWidth; width < maxWidth; width += 50)
            {
                panel.Measure(new Size(width, width + 1));
                if (panel.DesiredSize.Height <= width)
                {
                    break;
                }
            }

            panel.Arrange(new Rect(0, 0, width, width));

            return width;
        }
开发者ID:ondrej11,项目名称:o106,代码行数:25,代码来源:TextGroupVisual3D.cs

示例9: ArrangeChild

 /// <summary>
 /// Position a child
 /// </summary>
 /// <param name="itemIndex">The data item index of the child</param>
 /// <param name="child">The element to position</param>
 /// <param name="finalSize">The size of the panel</param>
 private void ArrangeChild(int itemIndex, UIElement child, Size finalSize)
 {
     child.Arrange(GetChildRect(itemIndex, finalSize));
 }
开发者ID:Choi-Insu,项目名称:arrengers,代码行数:10,代码来源:VirutalStackPanel.cs

示例10: saveToJpg

        public static void saveToJpg(UIElement source, string filename, String link, bool include_exif, int quality=100)
        {
            RenderOptions.SetEdgeMode(source, EdgeMode.Aliased);
            RenderOptions.SetBitmapScalingMode(source, BitmapScalingMode.HighQuality);
            source.SnapsToDevicePixels = true;
            source.Measure(source.RenderSize);//new System.Windows.Size(source.RenderSize.Width, source.RenderSize.Height));
            source.Arrange(new Rect(source.RenderSize));//new System.Windows.Rect(0.0, 0.0, 320.0, 240.0));
            //RenderOptions.SetBitmapScalingMode(source, BitmapScalingMode.Linear);
            
            RenderTargetBitmap rtbImage = new RenderTargetBitmap(CMSConfig.imagewidth,
               CMSConfig.imageheight,
               96,
               96,
               PixelFormats.Default);
            
            rtbImage.Render(source);
            
            JpegBitmapEncoder encoder = new JpegBitmapEncoder();

         /*   String v = "http://radiodns1.ebu.ch/";
            BitmapMetadata m = new BitmapMetadata("jpg");
            //m.Comment = v; 37510
            m.SetQuery("/app1/ifd/exif:{uint=270}", v);*/
            //BitmapFrame outputFrame = BitmapFrame.Create(rtbImage, rtbImage, m, null);

            int width = rtbImage.PixelWidth;
            int height = rtbImage.PixelHeight;
            int stride = width * ((rtbImage.Format.BitsPerPixel + 7) / 8);

            byte[] bits = new byte[height * stride];

            MemoryStream mem = new MemoryStream();
            BitmapEncoder bitmapenc = new BmpBitmapEncoder();
            bitmapenc.Frames.Add(BitmapFrame.Create(rtbImage));

            bitmapenc.Save(mem);


            Bitmap bmp1 = new Bitmap(mem);
            
            ImageCodecInfo jgpEncoder = GetEncoder(ImageFormat.Jpeg);

            // Create an Encoder object based on the GUID
            // for the Quality parameter category.
            System.Drawing.Imaging.Encoder myEncoder =
                System.Drawing.Imaging.Encoder.Compression;
            System.Drawing.Imaging.Encoder myEncoder2 =
                System.Drawing.Imaging.Encoder.Quality;

            
            // Create an EncoderParameters object.
            // An EncoderParameters object has an array of EncoderParameter
            // objects. In this case, there is only one
            // EncoderParameter object in the array.
            EncoderParameters myEncoderParameters = new EncoderParameters(2);

            EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 0L);
            EncoderParameter myEncoderParameter2 = new EncoderParameter(myEncoder2, quality);
            myEncoderParameters.Param[0] = myEncoderParameter;
            myEncoderParameters.Param[1] = myEncoderParameter2;
            bmp1.Save(filename, jgpEncoder, myEncoderParameters);

            /*
            BitmapFrame outputFrame = BitmapFrame.Create(rtbImage);
            
            encoder.QualityLevel = quality;
            encoder.Frames.Add(outputFrame);
            */
            /*
            try
            {
                using (FileStream file = File.OpenWrite(filename))
                {
                    encoder.Save(file);
                    file.Close();
                    
                }
            }
            catch(Exception e)
            {
                Console.WriteLine("Error writting files\n"+e.Message);
            }*/
        }
开发者ID:muzefm,项目名称:ebucms,代码行数:83,代码来源:SlideGenerator.cs

示例11: SetElementLocation

        protected void SetElementLocation(UIElement e, Rect finalRect, bool isAnimated)
        {
            // update the element's state
            ElementState state = null;

            if (states.ContainsKey(e))
            {
                state = states[e];
            }
            else
            {
                state = new ElementState(finalRect, this.Randomness);
                states.Add(e, state);
            }

            // set the final rectangle and kick of the timer

            if (isAnimated && IsAnimationEnabled)
            {
                if (!state.NeedsArrange)
                {
                    state.NeedsArrange = true;
                    animatingCount++;
                }

                state.TargetRect = finalRect;

                // make sure that the timer is running
                StartTimer();
            }
            else
            {
                e.Arrange(finalRect);
                state.CurrentRect = finalRect;

                if (state.NeedsArrange)
                {
                    state.NeedsArrange = false;
                    animatingCount--;
                }
            }
        }
开发者ID:keyanmca,项目名称:_Signage,代码行数:42,代码来源:AnimatingPanelBase.cs

示例12: Arrange

			public override void Arrange(AdornerPanel panel, UIElement adorner, Size adornedElementSize)
			{
				Point p = _element.TranslatePoint(new Point(), panel.AdornedElement);
				var rect = new Rect(p, _element.RenderSize);
				rect.Inflate(3, 1);
				adorner.Arrange(rect);
			}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:7,代码来源:InPlaceEditorExtension.cs

示例13: ArrangeChild

 private void ArrangeChild(int itemIndex, UIElement child)
 {
     child.Arrange(new Rect(_itemPositionOffsets[itemIndex], 0, //_itemPositionOffsets[itemIndex] - HorizontalOffset, -VerticalOffset,
                            _itemPositionOffsets[itemIndex + 1] - _itemPositionOffsets[itemIndex], child.DesiredSize.Height));
 }
开发者ID:TomGillen,项目名称:MBT,代码行数:5,代码来源:PanoramaPanel.cs

示例14: TestNoInvalidation

 public static void TestNoInvalidation(UIElement element, Action changeProperty)
 {
     element.Measure(Vector3.Zero);
     element.Arrange(Vector3.Zero, false);
     changeProperty();
     Assert.IsTrue(element.IsMeasureValid);
     Assert.IsTrue(element.IsArrangeValid);
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:8,代码来源:UIElementLayeringTests.cs

示例15: ArrangeChild

        /// <summary>
        ///     Method which arranges the give child
        ///     based on given arrange state.
        ///     
        ///     Determines the start position of the child
        ///     based on its display index, frozen count of 
        ///     datagrid, current horizontal offset etc.
        /// </summary>
        private void ArrangeChild(
            UIElement child,
            int displayIndex,
            ArrangeState arrangeState)
        {
            Debug.Assert(child != null, "child cannot be null.");
            double childWidth = 0.0;
            IProvideDataGridColumn cell = child as IProvideDataGridColumn;

            // Determine if this child was clipped in last arrange for the sake of frozen columns
            if (child == _clippedChildForFrozenBehaviour)
            {
                arrangeState.OldClippedChild = child;
                _clippedChildForFrozenBehaviour = null;
            }

            // Width determinition of the child to be arranged. It is 
            // display value if available else the ActualWidth
            if (cell != null)
            {
                Debug.Assert(cell.Column != null, "column cannot be null.");
                childWidth = cell.Column.Width.DisplayValue;
                if (DoubleUtil.IsNaN(childWidth))
                {
                    childWidth = cell.Column.ActualWidth;
                }
            }
            else
            {
                childWidth = child.DesiredSize.Width;
            }

            Rect rcChild = new Rect(new Size(childWidth, arrangeState.ChildHeight));

            // Determinition of start point for children to arrange. Lets say the there are 5 columns of which 2 are frozen.
            // If the datagrid is scrolled horizontally. Following is the snapshot of arrange
            /*
                    *                                                                                                    *
                    *| <Cell3> | <Unarranged space> | <RowHeader> | <Cell1> | <Cell2> | <Right Clip of Cell4> | <Cell5> |*
                    *                               |                        <Visible region>                           |*
             */
            if (displayIndex < arrangeState.FrozenColumnCount)
            {
                // For all the frozen children start from the horizontal offset
                // and arrange increamentally
                rcChild.X = arrangeState.NextFrozenCellStart;
                arrangeState.NextFrozenCellStart += childWidth;
                arrangeState.DataGridHorizontalScrollStartX += childWidth;
            }
            else
            {
                // For arranging non frozen children arrange which ever can be arranged
                // from the start to horizontal offset. This would fill out the space left by
                // frozen children. The next one child will be arranged and clipped accordingly past frozen 
                // children. The remaining children will arranged in the remaining space.
                if (DoubleUtil.LessThanOrClose(arrangeState.NextNonFrozenCellStart, arrangeState.ViewportStartX))
                {
                    if (DoubleUtil.LessThanOrClose(arrangeState.NextNonFrozenCellStart + childWidth, arrangeState.ViewportStartX))
                    {
                        rcChild.X = arrangeState.NextNonFrozenCellStart;
                        arrangeState.NextNonFrozenCellStart += childWidth;
                    }
                    else
                    {
                        double cellChoppedWidth = arrangeState.ViewportStartX - arrangeState.NextNonFrozenCellStart;
                        if (DoubleUtil.AreClose(cellChoppedWidth, 0.0))
                        {
                            rcChild.X = arrangeState.NextFrozenCellStart;
                            arrangeState.NextNonFrozenCellStart = arrangeState.NextFrozenCellStart + childWidth;
                        }
                        else
                        {
                            rcChild.X = arrangeState.NextFrozenCellStart - cellChoppedWidth;
                            double clipWidth = childWidth - cellChoppedWidth;
                            arrangeState.NewClippedChild = child;
                            _childClipForFrozenBehavior.Rect = new Rect(cellChoppedWidth, 0, clipWidth, rcChild.Height);
                            arrangeState.NextNonFrozenCellStart = arrangeState.NextFrozenCellStart + clipWidth;
                        }
                    }
                }
                else
                {
                    rcChild.X = arrangeState.NextNonFrozenCellStart;
                    arrangeState.NextNonFrozenCellStart += childWidth;
                }
            }

            child.Arrange(rcChild);
        }
开发者ID:pusp,项目名称:o2platform,代码行数:97,代码来源:DataGridCellsPanel.cs


注:本文中的UIElement.Arrange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。