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


C# Foundation.Rect类代码示例

本文整理汇总了C#中Windows.Foundation.Rect的典型用法代码示例。如果您正苦于以下问题:C# Rect类的具体用法?C# Rect怎么用?C# Rect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Reset

            public void Reset()
            {
                Children.Clear();
                InvalidateArrange();
                content = null;
                contentsCenter = new Rect(0, 0, 1, 1);
                contentGravity = ContentGravity.Resize;
                Clip = null;
                InvOriginTransform = new TranslateTransform();
                ClipGeometry = new RectangleGeometry();
                ClipGeometry.Transform = InvOriginTransform;
                RenderTransform = new TranslateTransform();
                _position = new Point(0, 0);
                _origin = new Point(0, 0);
                _size = new Size(0, 0);
                _hidden = false;
                originSet = false;
                _createdTransforms = false;
                LayerOpacity = 1.0;
                backgroundBrush = TransparentBrush;
                backgroundColor.R = 0;
                backgroundColor.G = 0;
                backgroundColor.B = 0;
                backgroundColor.A = 0;

                Set("anchorPoint", new Point(0.5, 0.5));
                _masksToBounds = false;

                this.Background = TransparentBrush;
            }
开发者ID:Strongc,项目名称:WinObjC,代码行数:30,代码来源:CALayerXaml.cs

示例2: Attach

        public void Attach(DependencyObject associatedObject)
        {
            if ((associatedObject != AssociatedObject) && !DesignMode.DesignModeEnabled)
            {
                if (AssociatedObject != null)
                    throw new InvalidOperationException("Cannot attach behavior multiple times.");

                AssociatedObject = associatedObject;
                var control = AssociatedObject as FrameworkElement;
                if (control == null)
                {
                    throw new InvalidOperationException("Cannot attach behavior you must have Control.");
                }
                popupInputPane = InputPane.GetForCurrentView();
                popupInputPane.Showing += popupInputPane_Showing;
                popupInputPane.Hiding += popupInputPane_Hiding;
                Window.Current.SizeChanged += Current_SizeChanged;

                var popup = ((FrameworkElement) AssociatedObject).Parent as Popup;
                if (popup == null) return;
                //키보드가 보인다는 이야기
                orignalRect = new Rect
                {
                    X = popup.HorizontalOffset,
                    Y = popup.VerticalOffset,
                    Width = ((FrameworkElement) AssociatedObject).Width,
                    Height = ((FrameworkElement) AssociatedObject).Height
                };
                resizePopup();
            }
        }
开发者ID:vapps,项目名称:CrossPlatform,代码行数:31,代码来源:SizeChangeBehavior.cs

示例3: ExtendedSplash

        public ExtendedSplash(SplashScreen splashscreen, bool loadState)
        {
            InitializeComponent();

            // Listen for window resize events to reposition the extended _splash screen image accordingly.
            // This is important to ensure that the extended _splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
            Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);

            _splash = splashscreen;

            if (_splash != null)
            {
                // Register an event handler to be executed when the _splash screen has been Dismissed.
                _splash.Dismissed += DismissedEventHandler;

                // Retrieve the window coordinates of the _splash screen image.
                SplashImageRect = _splash.ImageLocation;
                PositionImage();

                // Optional: Add a progress ring to your _splash screen to show users that content is loading
                PositionRing();
            }

            // Create a Frame to act as the navigation context
            RootFrame = new Frame();

            // Restore the saved session state if necessary
            Task.Run(async () => await RestoreStateAsync(loadState));
        }
开发者ID:davidvidmar,项目名称:MobilnaPoraba,代码行数:29,代码来源:ExtendedSplash.xaml.cs

示例4: ExtendedSplash

        public ExtendedSplash(SplashScreen splashscreen, bool loadState)
        {
            InitializeComponent();

            // Listen for window resize events to reposition the extended splash screen image accordingly.
            // This is important to ensure that the extended splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
            Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);

            splash = splashscreen;

            if (splash != null)
            {
                // Register an event handler to be executed when the splash screen has been dismissed.
                splash.Dismissed += new TypedEventHandler<SplashScreen, Object>(DismissedEventHandler);

                // Retrieve the window coordinates of the splash screen image.
                splashImageRect = splash.ImageLocation;
                PositionImage();

                PositionRing();
            }

            // Create a Frame to act as the navigation context
            rootFrame = new Frame();

            RestoreStateAsync(true).Wait();
        }
