• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PageOrientation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetRotationAngle

        /// <summary>
        /// Converts the <paramref name="orientation"/> given to a proper page rotation angle, in degrees.
        /// </summary>
        /// <param name="orientation">Page orientation.</param>
        /// <returns>Rotation angle.</returns>
        public static int GetRotationAngle(PageOrientation orientation)
        {
            int angle = 0;

            switch (orientation)
            {
                case PageOrientation.None:
                case PageOrientation.Portrait:
                case PageOrientation.PortraitUp:
                    angle = 90;
                    break;
                case PageOrientation.PortraitDown:
                    angle = 270;
                    break;
                case PageOrientation.Landscape:
                case PageOrientation.LandscapeLeft:
                    angle = 0;
                    break;
                case PageOrientation.LandscapeRight:
                    angle = 180;
                    break;
            }

            return angle;
        }
开发者ID:trilok567,项目名称:Windows-Phone,代码行数:30,代码来源:OrientationHelper.cs


示例2: RotateIamgeViewer

        private void RotateIamgeViewer(PageOrientation orientation)
        {
            var duration = new Duration(TimeSpan.FromSeconds(0.5));
            var sb = new Storyboard();
            sb.Duration = duration;

            var da = new DoubleAnimation();
            da.Duration = duration;

            sb.Children.Add(da);
            //Storyboard.SetTarget(da, mediaViewerTranform);
            Storyboard.SetTarget(da, mediaViewerTransform);
            Storyboard.SetTargetProperty(da, new PropertyPath("Rotation"));

            if (orientation == PageOrientation.Landscape ||
                orientation == PageOrientation.LandscapeLeft ||
                orientation == PageOrientation.LandscapeRight)
            {
                da.From = 90;
                da.To = 0;
            }
            else if (orientation == PageOrientation.Portrait ||
                orientation == PageOrientation.PortraitDown ||
                orientation == PageOrientation.PortraitUp)
            {
                da.From = -90;
                da.To = 0;
            }
            sb.Begin();
        }
开发者ID:dqtruong,项目名称:PhotoViewer,代码行数:30,代码来源:MainPage.xaml.cs


示例3: ThreadView

 public ThreadView()
 {
     InitializeComponent();
     BindEvents();
     this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
     this._currentOrientation = this.Orientation;
     this._defaultAppBar = this.ApplicationBar;
 }
开发者ID:bootlegrobot,项目名称:awful,代码行数:8,代码来源:ThreadView.xaml.cs


示例4: ExportSettings

        public ExportSettings()
        {
            m_page_orientation = PageOrientation.Landscape;
            if (GetTotalScreens() > 1)
                m_template_doc_path = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Documents\\Template Landscape.docx";
            else
                m_template_doc_path = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Documents\\Template Portrait.docx";

        }
开发者ID:khalidcawl,项目名称:Auto-snapshot,代码行数:9,代码来源:ExportSettings.cs


示例5: SetOrientation

        public static void SetOrientation(this PhoneApplicationPage page, PageOrientation? orientation = null)
        {
            var app = Resolver.Resolve<IXFormsApp>() as XFormsAppWP;

            if (app != null)
            {
                app.SetOrientation(orientation ?? page.Orientation);
            }
        }
开发者ID:Gunner92,项目名称:Xamarin-Forms-Labs,代码行数:9,代码来源:PageExtensions.cs


示例6: GetPageSize

        //PdfPage m_page;
        //public PdfPrintTarget(PdfPage page)
        //{
        //    m_page = page;
        //}

        /*
        #region IPrintTarget Members

        public float Width
        {
            get { return PageSizeConverter.ToSize(m_page.Size).Width; }
        }

        public float Height
        {
            get { return PageSizeConverter.ToSize(m_page.Size).Height; }
        }

        #endregion
        */

        #region IPrintTarget Members

        public SizeF GetPageSize(PageOrientation orientation)
        {
            switch (orientation)
            {
                case PageOrientation.Portrait:
                    return new SizeF(m_size.Width, m_size.Height);
                case PageOrientation.Landscape:
                    return new SizeF(m_size.Height, m_size.Width);
            }
            throw new Exception("The method or operation is not implemented.");
        }
