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

C# System.Windows类代码示例

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

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



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

        //Draws a polygon with different thiknesses at each end. Traces over a line.
        public static WPFMEDIA.PathGeometry PolygonLine(WPF.Point StartPoint, WPF.Point EndPoint, double StartWidth, double EndWidth)
        {
            //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 shiftStartX = StartWidth * Math.Cos(newRadians);
            double shiftStartY = StartWidth * Math.Sin(newRadians);

            double shiftEndX = EndWidth * Math.Cos(newRadians);
            double shiftEndY = EndWidth * Math.Sin(newRadians);

            double newStartPointX1 = StartPoint.X - shiftStartX;
            double newStartPointY1 = StartPoint.Y - shiftStartY;
            double newStartPointX2 = StartPoint.X + shiftStartX;
            double newStartPointY2 = StartPoint.Y + shiftStartY;

            double newEndPointX1 = EndPoint.X - shiftEndX;
            double newEndPointY1 = EndPoint.Y - shiftEndY;
            double newEndPointX2 = EndPoint.X + shiftEndX;
            double newEndPointY2 = EndPoint.Y + shiftEndY;

            WPF.Point newStartPoint1 = new WPF.Point(newStartPointX1, newStartPointY1);
            WPF.Point newStartPoint2 = new WPF.Point(newStartPointX2, newStartPointY2);
            WPF.Point newEndPoint1 = new WPF.Point(newEndPointX1, newEndPointY1);
            WPF.Point newEndPoint2 = new WPF.Point(newEndPointX2, newEndPointY2);

            //Now we have all the points. Need to build a polygon shape.
            WPFMEDIA.PathGeometry rootPath = new System.Windows.Media.PathGeometry();
            WPFMEDIA.PolyLineSegment poly = new System.Windows.Media.PolyLineSegment();
            //poly.Points.Add(newStartPoint1);
            poly.Points.Add(newStartPoint2);
            poly.Points.Add(newEndPoint2);
            poly.Points.Add(newEndPoint1);

            WPFMEDIA.PathFigure newFigure = new WPFMEDIA.PathFigure();
            newFigure.StartPoint = newStartPoint1;
            newFigure.Segments.Add(poly);
            rootPath.Figures.Add(newFigure);

            return rootPath;
        }
开发者ID:RookieOne,项目名称:Adorners,代码行数:49,代码来源:Primitives.cs


示例4: BlurBehindWindow

		public static bool BlurBehindWindow (sw.Window window)
		{
			if (!DwmIsCompositionEnabled ())
				return false;

			var windowInteropHelper = new sw.Interop.WindowInteropHelper (window);
			IntPtr myHwnd = windowInteropHelper.Handle;
			var mainWindowSrc = System.Windows.Interop.HwndSource.FromHwnd (myHwnd);

			window.Background = swm.Brushes.Transparent;
			mainWindowSrc.CompositionTarget.BackgroundColor = swm.Colors.Transparent;

			var blurBehindParameters = new DWM_BLURBEHIND ();
			blurBehindParameters.dwFlags = DwmBlurBehindFlags.DWM_BB_ENABLE;
			blurBehindParameters.fEnable = true;
			blurBehindParameters.hRgnBlur = IntPtr.Zero;

			DwmEnableBlurBehindWindow (myHwnd, ref blurBehindParameters);
			int val = 1;
			DwmSetWindowAttribute (myHwnd, DwmWindowAttribute.DWMWA_TRANSITIONS_FORCEDISABLED, ref val, sizeof (int));
			return true;
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:22,代码来源:GlassHelper.cs


示例5: GetWidgetDesiredSize

        void GetWidgetDesiredSize(double availableWidth, double availableHeight, out SW.Size minSize, out SW.Size naturalSize)
        {
            // Calculates the desired size of widget.

            if (!Widget.IsMeasureValid) {
                try {
                    calculatingPreferredSize = true;
                    gettingNaturalSize = true;
                    Widget.Measure (new System.Windows.Size (availableWidth, availableHeight));
                    lastNaturalSize = Widget.DesiredSize;
                    gettingNaturalSize = false;

                    Widget.InvalidateMeasure ();
                    Widget.Measure (new System.Windows.Size (availableWidth, availableHeight));
                }
                finally {
                    calculatingPreferredSize = false;
                    gettingNaturalSize = false;
                }
            }
            minSize = Widget.DesiredSize;
            naturalSize = lastNaturalSize;
        }
开发者ID:garuma,项目名称:xwt,代码行数:23,代码来源:WidgetBackend.cs


示例6: Rect

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


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: 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


示例17: 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


示例18: 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


示例19: NewFigure

 public void NewFigure(SW.Point p)
 {
     if (Path.Segments.Count > 0) {
         Path = new PathFigure ();
         geometry.Figures.Add (Path);
     }
     LastFigureStart = p;
     EndPoint = p;
     Path.StartPoint = p;
     positionSet = true;
 }
开发者ID:nite2006,项目名称:xwt,代码行数:11,代码来源:DrawingContext.cs


示例20: ConnectToLastFigure

 public void ConnectToLastFigure(SW.Point p, bool stroke)
 {
     if (EndPoint != p) {
         var pathIsOpen = Path.Segments.Count != 0 || geometry.Figures.Count > 1 || positionSet;
         if (pathIsOpen) {
         //	LastFigureStart = p;
             Path.Segments.Add (new LineSegment (p, stroke));
         }
         else
             NewFigure (p);
     }
     if (!stroke)
         LastFigureStart = p;
 }
开发者ID:nite2006,项目名称:xwt,代码行数:14,代码来源:DrawingContext.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# System.__DTString类代码示例发布时间:2022-05-26
下一篇:
C# System.Win32类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap