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

C# Dimensions类代码示例

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

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



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


示例16: GetDimensionsAfterRotation

    /// <summary>
    /// Returns the dimensions of a figure rotated by certain angle.
    /// </summary>
    /// <param name="dimensions">The dimensions of the figure to be rotated.</param>
    /// <param name="angle">The angle of rotation.</param>
    /// <returns></returns>
    public static Dimensions GetDimensionsAfterRotation(Dimensions dimensions, double angle)
    {
        double sine = Math.Abs(Math.Sin(angle));
        double cosine = Math.Abs(Math.Cos(angle));

        double newWidth = (sine * dimensions.height) + (cosine * dimensions.width);
        double newHeight = (sine * dimensions.width) + (cosine * dimensions.height);

        var newSize = new Dimensions(newWidth, newHeight);
        return newSize;
    }
开发者ID:klimentt,项目名称:Telerik-Academy,代码行数:17,代码来源:Class1.cs


示例17: SetZero

 private void SetZero(int i, int j, int startIndex, int endIndex, Dimensions dimension, LayerData layer)
 {
     int length = endIndex - startIndex;
     double[] zeroArray = new double[length];
     for (int k = 0; k < length; k++)
     {
         zeroArray[k] = 0;
     }
     layer.U.SetColumn(i, j, startIndex, dimension, zeroArray);
     layer.V.SetColumn(i, j, startIndex, dimension, zeroArray);
     layer.W.SetColumn(i, j, startIndex, dimension, zeroArray);
     layer.T.SetColumn(i, j, startIndex, dimension, zeroArray);
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:13,代码来源:LayerSolver.cs


示例18: PreviewRenderer

        public PreviewRenderer(Preview preview, Gdk.GC gc, Dimensions dimensions)
        {
            _window = preview.GdkWindow;
              _gc = gc;
              _width = dimensions.Width - 1;
              _height = dimensions.Height - 1;

              var colormap = Colormap.System;
              _inactive = new Gdk.Color(0xff, 0, 0);
              _active = new Gdk.Color(0, 0xff, 0);
              colormap.AllocColor(ref _inactive, true, true);
              colormap.AllocColor(ref _active, true, true);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:13,代码来源:PreviewRenderer.cs


示例19: McaFile

        public McaFile(Dimensions dim, int x, int z)
        {
            this.dimension = dim;
            this.x = x;
            this.z = z;

            //Decode chunk data
            /*MemoryStream ms = new MemoryStream(buffer, offset, sectors * 4096, false);
            using (GZipStream gzip = new GZipStream (ms, CompressionMode.Decompress))
            {
                EndianBinaryReader r = new EndianBinaryReader(EndianBitConverter.Big, gzip);
                Tag.ReadTag(r);
            }*/
        }
开发者ID:mctraveler,项目名称:MineSharp,代码行数:14,代码来源:McaFile.cs


示例20: TryGetDisplayUnit

        /// <summary>
        /// Tries to get the display unit for the specified dimension.
        /// </summary>
        /// <param name="d">The dimension.</param>
        /// <param name="symbol">The symbol.</param>
        /// <param name="q">The unit.</param>
        /// <returns><c>true</c> if the unit was found, <c>false</c> otherwise.</returns>
        public bool TryGetDisplayUnit(Dimensions d, out string symbol, out DynamicQuantity q)
        {
            if (this.displayUnits.TryGetValue(d, out symbol))
            {
                if (this.units.TryGetValue(symbol, out q))
                {
                    return true;
                }
            }

            symbol = null;
            q = default(DynamicQuantity);
            return false;
        }
开发者ID:jamestiller,项目名称:QunityTypes,代码行数:21,代码来源:DynamicUnitProvider.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Dir类代码示例发布时间:2022-05-24
下一篇:
C# Dimension类代码示例发布时间: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