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


C# Dimensions类代码示例

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


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

示例1: ImagePart

 /// <summary>
 /// Instantiates a new instance of <see cref="ImagePart"/>.
 /// </summary>
 /// <param name="imageUrl">The url to the image.</param>
 /// <param name="text">The text.</param>
 /// <param name="linkUrl">The url to the link.</param>
 /// <param name="dimensions">The dimensions of the image.</param>
 public ImagePart(string imageUrl, string text, string linkUrl, Dimensions dimensions)
 {
     ImageUrl = imageUrl;
     Text = text;
     LinkUrl = linkUrl;
     Dimensions = dimensions;
 }
开发者ID:stephanjohnson,项目名称:commonplex,代码行数:14,代码来源:ImagePart.cs

示例2: CreateAnimationCore

        /// <summary>
        /// Create a <see cref="Storyboard"/> to be used to animate the view, 
        /// based on the animation configuration supplied at initialization
        /// time and the new view position and size.
        /// </summary>
        /// <param name="view">The view to create the animation for.</param>
        /// <param name="dimensions">The view dimensions.</param>
        protected override IObservable<Unit> CreateAnimationCore(FrameworkElement view, Dimensions dimensions)
        {
            var fromValue = IsReverse ? 1.0 : 0.0;
            var toValue = IsReverse ? 0.0 : 1.0;

            var animatedProperty = AnimatedProperty;
            if (animatedProperty.HasValue)
            {
                var storyboard = new Storyboard();
                var @finally = default(Action);
                switch (animatedProperty.Value)
                {
                    case AnimatedPropertyType.Opacity:
                        view.Opacity = fromValue;
                        storyboard.Children.Add(CreateOpacityAnimation(view, fromValue, toValue));
                        @finally = () => view.Opacity = toValue;
                        break;
                    case AnimatedPropertyType.ScaleXY:
                        // TODO: implement this layout animation option
                        throw new NotImplementedException();
                    default:
                        throw new InvalidOperationException(
                            "Missing animation for property: " + animatedProperty.Value);
                }

                return new StoryboardObservable(storyboard, @finally);
            }

            throw new InvalidOperationException(
                "Missing animated property from the animation configuration.");
        }
开发者ID:chukcha-wtf,项目名称:react-native-windows,代码行数:38,代码来源:BaseLayoutAnimation.cs

