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


C# System.Windows类代码示例

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


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

示例1: PerpendicularLine

        public static WPFMEDIA.LineGeometry PerpendicularLine(WPF.Point StartPoint, WPF.Point EndPoint, double Length)
        {
            //Get Current Angle Don't need the actual angle, radians is fine.
            double angle = CurrentAngle(StartPoint, EndPoint);
            double radians = Math.Atan2(StartPoint.Y - EndPoint.Y, StartPoint.X - EndPoint.X);

            //Take 90 deg
            double newAngle = angle + 90;
            double newRadians = radians + Math.PI / 2;

            //need to determine the shift.

            double shiftX = Length * Math.Cos(newRadians);
            //double shiftX2 = Length * Math.Cos(newAngle * Math.PI / 180);

            double shiftY = Length * Math.Sin(newRadians);

            double newStartPointX = StartPoint.X - shiftX;
            double newStartPointY = StartPoint.Y - shiftY;

            double newEndPointX = StartPoint.X + shiftX;
            double newEndPointY = StartPoint.Y + shiftY;

            WPF.Point newStartPoint = new WPF.Point(newStartPointX, newStartPointY);
            WPF.Point newEndPoint = new WPF.Point(newEndPointX, newEndPointY);

            //get the second point

            //draw line from center of the point.
            WPFMEDIA.LineGeometry newLine = new System.Windows.Media.LineGeometry(newStartPoint, newEndPoint);
            return newLine;
        }
开发者ID:RookieOne,项目名称:Adorners,代码行数:32,代码来源:Primitives.cs

示例2: Line

 //Can be more complex later.
 public static WPFMEDIA.LineGeometry Line(WPF.Point StartPoint, WPF.Point EndPoint)
 {
     WPFMEDIA.LineGeometry newLine = new System.Windows.Media.LineGeometry(StartPoint, EndPoint);
     return newLine;
 }
开发者ID:RookieOne,项目名称:Adorners,代码行数:6,代码来源:Primitives.cs

示例3: Rect

		public Rect (SW.Rect rect)
		{
			x = rect.X;
			y = rect.Y;
			width = rect.Width;
			height = rect.Height;
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:Rect.cs

示例4: MARGINS

			/// <summary>
			/// Initializes a new instance of the MARGINS struct
			/// </summary>
			/// <param name="t">
			/// The supplied thickness
			/// </param>
			public MARGINS (sw.Thickness t)
			{
				this.Left = (int)t.Left;
				this.Right = (int)t.Right;
				this.Top = (int)t.Top;
				this.Bottom = (int)t.Bottom;
			}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:13,代码来源:GlassHelper.cs

示例5: GetSize

		public static Size GetSize (sw.FrameworkElement element)
		{
			if (!double.IsNaN(element.ActualWidth) && !double.IsNaN(element.ActualHeight))
				return new Size ((int)element.ActualWidth, (int)element.ActualHeight);
			else
				return new Size ((int)(double.IsNaN(element.Width) ? -1 : element.Width), (int)(double.IsNaN(element.Height) ? -1 : element.Height));
		}
开发者ID:majorsilence,项目名称:Eto,代码行数:7,代码来源:Generator.cs

示例6: InDesignMode

        public bool? InDesignMode()
        {
            #if SILVERLIGHT
            if (Application.Current.RootVisual != null) {
                return System.ComponentModel.DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual);
            }

            return false;
            #elif NETFX_CORE
            return DesignMode.DesignModeEnabled;
            #else
            var designEnvironments = new[] {
                "BLEND.EXE",
                "XDESPROC.EXE",
            };

            var entry = Assembly.GetEntryAssembly();
            if (entry != null) {
                var exeName = (new FileInfo(entry.Location)).Name.ToUpperInvariant();

                if (designEnvironments.Any(x => x.Contains(exeName))) {
                    return true;
                }
            }

            return false;
            #endif
        }
开发者ID:TouchStar,项目名称:splat,代码行数:28,代码来源:PlatformModeDetector.cs

示例7: ShowDesignerDialog

 public static DialogResult ShowDesignerDialog(string title, Wpf.UIElement wpfContent, int width, int height)
 {
     DesignerDialog dlg = new DesignerDialog(title, wpfContent);
     dlg.Width = width;
     dlg.Height = height;
     dlg.SizeGripStyle = SizeGripStyle.Hide;
     return dlg.ShowDialog();
 }
开发者ID:ericschultz,项目名称:wpftoolkit,代码行数:8,代码来源:DesignerDialog.cs