开发者ID:BackupTheBerlios,项目名称:zp7-svn,代码行数:35,代码来源:PrintTarget.cs


示例7: MainPage

        // Constructor
        public MainPage()
        {
            InitializeComponent();
            var locator = new ViewModelLocator();
            _mainViewModel = locator.Main;
            DataContext = _mainViewModel;

            OrientationChanged += MainPageOrientationChanged;
            _lastOrientation = Orientation;

            UpdateOrientation();
        }
开发者ID:tym32167,项目名称:calculon,代码行数:13,代码来源:MainPage.xaml.cs


示例8: SetOrientation

        private void SetOrientation(PageOrientation orientation)
        {
            switch (orientation)
            {
                case PageOrientation.Landscape:

                case PageOrientation.LandscapeLeft:

                case PageOrientation.LandscapeRight:

                case PageOrientation.None:
                    TopMenu.Visibility = System.Windows.Visibility.Collapsed;
                    break;
                case PageOrientation.Portrait:

                case PageOrientation.PortraitDown:

                case PageOrientation.PortraitUp:
                    TopMenu.Visibility = System.Windows.Visibility.Visible;
                    break;
                default:
                    break;
            }

            switch (orientation)
            {
                case PageOrientation.Landscape:

                    break;
                case PageOrientation.LandscapeLeft:
                    ContentPanel.Margin = new Thickness(0, 0, 75, 0);
                    IndexNav.Margin = new Thickness(0, 0, 75, 0);
                    break;
                case PageOrientation.LandscapeRight:
                    ContentPanel.Margin = new Thickness(75, 0, 0, 0);
                    IndexNav.Margin = new Thickness(75, 0, 0, 0);
                    break;
                case PageOrientation.None:


                case PageOrientation.Portrait:

                case PageOrientation.PortraitDown:

                case PageOrientation.PortraitUp:


                default:
                    ContentPanel.Margin = new Thickness(0, 0, 0, 0);
                    IndexNav.Margin = new Thickness(0, 0, 0, 0);
                    break;
            }
        }
开发者ID:wuchangqi,项目名称:ifixit-microsoft,代码行数:53,代码来源:Details.xaml.cs


示例9: determineStyle

        void determineStyle(PageOrientation newOrientation, IList<ResourceDictionary> resources)
        {
            var lastOrientation = state;
            state = newOrientation;

            //some flags to simplify detecting an orientation change
            var wasBlank = (lastOrientation == null ||
                            lastOrientation == PageOrientation.None);
            var wasPortrait = (lastOrientation == PageOrientation.Portrait ||
                               lastOrientation == PageOrientation.PortraitDown ||
                               lastOrientation == PageOrientation.PortraitUp);
            var wasLandscape = (lastOrientation == PageOrientation.Landscape ||
                                lastOrientation == PageOrientation.LandscapeLeft ||
                                lastOrientation == PageOrientation.LandscapeRight);
            var isPortrait = (newOrientation == PageOrientation.Portrait ||
                              newOrientation == PageOrientation.PortraitDown ||
                              newOrientation == PageOrientation.PortraitUp);
            var isLandscape = (newOrientation == PageOrientation.Landscape ||
                               newOrientation == PageOrientation.LandscapeLeft ||
                               newOrientation == PageOrientation.LandscapeRight);


            //STYLE SWITCHING

            //only switch on orientation change
            if (isLandscape && (wasBlank || wasPortrait))
            {
                //clear existing responsive styles if any
                removeExistingStyles(resources);

                //add compact style xaml to resources
                if (this.LandscapeStyles != null)
                {
                    foreach (var style in this.LandscapeStyles)
                        resources.Add(style);
                }

            }
            else if (isPortrait && (wasBlank || wasLandscape))
            {
                //clear existing responsive styles if any
                removeExistingStyles(resources);

                //add regular style xaml to resources
                if (this.PortraitStyles != null)
                {
                    foreach (var style in this.PortraitStyles)
                        resources.Add(style);
                }

            }
        }
开发者ID:punker76,项目名称:XAMLResponsiveStyles,代码行数:52,代码来源:ResponsiveOrientation.cs


