示例#1
0
        /// <summary>
        /// Create ThumbnailGrid the using desired # of rows.
        /// </summary>
        /// <param name="layout">The <see cref="ThumbnailPageLayout"/>.</param>
        /// <param name="nRows">The desired # of rows.</param>
        /// <param name="aspectRatio">The thumbnail aspect ratio.</param>
        /// <returns>new <see cref="ThumbnailGrid"/></returns>
        private static ThumbnailGrid CreateUsingNRows(ThumbnailPageLayout layout, int nRows,
            double aspectRatio)
        {
            int nColumns;
            int thumbWidth;
            int thumbHeight;

            thumbHeight = layout.CalcThumbHeightFromNRows (nRows);
            thumbWidth = (int) (thumbHeight * aspectRatio + 0.5);
            nColumns = layout.CalcColumnsFromThumbWidth (thumbWidth);

            ThumbnailGrid thumbnailGrid = new ThumbnailGrid (layout,
                                            nColumns, nRows,
                                            thumbWidth, thumbHeight);
            return thumbnailGrid;
        }
示例#2
0
        /// <summary>
        /// Create ThumbnailGrid the using desired thumbnail width.
        /// </summary>
        /// <param name="layout">The <see cref="ThumbnailPageLayout"/>.</param>
        /// <param name="thumbWidth">The desired thumbnail width.</param>
        /// <param name="aspectRatio">The thumbnail aspect ratio.</param>
        /// <returns>new <see cref="ThumbnailGrid"/></returns>
        public static ThumbnailGrid CreateUsingThumbWidth(ThumbnailPageLayout layout, 
            int thumbWidth,
            double aspectRatio)
        {
            int nRows;
            int nColumns;
            int thumbHeight;

            nColumns = layout.CalcColumnsFromThumbWidth(thumbWidth);
            thumbHeight = (int) (thumbWidth / aspectRatio + 0.5);
            nRows = layout.CalcRowsFromThumbHeight (thumbHeight);

            ThumbnailGrid thumbnailGrid = new ThumbnailGrid (layout,
                                            nColumns, nRows,
                                            thumbWidth, thumbHeight);
            return thumbnailGrid;
        }