开发者ID:diagonalwalnut,项目名称:GodTools,代码行数:27,代码来源:ExtendedSplash.xaml.cs

示例5: Splash

        private SplashScreen splash; // Variable to hold the splash screen object.

        public Splash(SplashScreen splashscreen, bool loadState)
        {
            InitializeComponent();

            //LearnMoreButton.Click += new RoutedEventHandler(LearnMoreButton_Click);
            // Listen for window resize events to reposition the extended splash screen image accordingly.
            // This is important to ensure that the extended splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
            Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);

            splash = splashscreen;

            if (splash != null)
            {
                // Register an event handler to be executed when the splash screen has been dismissed.
                splash.Dismissed += new TypedEventHandler<SplashScreen, Object>(DismissedEventHandler);

                // Retrieve the window coordinates of the splash screen image.
                splashImageRect = splash.ImageLocation;
                PositionImage();
            }

            // Create a Frame to act as the navigation context
            rootFrame = new Frame();

            // Restore the saved session state if necessary
            RestoreStateAsync(loadState);


           // await Task.Delay(5000);
            //Waiting();

            //rootFrame.Navigate(typeof(MainPage));

            //Window.Current.Content = rootFrame;
        }
开发者ID:Zainabalhaidary,项目名称:Clinic,代码行数:37,代码来源:Splash.xaml.cs

示例6: XyAxis

        public XyAxis(Rect rect)
        {
            _rect = rect;
            _stroq = new Stroq();
            _stroq.Points.Add(new Point(rect.X, rect.Y));
            _stroq.Points.Add(new Point(rect.X, rect.Y + rect.Height));
            _stroq.Points.Add(new Point(rect.X + rect.Width,
                rect.Y + rect.Height));

            _hotspots = new Dictionary<XyAxisLabelPosition, Rect>();

            int maxDelta = 100;
            int nw = (int) _rect.Width/3;
            int nh = (int) _rect.Height/3;

            var ytop = new Rect(_rect.X - maxDelta, _rect.Y, nw, nh);
            var ycenter = new Rect(_rect.X - maxDelta, _rect.Y + nh, nw, nh);
            var ybottom = new Rect(_rect.X - maxDelta, _rect.Y + nh*2, nw, nh);

            var xleft = new Rect(_rect.X, _rect.Y + _rect.Height, nw, nh);
            var xcenter = new Rect(_rect.X + nw, _rect.Y + _rect.Height, nw, nh);
            var xright = new Rect(_rect.X + nw*2, _rect.Y + _rect.Height, nw, nh);

            _hotspots[XyAxisLabelPosition.Y_Top] = ytop;
            _hotspots[XyAxisLabelPosition.Y_Center] = ycenter;
            _hotspots[XyAxisLabelPosition.Y_Bottom] = ybottom;
            _hotspots[XyAxisLabelPosition.X_Left] = xleft;
            _hotspots[XyAxisLabelPosition.X_Center] = xcenter;
            _hotspots[XyAxisLabelPosition.X_Right] = xright;
        }
开发者ID:philllies,项目名称:finalproject,代码行数:30,代码来源:XyAxis.cs

