コード例 #1
0
        /// <summary>
        /// Work constructor
        /// </summary>
        /// <param name="frame">Thumb frame</param>
        /// <param name="pageNumber">Page number</param>
        /// <param name="thumbSelectedCallback"></param>
        public ThumbWithPageNumberView(RectangleF frame, int pageNumber, Action<ThumbWithPageNumberView> thumbSelectedCallback)
            : base(frame)
        {
            mThumbSelectedCallback = thumbSelectedCallback;
            SetAsUnselected();

            // Create and init page thumb view
            int thumbContentSize = (int)Bounds.Size.Width;
            RectangleF thumbViewFrame = new RectangleF(0, Padding, Bounds.Size.Width, Bounds.Size.Height - 2 * Padding - PageNumberLabelHeight);
            mThumbView = new ThumbView(thumbViewFrame, thumbContentSize, pageNumber);

            // Create and init page number label
            var pageNumberLabelFrame = new RectangleF(0, 2 * Padding + thumbViewFrame.Height, Bounds.Size.Width, PageNumberLabelHeight);
            mPageNumberLabel = new UILabel(pageNumberLabelFrame);
            mPageNumberLabel.TextAlignment = UITextAlignment.Center;
            mPageNumberLabel.BackgroundColor = UIColor.Clear;
            mPageNumberLabel.TextColor = UIColor.White;
            mPageNumberLabel.Font = UIFont.SystemFontOfSize(16.0f);
            mPageNumberLabel.ShadowOffset = new SizeF(0.0f, 1.0f);
            mPageNumberLabel.ShadowColor = UIColor.Black;
            mPageNumberLabel.AdjustsFontSizeToFitWidth = true;
            mPageNumberLabel.MinimumFontSize = 12.0f;
            mPageNumberLabel.Text = pageNumber.ToString();

            AddSubview(mThumbView);
            AddSubview(mPageNumberLabel);
        }
コード例 #2
0
        public ThumbWithPageNumberView(RectangleF frame, int pageNumber, Action <ThumbWithPageNumberView> thumbSelectedCallback) : base(frame)
        {
            _thumbSelectedCallback = thumbSelectedCallback;
            SetAsUnselected();

            int thumbContentSize = (int)Bounds.Size.Width;
            var thumbViewFrame   = new RectangleF(0, Padding, Bounds.Size.Width, Bounds.Size.Height - 2 * Padding - PageNumberLabelHeight);

            _thumbView = new ThumbView(thumbViewFrame, thumbContentSize, pageNumber);

            var pageNumberLabelFrame = new RectangleF(0, 2 * Padding + thumbViewFrame.Height, Bounds.Size.Width, PageNumberLabelHeight);

            _pageNumberLabel = new UILabel(pageNumberLabelFrame);
            _pageNumberLabel.TextAlignment             = UITextAlignment.Center;
            _pageNumberLabel.BackgroundColor           = UIColor.Clear;
            _pageNumberLabel.TextColor                 = UIColor.White;
            _pageNumberLabel.Font                      = UIFont.SystemFontOfSize(16.0f);
            _pageNumberLabel.ShadowOffset              = new SizeF(0.0f, 1.0f);
            _pageNumberLabel.ShadowColor               = UIColor.Black;
            _pageNumberLabel.AdjustsFontSizeToFitWidth = true;
            _pageNumberLabel.Text                      = pageNumber.ToString();

            AddSubview(_thumbView);
            AddSubview(_pageNumberLabel);
        }
コード例 #3
0
ファイル: PageView.cs プロジェクト: kenLa/mTouch-PDFReader
        /// <summary>
        /// Working.
        /// </summary>
        public PageView(RectangleF frame, int pageNumber)
            : base(frame)
        {
            // Init page scroll view
            ScrollsToTop = false;
            DelaysContentTouches = false;
            ShowsVerticalScrollIndicator = false;
            ShowsHorizontalScrollIndicator = false;
            ContentMode = UIViewContentMode.Redraw;
            AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            UserInteractionEnabled = true;
            AutosizesSubviews = false;
            BackgroundColor = UIColor.Clear;
            ViewForZoomingInScrollView = delegate(UIScrollView sender) {
                return _PageContentContainerView;
            };

            // Create and init (calc frame size) page content view
            _PageContentView = new PageContentView(PageContentView.GetPageViewSize(pageNumber), pageNumber);

            // Create and init page content container view
            _PageContentContainerView = new UIView(_PageContentView.Bounds);
            _PageContentContainerView.AutosizesSubviews = false;
            _PageContentContainerView.UserInteractionEnabled = false;
            _PageContentContainerView.ContentMode = UIViewContentMode.Redraw;
            _PageContentContainerView.AutoresizingMask = UIViewAutoresizing.None;
            _PageContentContainerView.Layer.CornerRadius = 5;
            _PageContentContainerView.Layer.ShadowOffset = new SizeF(2.0f, 2.0f);
            _PageContentContainerView.Layer.ShadowRadius = 4.0f;
            _PageContentContainerView.Layer.ShadowOpacity = 1.0f;
            _PageContentContainerView.Layer.ShadowPath = UIBezierPath.FromRect(_PageContentContainerView.Bounds).CGPath;
            _PageContentContainerView.BackgroundColor = UIColor.White;

            // Create and init page thumb view
            _ThumbView = new ThumbView(_PageContentView.Bounds, ThumbContentSize, pageNumber);

            // Add views to parents
            _PageContentContainerView.AddSubview(_ThumbView);
            _PageContentContainerView.AddSubview(_PageContentView);
            AddSubview(_PageContentContainerView);

            // Set content size, offset and inset
            ContentSize = _PageContentView.Bounds.Size;
            ContentOffset = new PointF((0.0f - ContentViewPadding), (0.0f - ContentViewPadding));
            ContentInset = new UIEdgeInsets(ContentViewPadding, ContentViewPadding, ContentViewPadding, ContentViewPadding);
            ContentSize = _PageContentContainerView.Bounds.Size;

            // Setup zoom scale
            UpdateMinimumMaximumZoom();
            ZoomScale = MinimumZoomScale;
        }