示例8: ConnectTo

		void ConnectTo (sw.Point startPoint, bool startNewFigure = false)
		{
			if (startNewFigure || figure == null) {
				figure = new swm.PathFigure ();
				figure.StartPoint = startPoint;
				figure.Segments = new swm.PathSegmentCollection ();
				Control.Figures.Add (figure);
			} else
				figure.Segments.Add (new swm.LineSegment (startPoint, true));
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:10,代码来源:GraphicsPathHandler.cs

示例9: ToXwtFontStretch

        public static FontStretch ToXwtFontStretch(SW.FontStretch value)
        {
            // No, SW.FontStretches is not an enum
            if (value == SW.FontStretches.UltraCondensed) return FontStretch.UltraCondensed;
            if (value == SW.FontStretches.ExtraCondensed) return FontStretch.ExtraCondensed;
            if (value == SW.FontStretches.Condensed) return FontStretch.Condensed;
            if (value == SW.FontStretches.SemiCondensed) return FontStretch.SemiCondensed;
            if (value == SW.FontStretches.SemiExpanded) return FontStretch.SemiExpanded;
            if (value == SW.FontStretches.Expanded) return FontStretch.Expanded;
            if (value == SW.FontStretches.ExtraExpanded) return FontStretch.ExtraExpanded;
            if (value == SW.FontStretches.UltraExpanded) return FontStretch.UltraExpanded;

            return FontStretch.Normal;
        }
开发者ID:pixelmeister,项目名称:xwt,代码行数:14,代码来源:DataConverter.cs

示例10: searchForAssembly

        public bool? InUnitTestRunner()
        {
            var testAssemblies = new[] {
                "CSUNIT",
                "NUNIT",
                "XUNIT",
                "MBUNIT",
                "NBEHAVE",
            };

            try {
                return searchForAssembly(testAssemblies);
            } catch (Exception) {
                return null;
            }
        }
开发者ID:TouchStar,项目名称:splat,代码行数:16,代码来源:PlatformModeDetector.cs

示例11: Button

        public Button(List<Texture2D> textures, DotNET.Point location, long minInteractionTime)
        {
            this.textures = textures;
            this.Location = location;
            representation = 0;
            this.numTextures = textures.Count;

            radius = ((textures[0].Height / 2) + (textures[0].Width / 2)) / 2;
            radiusSq = radius * radius;

            minNecessaryInteractionTime = minInteractionTime;
            stopwatch = new Stopwatch();

            people = new Person[6];

            buttonHasBeenTriggered = false;

            timingInteraction = false;
        }
开发者ID:EveryUserNameIsTaken,项目名称:Null_and_Boid,代码行数:19,代码来源:Button.cs

示例12: searchForAssembly

        public bool? InUnitTestRunner()
        {
            var testAssemblies = new[] {
                "CSUNIT",
                "NUNIT",
                "XUNIT",
                "MBUNIT",
                "NBEHAVE",
                "VISUALSTUDIO.QUALITYTOOLS",
                "FIXIE",
                "NCRUNCH",
            };

            try {
                return searchForAssembly(testAssemblies);
            } catch (Exception) {
                return null;
            }
        }
开发者ID:paulcbetts,项目名称:splat,代码行数:19,代码来源:PlatformModeDetector.cs

示例13: Offset

 /// <summary>
 /// Offsets a point in a particular direction by certian length.
 /// </summary>
 /// <param name="p1"></param>
 /// <param name="dir"></param>
 /// <param name="len"></param>
 /// <returns></returns>
 public static Point Offset(Point p1, windows.Vector dir, float len)
 {
     return new Point((int)(p1.X + dir.X * len / dir.Length),
       (int)(p1.Y + dir.Y * len / dir.Length));
 }
开发者ID:ushadow,项目名称:handinput,代码行数:12,代码来源:GeometryUtil.cs

示例14: DistanceBetweenPoints

 public static double DistanceBetweenPoints(WPF.Point StartPoint, WPF.Point EndPoint)
 {
     double length = Math.Sqrt(Math.Pow(StartPoint.X - EndPoint.X, 2) + Math.Pow(StartPoint.Y - EndPoint.Y, 2));
     return length;
 }
开发者ID:RookieOne,项目名称:Adorners,代码行数:5,代码来源:Primitives.cs

示例15: CurrentAngle

 public static double CurrentAngle(WPF.Point StartPoint, WPF.Point EndPoint)
 {
     double radians = Math.Atan2(StartPoint.Y - EndPoint.Y, StartPoint.X - EndPoint.X);
     double angle = radians * (180 / Math.PI);
     return angle;
 }
开发者ID:RookieOne,项目名称:Adorners,代码行数:6,代码来源:Primitives.cs


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