示例7: MergePixels

        private static void MergePixels(byte[] pixels1, int width, byte[] pixels2, Rect rect)
        {
            try
            {
                int x0 = (int)rect.X;
                int y0 = (int)rect.Y;
                int stride = (int)rect.Width;

                for (int y = 0; y < rect.Height; y++)
                {
                    for (int x = 0; x < rect.Width; x++)
                    {
                        int index1 = (x0 + x + (y0 + y) * width) * 4;
                        int index2 = (x + y * stride) * 4;
                        if (pixels2[index2 + 3] > 0)
                        {
                            pixels1[index1 + 0] = pixels2[index2 + 0];
                            pixels1[index1 + 1] = pixels2[index2 + 1];
                            pixels1[index1 + 2] = pixels2[index2 + 2];
                            pixels1[index1 + 3] = pixels2[index2 + 3];
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("MergePixels. {0}", ex.Message);
            }
        }
开发者ID:ridomin,项目名称:waslibs,代码行数:29,代码来源:GifControl.Tools.cs

示例8: LoginPage

        //public LoginPageViewModel vm { get; private set; }
        public LoginPage()
        {
            this.InitializeComponent();
            DataContextChanged += LoginPage_DataContextChanged;
            _toRegSb = new Storyboard();
            Duration duration = new Duration(TimeSpan.FromSeconds(0.2));
            _logspda = new DoubleAnimation()
            {
                From = 0,
                To = -FrameWidth,
                AutoReverse = false,
                Duration = duration
            };
            _regspda = new DoubleAnimation()
            {
                From = FrameWidth,
                To = 0,
                AutoReverse = false,
                Duration = duration
            };
            Storyboard.SetTargetProperty(_regspda, "(UIElement.RenderTransform).(CompositeTransform.TranslateX)");
            Storyboard.SetTargetProperty(_logspda, "(UIElement.RenderTransform).(CompositeTransform.TranslateX)");
            Storyboard.SetTarget(_logspda, logSP);
            Storyboard.SetTarget(_regspda, regSP);

            _toRegSb.Children.Add(_regspda);
            _toRegSb.Children.Add(_logspda);

            Rect rect = new Rect(0, 0, FrameWidth, 300);
            RectangleGeometry reo = new RectangleGeometry();
            reo.Rect = rect;
            this.infoBorder.Clip = reo;
        }
开发者ID:csongysun,项目名称:HJXYT,代码行数:34,代码来源:LoginPage.xaml.cs

示例9: DrawDrawingSurface

        void DrawDrawingSurface()
        {
            ++drawCount;

            using (var ds = CanvasComposition.CreateDrawingSession(drawingSurface))
            {
                ds.Clear(Colors.Transparent);

                var rect = new Rect(new Point(2, 2), (drawingSurface.Size.ToVector2() - new Vector2(4, 4)).ToSize());

                ds.FillRoundedRectangle(rect, 15, 15, Colors.LightBlue);
                ds.DrawRoundedRectangle(rect, 15, 15, Colors.Gray, 2);

                ds.DrawText("This is a composition drawing surface", rect, Colors.Black, new CanvasTextFormat()
                {
                    FontFamily = "Comic Sans MS",
                    FontSize = 32,
                    WordWrapping = CanvasWordWrapping.WholeWord,
                    VerticalAlignment = CanvasVerticalAlignment.Center,
                    HorizontalAlignment = CanvasHorizontalAlignment.Center
                });

                ds.DrawText("Draws: " + drawCount, rect, Colors.Black, new CanvasTextFormat()
                {
                    FontSize = 10,
                    VerticalAlignment = CanvasVerticalAlignment.Bottom,
                    HorizontalAlignment = CanvasHorizontalAlignment.Center
                });
            }
        }
开发者ID:fengweijp,项目名称:Win2D,代码行数:30,代码来源:DrawingSurfaceRenderer.cs

示例10: CreateSecondaryTileFromWebImage

 public async static Task CreateSecondaryTileFromWebImage(string title, string id, Uri image, Rect TileProptRect, string navigateUri)
 {
     try
     {
         string filename = string.Format("{0}.png", id);
         //download thumb
         HttpClient httpClient = new HttpClient();
         var response = await httpClient.GetAsync(image);
         var imageFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);
         using (var fs = await imageFile.OpenAsync(FileAccessMode.ReadWrite))
         {
             using (var outStream = fs.GetOutputStreamAt(0))
             {
                 DataWriter writer = new DataWriter(outStream);
                 writer.WriteBytes(await response.Content.ReadAsByteArrayAsync());
                 await writer.StoreAsync();
                 writer.DetachStream();
                 await outStream.FlushAsync();
             }
         }
         await DarkenImageBottom(filename, filename); //in-place replacement of downloaded image
         Uri logo = new Uri(string.Format("ms-appdata:///local/{0}", filename));
         CreateSecondaryTile(title, id, logo, TileProptRect, navigateUri);
     }
     catch
     {
         //oops
     }
 }
开发者ID:Esri,项目名称:arcgis-portalviewer-dotnet,代码行数:29,代码来源:TileService.cs

示例11: ImageInfo

 public ImageInfo(CanvasRenderTarget image, Point offset, Rect symbolBounds, Rect imageBounds)
 {
     _crt = image;
     _offset = offset;
     _symbolBounds = symbolBounds;
     _imageBounds = imageBounds;
 }
开发者ID:michael-spinelli,项目名称:Renderer2525C-W10-UWP,代码行数:7,代码来源:ImageInfo.cs

示例12: ExtendedSplashScreen

        public ExtendedSplashScreen(SplashScreen splashscreen)
        {
            InitializeComponent();

            // Listen for window resize events to reposition the extended splash screen image accordingly.
            // This ensures that the extended splash screen formats properly in response to window resizing.
            Window.Current.SizeChanged += ExtendedSplash_OnResize;

            _splash = splashscreen;
            if (_splash != null)
            {
                // Register an event handler to be executed when the splash screen has been dismissed.
                _splash.Dismissed += DismissedEventHandler;

                // Retrieve the window coordinates of the splash screen image.
                _splashImageRect = _splash.ImageLocation;
                PositionImage();

                // If applicable, include a method for positioning a progress control.
                PositionRing();
            }

            // Create a Frame to act as the navigation context
            _rootFrame = new Frame();

            this.Loaded += async (sender, args) => { await this.AppBootstrapper(); };
        }
开发者ID:cjgaliana,项目名称:XamarinVideos,代码行数:27,代码来源:ExtendedSplashScreen.xaml.cs

示例13: ExtendedSplash

        public ExtendedSplash(SplashScreen splashscreen, bool loadState)
        {
            InitializeComponent();
            setuptitle();
            LoginVM vm = this.DataContext as LoginVM;
            STARTUP(vm);

          //  LearnMoreButton.Click += new RoutedEventHandler(LearnMoreButton_Click);
            // Listen for window resize events to reposition the extended splash screen image accordingly.
            // This is important to ensure that the extended splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
            Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);

            ScaleFactor = (double)DisplayInformation.GetForCurrentView().ResolutionScale / 100;

            splash = splashscreen;

            if (splash != null)
            {
                // Register an event handler to be executed when the splash screen has been dismissed.
                splash.Dismissed += new TypedEventHandler<SplashScreen, Object>(DismissedEventHandler);

                // Retrieve the window coordinates of the splash screen image.
                splashImageRect = splash.ImageLocation;
                PositionImage();
            }

            // Create a Frame to act as the navigation context
            rootFrame = new Frame();

            // Restore the saved session state if necessary
            RestoreStateAsync(loadState);
        }
开发者ID:wouterDumon,项目名称:AppDevWindows-Gardnr,代码行数:32,代码来源:ExtendedSplash.xaml.cs

示例14: ExtendedSplashPage

        public ExtendedSplashPage(SplashScreen splashscreen, bool loadState) {
            this.InitializeComponent();
            // Listen for window resize events to reposition the extended splash screen image accordingly.
            // This ensures that the extended splash screen formats properly in response to window resizing.
            Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);
            
            // Is this a phone? Then set the scaling factor
            if (String.Equals(AnalyticsInfo.VersionInfo.DeviceFamily, "Windows.Mobile")) {
                scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
            }
            
            splash = splashscreen;
            if (splash != null) {
                // Register an event handler to be executed when the splash screen has been dismissed.
                splash.Dismissed += new TypedEventHandler<SplashScreen, Object>(DismissedEventHandler);

                // Retrieve the window coordinates of the splash screen image.
                splashImageRect = splash.ImageLocation;
                PositionImage();

                // If applicable, include a method for positioning a progress control.
                PositionRing();
            }

            // Create a Frame to act as the navigation context 
            rootFrame = new Frame();

            // Restore the saved session state if necessary
            RestoreStateAsync(loadState);

        }
开发者ID:Vedolin,项目名称:wheelmap-windows-app,代码行数:31,代码来源:Splashscreen.xaml.cs

示例15: ArrangeOverride

        protected override Size ArrangeOverride(Size finalSize)
        {
            double offset = 0;
            var finalRect = new Rect(0, 0, 0, finalSize.Height);

            var childrenList = Children.OrderBy(GetPanelIndex);

            _childrenPositions.Clear();
            foreach (FrameworkElement child in childrenList)
            {
                finalRect.X = offset;
                _childrenPositions.Add(new SlideViewPanelItemOffset(child, offset));

                finalRect.Width = child.Width > 0 ? child.DesiredSize.Width : _viewportWidth;
                if (finalRect.Width <= 0)
                    finalRect.Width = _viewportWidth;

                child.Arrange(finalRect);

                offset += finalRect.Width;
            }

            finalSize.Width = _totalWidth = offset;

            // Constraint the different panel positions
            foreach (var childPosition in _childrenPositions)
            {
                childPosition.OffsetX = Math.Min(_totalWidth - _viewportWidth, childPosition.OffsetX);
            }

            return finalSize;
        }
开发者ID:Biocodr,项目名称:HearthstoneCards,代码行数:32,代码来源:SlideViewPanel.cs


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