示例10: handleChangeEvents

        void handleChangeEvents(Size size, PageOrientation orientation)
        {
            if (ResponsiveMethods == null)
                return;

            foreach (var method in ResponsiveMethods)
            {
                method.HandleChange(size,
                                    orientation,
                                    this.Resources.MergedDictionaries);
            }

        }
开发者ID:punker76,项目名称:XAMLResponsiveStyles,代码行数:13,代码来源:ResponsiveApp.cs


示例11: OnOrientationChanged

        /// <summary>
        /// Tells the Viewfinder to update its UI to reflect a new PageOrientation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnOrientationChanged(PageOrientation newOrientation)
        {
            if (IsPortrait(newOrientation))
            {
                this.rotateArrowButtonToPortrait.Begin();
            }
            else
            {
                this.rotateArrowButtonToLandscape.Begin();
            }

            ApplyRotation();
        }
开发者ID:dmourainatel,项目名称:Windows-Phone-Projects,代码行数:18,代码来源:Viewfinder.xaml.cs


示例12: PdfSharpExporter

 public PdfSharpExporter(int nLayoutStartIndex, int nLayoutEndIndex, string sExportFile, string sPageOrientation)
     : base(nLayoutStartIndex, nLayoutEndIndex)
 {
     m_sExportFile = sExportFile;
     try
     {
         m_ePageOrientation = (PageOrientation)Enum.Parse(typeof(PageOrientation), sPageOrientation);
     }
     catch (Exception)
     {
         Logger.AddLogLine(sPageOrientation + " is an unknow page orientation.");
     }
     m_zDocument = new PdfDocument();
     AddPage();
 }
开发者ID:NotNemesis,项目名称:cardmaker,代码行数:15,代码来源:PdfSharpExporter.cs


示例13: AdjustForOrientation

		private void AdjustForOrientation(PageOrientation orientation)
		{
			Messenger.Default.Send<OrientationChangedMessage>(new OrientationChangedMessage { Orientation = orientation });
			lastKnownOrientation = orientation;

			if (LayoutRoot != null)
			{
				if (orientation == PageOrientation.LandscapeRight)
					LayoutRoot.Margin = new Thickness(40, 0, 0, 0);
				else if (orientation == PageOrientation.LandscapeLeft)
					LayoutRoot.Margin = new Thickness(0, 0, 35, 0);
				else
					LayoutRoot.Margin = new Thickness(0, 0, 0, 0);
			}
		}
开发者ID:Synergex,项目名称:Baconography,代码行数:15,代码来源:MainPage.xaml.cs


示例14: SetRotation

 private void SetRotation(PageOrientation orientation)
 {
     if (orientation.HasFlag(PageOrientation.LandscapeLeft))
     {
         BufferRotate = 0;
     }
     else if (orientation.HasFlag(PageOrientation.LandscapeRight))
     {
         BufferRotate = 180;
     }
     else if (orientation.HasFlag(PageOrientation.PortraitUp))
     {
         //The back camera renders upsidedown so use a different rotate
         if (Capture != null && Capture.SensorLocation == CameraSensorLocation.Front)
         {
             BufferRotate = 270;
         }
         else if (Capture != null && Capture.SensorLocation == CameraSensorLocation.Back)
         {
             BufferRotate = 90;
         }
         else
         {
             BufferRotate = 270;
         }
     }
     else if (orientation.HasFlag(PageOrientation.PortraitDown))
     {
         //The back camera renders upsidedown so use a different rotate
         if (Capture != null && Capture.SensorLocation == CameraSensorLocation.Front)
         {
             BufferRotate = 90;
         }
         else if (Capture != null && Capture.SensorLocation == CameraSensorLocation.Back)
         {
             BufferRotate = 270;
         }
         else
         {
             BufferRotate = 90;
         }
     }
     if (Preview != null)
     {
         Preview.Rotate(BufferRotate);
     }
 }
开发者ID:QuickBlox,项目名称:quickblox-dotnet-sdk,代码行数:47,代码来源:VideoCaptureProvider.cs


