private void PositionRing() { SplashProgressRing.SetValue(Canvas.LeftProperty, _splashImageRect.X + _splashImageRect.Width * 0.5 - SplashProgressRing.Width * 0.5); SplashProgressRing.SetValue(Canvas.TopProperty, _splashImageRect.Y + _splashImageRect.Height + _splashImageRect.Height * 0.1); }
void PositionElements() { // Position the Image SplashScreenLogo.SetValue(Canvas.LeftProperty, splashImageRect.X); SplashScreenLogo.SetValue(Canvas.TopProperty, splashImageRect.Y); SplashScreenLogo.Height = splashImageRect.Height; SplashScreenLogo.Width = splashImageRect.Width; // Position the Progress Ring SplashProgressRing.SetValue(Canvas.LeftProperty, (Window.Current.Bounds.Width / 2) - (SplashProgressRing.Width / 2)); SplashProgressRing.SetValue(Canvas.TopProperty, (Window.Current.Bounds.Height / 2) + (SplashScreenLogo.Height / 3)); // Position the Text StatusStackPanel.Width = SplashScreenLogo.Width * 0.5; StatusStackPanel.SetValue(Canvas.LeftProperty, (Window.Current.Bounds.Width / 2) - (StatusStackPanel.Width / 2)); StatusStackPanel.SetValue(Canvas.TopProperty, Window.Current.Bounds.Height / 2 + SplashScreenLogo.Height * 0.52); }
/// <summary> /// 设置并计算界面元素正确的位置 /// </summary> private void SetControlPosition() { double HorizonLocation = SplashImageRect.X + (SplashImageRect.Width * 0.5); double VerticalLocation = SplashImageRect.Y + (SplashImageRect.Height * 0.75); SplashProgressRing.SetValue(Canvas.LeftProperty, HorizonLocation - (SplashProgressRing.Width * 0.5)); SplashProgressRing.SetValue(Canvas.TopProperty, VerticalLocation); Display.SetValue(Canvas.LeftProperty, HorizonLocation - (Display.Width * 0.5)); Display.SetValue(Canvas.TopProperty, VerticalLocation + SplashProgressRing.Height + 20); Continue.SetValue(Canvas.LeftProperty, HorizonLocation - 75); Continue.SetValue(Canvas.TopProperty, VerticalLocation + SplashProgressRing.Height + Display.Height + 20); Cancel.SetValue(Canvas.LeftProperty, HorizonLocation + 5); Cancel.SetValue(Canvas.TopProperty, VerticalLocation + SplashProgressRing.Height + Display.Height + 20); extendedSplashImage.SetValue(Canvas.LeftProperty, SplashImageRect.X); extendedSplashImage.SetValue(Canvas.TopProperty, SplashImageRect.Y); extendedSplashImage.Height = SplashImageRect.Height; extendedSplashImage.Width = SplashImageRect.Width; }
private void PositionRing(Rect splashImageRect) { SplashProgressRing.SetValue(Canvas.LeftProperty, splashImageRect.X + (splashImageRect.Width * 0.5) - (SplashProgressRing.Width * 0.5)); SplashProgressRing.SetValue(Canvas.TopProperty, (splashImageRect.Y + splashImageRect.Height + splashImageRect.Height * 0.1)); }