示例3: OutputRaster

 //---------------------------------------------------------------------
 public OutputRaster(string     path,
     Dimensions dimensions)
     : base(path, dimensions)
 {
     this.pixelsWritten = 0;
     this.disposed = false;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Landis-Spatial-Modeling-Library,代码行数:8,代码来源:OutputRaster.cs

示例4: GetImageFromGoogleCharts

        Image GetImageFromGoogleCharts(Dimensions dimensions)
        {
            var chl = "&chl=" + Uri.EscapeDataString(GetValue<string>("text"));
              var chs = string.Format("&chs={0}x{1}", dimensions.Width,
                  dimensions.Height);
              var choe = "&choe=" + GetEncodingString();
              var chld = string.Format("&chld={0}|{1}", GetValue<string>("error_correction"),
                   GetValue<int>("margin"));
              var url = "http://chart.apis.google.com/chart?cht=qr"
            + chl + chs + choe + chld;

              var procedure = new Procedure("file-uri-load");

              try
            {
              var returnArgs = procedure.Run(url, url);

              return returnArgs[0] as Image;
            }
              catch (GimpSharpException e)
            {
              new Message(e.Message);
              return null;
            }
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:25,代码来源:Renderer.cs

示例5: Raster

 //---------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 public Raster(string     path,
     Dimensions dimensions)
 {
     this.path = path;
     this.dimensions = dimensions;
     this.disposed = false;
     UpdatePixelCount();
 }
开发者ID:LANDIS-II-Foundation,项目名称:Landis-Spatial-Modeling-Library,代码行数:12,代码来源:Raster.cs

示例6: Bathroom

 public Bathroom(Dimensions dimensions, bool hasToilet, bool hasShower, bool hasBath, bool hasSink)
 {
     Dimensions = dimensions;
     HasToilet = hasToilet;
     HasShower = hasShower;
     HasBath = hasBath;
     HasSink = hasSink;
 }
开发者ID:SamuelDebruyn,项目名称:AD5-Cirqus-demo,代码行数:8,代码来源:BathRoom.cs

示例7: Path

 public static string Path(Dimensions dim, int x, int z)
 {
     string path = "world/";
     if (dim != Dimensions.Overworld)
         path += "DIM" + ((int)dim) + "/";
     path += "region/r." + (x >> 9) + "." + (z >> 9) + ".mca";
     return path;
 }
开发者ID:mctraveler,项目名称:MineSharp,代码行数:8,代码来源:McaFile.cs

示例8: CreateAnimationCore

        /// <summary>
        /// Create an observable animation to be used to animate the view, 
        /// based on the animation configuration supplied at initialization
        /// time and the new view position and size.
        /// </summary>
        /// <param name="view">The view to create the animation for.</param>
        /// <param name="dimensions">The view dimensions</param>
        /// <returns>
        /// An observable sequence that starts an animation when subscribed to,
        /// stops the animation when disposed, and that completes 
        /// simultaneously with the underlying animation.
        /// </returns>
        protected override IObservable<Unit> CreateAnimationCore(FrameworkElement view, Dimensions dimensions)
        {
            Canvas.SetLeft(view, dimensions.X);
            Canvas.SetTop(view, dimensions.Y);
            view.Width = dimensions.Width;
            view.Height = dimensions.Height;

            return base.CreateAnimationCore(view, dimensions);
        }
开发者ID:chukcha-wtf,项目名称:react-native-windows,代码行数:21,代码来源:LayoutCreateAnimation.cs

示例9: PlatformInfoProvider

#pragma warning restore 0067

        public PlatformInfoProvider()
        {
            Deployment.Current.Dispatcher.BeginInvoke(() => {
                double scale = (double)Application.Current.Host.Content.ScaleFactor / 100;
                int h = (int)Math.Ceiling(Application.Current.Host.Content.ActualHeight * scale);
                int w = (int)Math.Ceiling(Application.Current.Host.Content.ActualWidth * scale);               
                _screenResolution = new Dimensions(h, w);
            });
        }
开发者ID:Cristian9,项目名称:MobileApp,代码行数:11,代码来源:PlatformInfoProvider.WP.cs

示例10: OutputRaster

		//---------------------------------------------------------------------

		public OutputRaster(string     path,
		                    Dimensions dimensions,
		                    IMetadata  metadata)
			: base(path, dimensions, metadata)
		{
			this.pixelsWritten = 0;
			this.pixelCount = dimensions.Rows * dimensions.Columns;
			this.disposed = false;
		}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:11,代码来源:OutputRaster.cs

示例11: Raster

		//---------------------------------------------------------------------

		public Raster(string     path,
		              Dimensions dimensions,
		              IMetadata  metadata)
		{
			this.path = path;
			this.dimensions = dimensions;
			this.metadata = metadata;
			this.disposed = false;
		}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:11,代码来源:Raster.cs

示例12: Load

        public static McaFile Load(Dimensions dim, int x, int z)
        {
            string path = McaFile.Path(dim, x, z);
            if (File.Exists(path) == false)
                return null;

            McaFile mca = new McaFile(dim, x, z);
            mca.LoadFromFile(path);
            return mca;
        }
开发者ID:mctraveler,项目名称:MineSharp,代码行数:10,代码来源:McaFile.cs

示例13: GetSubMatrix

 public Matrix2D GetSubMatrix(int index, Dimensions dimsType)
 {
     switch (dimsType)
     {
         case Dimensions.TimeDimension:
             throw new InvalidOperationException("Can't get submatrix for this dimension");
         case Dimensions.Thickness:
             if (index < thickness)
             {
                 Matrix2D result = new Matrix2D(width, height);
                 for (int i = 0; i < width; i++)
                 {
                     for (int j = 0; j < height; j++)
                     {
                         result[i, j] = this[i, j, index];
                     }
                 }
                 return result;
             }
             else
                 throw new ArgumentException("Invalid indexer");
         case Dimensions.Height:
             if (index < height)
             {
                 Matrix2D result = new Matrix2D(width, thickness);
                 for (int i = 0; i < width; i++)
                 {
                     for (int j = 0; j < thickness; j++)
                     {
                         result[i, j] = this[i, index, j];
                     }
                 }
                 return result;
             }
             else
                 throw new ArgumentException("Invalid indexer");
         case Dimensions.Width:
             if (index < width)
             {
                 Matrix2D result = new Matrix2D(height, thickness);
                 for (int i = 0; i < height; i++)
                 {
                     for (int j = 0; j < thickness; j++)
                     {
                         result[i, j] = this[index, i, j];
                     }
                 }
                 return result;
             }
             else
                 throw new ArgumentException("Invalid indexer");
         default:
             throw new Exception("Something strange has happened");
     }
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:55,代码来源:Matrix3D.cs

示例14: ResizeHeightMaintainAspectRatio

		public static Dimensions ResizeHeightMaintainAspectRatio(Dimensions originalDimensions, int maximumHeight)
		{
			var resizedHeight = originalDimensions.Height > maximumHeight
								? maximumHeight
								: originalDimensions.Height;

			var resizedWidth = ((float)resizedHeight) / ((float)originalDimensions.Height);
			resizedWidth = resizedWidth * originalDimensions.Width;

			return new Dimensions((int)resizedWidth, resizedHeight);
		}
开发者ID:javafun,项目名称:Chief2moro.ImageDataExtensions,代码行数:11,代码来源:ImageResizeUtility.cs

示例15: ResizeWidthMaintainAspectRatio

		public static Dimensions ResizeWidthMaintainAspectRatio(Dimensions originalDimensions, int maximumWidth)
		{
			int resizedWidth = originalDimensions.Width > maximumWidth 
								? maximumWidth
								: originalDimensions.Width;

			float resizedHeight = ((float)resizedWidth) / ((float)originalDimensions.Width);
			resizedHeight = resizedHeight * originalDimensions.Height;

			return new Dimensions(resizedWidth, (int)resizedHeight);
		}
开发者ID:javafun,项目名称:Chief2moro.ImageDataExtensions,代码行数:11,代码来源:ImageResizeUtility.cs


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