示例15: GetCameraTransformByOrientation

        public static CompositeTransform GetCameraTransformByOrientation(CameraType cameraType, PageOrientation orientation)
        {
            var scaleX = 1;
            var scaleY = 1;
            var rotation = 0;

            if (cameraType == CameraType.FrontFacing)
            {
                scaleX = -1;
                if (orientation == PageOrientation.LandscapeRight)
                {
                    rotation = 180;
                }
                else if (orientation == PageOrientation.LandscapeLeft)
                {
                }
                else if (orientation == PageOrientation.PortraitUp)
                {
                    rotation = 90;
                }
            }
            else
            {
                if (orientation == PageOrientation.LandscapeRight)
                {
                    scaleX = -1;
                    scaleY = -1;
                }
                else if (orientation == PageOrientation.LandscapeLeft)
                {
                    // all good
                }
                else if (orientation == PageOrientation.PortraitUp)
                {
                    rotation = 90;
                }
            }

            return new CompositeTransform
            {
                CenterX = 0.5, 
                CenterY = 0.5, 
                ScaleX = scaleX, 
                ScaleY = scaleY, 
                Rotation = rotation 
            };
        }
开发者ID:radu-ungureanu,项目名称:Grimacizer,代码行数:47,代码来源:Helpers.cs


示例16: ConvertToNativeOrientation

 private static DisplayOrientations ConvertToNativeOrientation(PageOrientation xamlOrientation)
 {
     switch (xamlOrientation)
     {
         case PageOrientation.Portrait:
         case PageOrientation.PortraitUp:
             return DisplayOrientations.Portrait;
         case PageOrientation.PortraitDown:
             return DisplayOrientations.PortraitFlipped;
         case PageOrientation.Landscape:
         case PageOrientation.LandscapeLeft:
             return DisplayOrientations.Landscape;
         case PageOrientation.LandscapeRight:
             return DisplayOrientations.LandscapeFlipped;
         default:
             return DisplayOrientations.Landscape;
     }
 }
开发者ID:triompha,项目名称:Cocos3dSamples,代码行数:18,代码来源:MainPage.xaml.cs


示例17: ReloadPreview

        public void ReloadPreview(PageOrientation pageOrientation, PaperSize currentPaper)
        {
            ReloadingPreview = true;
            if (FullScreenPrintWindow != null)
            {
                WaitScreen.Show("Loading Preview");
            }
            
            if (PageOrientation == PageOrientation.Portrait)
            {
                FlowDocument.PageHeight = currentPaper.Height;
                FlowDocument.PageWidth = currentPaper.Width;
            }
            else
            {
                FlowDocument.PageHeight = currentPaper.Width;
                FlowDocument.PageWidth = currentPaper.Height;
            }

	        var s = new FileStream("c:\\aa.xps", FileMode.OpenOrCreate, FileAccess.ReadWrite);
			_ms = new MemoryStream();
            _pkg = Package.Open(s, FileMode.Create, FileAccess.ReadWrite);
            //const string pack = "pack://temp.xps";
            //var oldPackage = PackageStore.GetPackage(new Uri(pack));
            //if (oldPackage == null)
            //    PackageStore.AddPackage(new Uri(pack), _pkg);
            //else
            //{
            //    PackageStore.RemovePackage(new Uri(pack));
            //    PackageStore.AddPackage(new Uri(pack), _pkg);
            //}
            _xpsDocument = new XpsDocument(_pkg);//, CompressionOption.SuperFast, pack);
            var xpsWriter = XpsDocument.CreateXpsDocumentWriter(_xpsDocument);

            var documentPaginator = ((IDocumentPaginatorSource)FlowDocument).DocumentPaginator;
            xpsWriter.Write(documentPaginator);
            Paginator = documentPaginator;
            MaxCopies = NumberOfPages = ApproaxNumberOfPages = Paginator.PageCount;
            PagesAcross = 2;
            DisplayPagePreviewsAll(documentPaginator);
            WaitScreen.Hide();
            ReloadingPreview = false;
        }
开发者ID:modulexcite,项目名称:printengine,代码行数:43,代码来源:FlowDocumentPrintControlViewModel.cs


示例18: MainPage_OrientationChanged

        private void MainPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            var newOrientation = e.Orientation;
            // Orientations are (clockwise) 'PortraitUp', 'LandscapeRight', 'LandscapeLeft'

            var transitionElement = new RotateTransition();
            switch (newOrientation)
            {
                case PageOrientation.Landscape:
                case PageOrientation.LandscapeRight:
                    // Come here from PortraitUp (i.e. clockwise) or LandscapeLeft?
                    transitionElement.Mode = _lastOrientation == PageOrientation.PortraitUp
                        ? RotateTransitionMode.In90Counterclockwise
                        : RotateTransitionMode.In180Clockwise;
                    break;
                case PageOrientation.LandscapeLeft:
                    // Come here from LandscapeRight or PortraitUp?
                    transitionElement.Mode = _lastOrientation == PageOrientation.LandscapeRight
                        ? RotateTransitionMode.In180Counterclockwise
                        : RotateTransitionMode.In90Clockwise;
                    break;
                case PageOrientation.Portrait:
                case PageOrientation.PortraitUp:
                    // Come here from LandscapeLeft or LandscapeRight?
                    transitionElement.Mode = _lastOrientation == PageOrientation.LandscapeLeft
                        ? RotateTransitionMode.In90Counterclockwise
                        : RotateTransitionMode.In90Clockwise;
                    break;
            }

            // Execute the transition
            var phoneApplicationPage =
                (PhoneApplicationPage) (((PhoneApplicationFrame) Application.Current.RootVisual)).Content;
            var transition = transitionElement.GetTransition(phoneApplicationPage);
            transition.Completed += delegate
            {
                transition.Stop();
            };
            transition.Begin();

            _lastOrientation = newOrientation;
        }
开发者ID:oleg111an,项目名称:poker,代码行数:42,代码来源:GamePage.xaml.cs


示例19: IsLandscape

 private static bool IsLandscape(PageOrientation orientation)
 {
     return orientation == PageOrientation.Landscape || orientation == PageOrientation.LandscapeLeft || orientation == PageOrientation.LandscapeRight;
 }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:4,代码来源:LongListSelectorGroup.cs


示例20: OnOrientationChanged

        private void OnOrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            PageOrientation newOrientation = e.Orientation;

            RotateTransition transitionElement = new RotateTransition();

            // Adjust padding if possible
            
            if (null != MainGrid)
            {
                switch (newOrientation)
                {
                    case PageOrientation.Portrait:
                    case PageOrientation.PortraitUp:
                        HeaderTitle.Margin = new Thickness(20, 12, 12, 12);
                        Picker.Margin = new Thickness(8, 12, 0, 0);

                        transitionElement.Mode = (lastOrientation == PageOrientation.LandscapeLeft) ?
                        RotateTransitionMode.In90Counterclockwise : RotateTransitionMode.In90Clockwise;

                        break;
                    case PageOrientation.Landscape:
                    case PageOrientation.LandscapeLeft:
                        HeaderTitle.Margin = new Thickness(72, 0, 0, 0);
                        Picker.Margin = new Thickness(60, 0, 0, 0);

                        transitionElement.Mode = (lastOrientation == PageOrientation.LandscapeRight) ?
                        RotateTransitionMode.In180Counterclockwise : RotateTransitionMode.In90Clockwise;
                        break;
                    case PageOrientation.LandscapeRight:
                        HeaderTitle.Margin = new Thickness(20, 0, 0, 0);
                        Picker.Margin = new Thickness(8, 0, 0, 0);

                        transitionElement.Mode = (lastOrientation == PageOrientation.PortraitUp) ? 
                        RotateTransitionMode.In90Counterclockwise : RotateTransitionMode.In180Clockwise;
                        break;
                }
            }

            PhoneApplicationPage phoneApplicationPage = (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;
            ITransition transition = transitionElement.GetTransition(phoneApplicationPage);
            transition.Completed += delegate
            {
                transition.Stop();
            };
            transition.Begin();

            lastOrientation = newOrientation;
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:49,代码来源:ListPickerPage.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PageReference类代码示例发布时间:2022-05-24
下一篇:
C# PageModel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap