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

C# Media.RectangleGeometry类代码示例

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

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



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

示例1: CreateAndAddAdornment

        void CreateAndAddAdornment(ITextViewLine line, SnapshotSpan span, Brush brush, bool extendToRight)
        {
            var markerGeometry = _view.TextViewLines.GetMarkerGeometry(span);

            double left = 0;
            double width = _view.ViewportWidth + _view.MaxTextRightCoordinate;
            if (markerGeometry != null)
            {
                left = markerGeometry.Bounds.Left;
                if (!extendToRight) width = markerGeometry.Bounds.Width;
            }

            Rect rect = new Rect(left, line.Top, width, line.Height);

            RectangleGeometry geometry = new RectangleGeometry(rect);

            GeometryDrawing drawing = new GeometryDrawing(brush, new Pen(), geometry);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            Image image = new Image();
            image.Source = drawingImage;

            Canvas.SetLeft(image, geometry.Bounds.Left);
            Canvas.SetTop(image, geometry.Bounds.Top);

            _layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
        }
开发者ID:ijprest,项目名称:BackgroundColorFix,代码行数:30,代码来源:BackgroundColorVisualManager.cs


示例2: Init

        public void Init()
        {
            OldClipRect = new RectangleGeometry(new Rect(0, 0, SpectrumGraph.ActualWidth, SpectrumGraph.myGrid.RowDefinitions[0].ActualHeight));
            this.BackImg.Clip = OldClipRect;
            _bmp = BitmapFactory.New((int)this.ActualWidth, (int)this.myGrid.RowDefinitions[0].ActualHeight);
            _backBmp = BitmapFactory.New((int)this.ActualWidth, (int)this.myGrid.RowDefinitions[1].ActualHeight);
            RenderTargetBitmap tarBmp = new RenderTargetBitmap((int)this.ActualWidth, (int)this.myGrid.RowDefinitions[1].ActualHeight, 96,96,PixelFormats.Pbgra32);
            this.GraphImg.Source = _bmp;
            this.GraphImg.Stretch = Stretch.None;

            this.BackImg.Background = Brushes.Black;
            for (int i = 1; i < ConfigManager.ECGDeviceFrequensy; i++ )
            {
                if (i % 10 == 0)
                {
                    int k = i < 100 ? 7 : 17;
                    Text(i * this.ActualWidth / ConfigManager.ECGDeviceFrequensy-k, 25, i.ToString(), Colors.Green);
                    Text(i * this.ActualWidth / ConfigManager.ECGDeviceFrequensy, 0, "|", Colors.Green);
                }
            }
            //this.BackImg.D = _backBmp;
            //this.BackImg.Stretch = Stretch.None;

            ClearImage();
        }
开发者ID:KinTT,项目名称:BeatCare,代码行数:25,代码来源:SpectrumGraphUserControl.xaml.cs


示例3: PhoneSlider_SizeChanged

        private void PhoneSlider_SizeChanged(
            object sender, SizeChangedEventArgs e)
        {
            if (e.NewSize.Width <= 0 || e.NewSize.Height <= 0)
                return;

            var clipRect = new Rect(0, 0,
                e.NewSize.Width, e.NewSize.Height);

            if (Orientation == Orientation.Horizontal)
            {
                clipRect.X -= 12;
                clipRect.Width += 24;

                var margin = Resources["PhoneHorizontalMargin"];
                if (margin != null)
                    Margin = (Thickness)margin;
            }
            else
            {
                clipRect.Y -= 12;
                clipRect.Height += 24;

                var margin = Resources["PhoneVerticalMargin"];
                if (margin != null)
                    Margin = (Thickness)margin;
            }

            Clip = new RectangleGeometry
            {
                Rect = clipRect
            };
        }
开发者ID:nthobois,项目名称:7Pass,代码行数:33,代码来源:PhoneSlider.cs


示例4: PainterCache

		static PainterCache()
		{
            UseTransparentImage = true;
			try
			{
				TransparentBrush = new SolidColorBrush(Colors.Transparent);
				TransparentBrush.Freeze();
				BlackBrush = new SolidColorBrush(Colors.Black);
				BlackBrush.Freeze();
				WhiteBrush = new SolidColorBrush(Colors.White);
				WhiteBrush.Freeze();
				ZonePen = new Pen(BlackBrush, 1);
				GridLineBrush = new SolidColorBrush(Colors.Orange);
				GridLineBrush.Freeze();
				GridLinePen = new Pen(GridLineBrush, 1);
				GridLinePen.EndLineCap = PenLineCap.Square;
				GridLinePen.StartLineCap = PenLineCap.Square;
				GridLinePen.DashStyle = DashStyles.Dash;
				PointGeometry = new RectangleGeometry(new Rect(-15, -15, 30, 30));
				_transparentBackgroundBrush = CreateTransparentBackgroundBrush();
			}
			catch (Exception e)
			{
				Logger.Error(e, "PainterCache.PainterCache()");
			}
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:26,代码来源:PainterCache.cs


示例5: TranslationAdornment

        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public TranslationAdornment(IWpfTextView view)
        {
            _view = view;

            Brush brush = new SolidColorBrush(Colors.BlueViolet);
            brush.Freeze();
            Brush penBrush = new SolidColorBrush(Colors.Red);
            penBrush.Freeze();
            Pen pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            //draw a square with the created brush and pen
            System.Windows.Rect r = new System.Windows.Rect(0, 0, 30, 30);
            Geometry g = new RectangleGeometry(r);
            GeometryDrawing drawing = new GeometryDrawing(brush, pen, g);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            _image = new Image();
            _image.Source = drawingImage;

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("TranslationAdornment");

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };
        }
开发者ID:JeanAzzopardi,项目名称:TranslatorExtensionPackage,代码行数:34,代码来源:TranslationAdornment.cs


示例6: ModalControl

        public ModalControl()
        {
            DefaultStyleKey = typeof(ModalControl);

            Clip = _clip = new RectangleGeometry();

            KeyDown += (sender, e) =>
            {
                if (!e.Handled && e.Key == System.Windows.Input.Key.Escape && _content.Any())
                {
                    e.Handled = true;
                    _content.Last().OnEscPressed();
                }
            };

            LayoutUpdated += (sender, ars) =>
            {
                enqueTargetPointUpdate();
                if (Clip != _clip)
                {
                    Clip = _clip;
                }
                _clip.Rect = new Rect(new Point(), RenderSize);
            };
        }
开发者ID:srinivasarao549,项目名称:bot,代码行数:25,代码来源:ModalControl.cs


示例7: RectangleGeometry

 protected override GeometryHitTestResult HitTestCore
         (GeometryHitTestParameters hitTestParameters)
 {
     var geometry = new RectangleGeometry(VisualTreeHelper.GetDescendantBounds(this));
     return new GeometryHitTestResult
      (this, geometry.FillContainsWithDetail(hitTestParameters.HitGeometry));
 }
开发者ID:jonbonne,项目名称:OCTGN,代码行数:7,代码来源:CardScroller.cs


示例8: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            drawingGroup = new DrawingGroup();

            // Создаем объект для описания геометрической фигуры
            GeometryDrawing geometryDrawing = new GeometryDrawing();

            // Описываем и сохраняем геометрию квадрата
            RectangleGeometry rectGeometry = new RectangleGeometry();
            rectGeometry.Rect = new Rect(0, 0, 10, 10);
            geometryDrawing.Geometry = rectGeometry;

            // Настраиваем перо и кисть
            geometryDrawing.Pen = new Pen(Brushes.Red, 0.005);// Перо рамки
            geometryDrawing.Brush = Brushes.LightBlue;// Кисть закраски

            // Добавляем готовый слой в контейнер отображения
            drawingGroup.Children.Add(geometryDrawing);

            GeometryDrawing ellipsgeomy = new GeometryDrawing();

            EllipseGeometry elgeometry = new EllipseGeometry(new Point(5, 5), 2, 2);

            ellipsgeomy.Geometry = elgeometry;

            ellipsgeomy.Brush = Brushes.White;

            drawingGroup.Children.Add(ellipsgeomy);
        }
开发者ID:EugeneMurashko,项目名称:git-test,代码行数:31,代码来源:MainWindow.xaml.cs


示例9: GetOneInfoInsideRect

 public FrameworkElement GetOneInfoInsideRect(RectangleGeometry rect) {
     _infoShape = null;
     VisualTreeHelper.HitTest(_graphCanvas, null,
         InfoHitTestSelOneResultCallback,
         new GeometryHitTestParameters(rect));
     return _infoShape;
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:7,代码来源:HitTestHandler.cs


示例10: btClipRect_Click

 private void btClipRect_Click(object sender, RoutedEventArgs e)
 {
     RectangleGeometry rect = new RectangleGeometry();
     rect.Rect = new Rect(50, 50, 250, 200);
     rect.RadiusX = 10;
     rect.RadiusY = 20;
     img.Clip = rect;
 }
开发者ID:zetanove,项目名称:Esempi_Silverlight4,代码行数:8,代码来源:ImageClip.xaml.cs


示例11: Defaults

		public void Defaults ()
		{
			RectangleGeometry rg = new RectangleGeometry ();
			Assert.AreEqual (0.0, rg.RadiusX, "RadiusX");
			Assert.AreEqual (0.0, rg.RadiusY, "RadiusY");
			Assert.AreEqual (new Rect (0, 0, 0, 0), rg.Rect, "Rect");
			GeometryTest.CheckDefaults (rg);
		}
开发者ID:dfr0,项目名称:moon,代码行数:8,代码来源:RectangleGeometryTest.cs


示例12: GetNodeOrRailUnderMouse

 public object GetNodeOrRailUnderMouse(RectangleGeometry rect) {
     _nodeUnderMouse = null;
     _railUnderMouse = null;
     VisualTreeHelper.HitTest(_graphCanvas, null,
         NodeOrRailHitTestSelOnlyOneNodeCallback,
         new GeometryHitTestParameters(rect));
     return (object)_nodeUnderMouse ?? _railUnderMouse;
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:8,代码来源:HitTestHandler.cs


示例13: CustomRect

		public void CustomRect ()
		{
			RectangleGeometry rg = new RectangleGeometry ();
			rg.Rect = new Rect (1, 2, 3, 4);
			Assert.AreEqual (new Rect (1, 2, 3, 4), rg.Rect, "Rect");
			Assert.AreEqual (rg.Rect, rg.Bounds, "Bounds");
			Assert.IsNull (rg.Transform, "Transform");
		}
开发者ID:dfr0,项目名称:moon,代码行数:8,代码来源:RectangleGeometryTest.cs


示例14: TransalteRectGeometry

 private Geometry TransalteRectGeometry(RectangleGeometry rectGeometry, Vector offset, double scale)
 {
     RectangleGeometry result = new RectangleGeometry();
     result.Rect = OffsetRect(rectGeometry.Rect, offset, scale);
     result.RadiusX = rectGeometry.RadiusX;
     result.RadiusY = rectGeometry.RadiusY;
     return result;
 }
开发者ID:GilbertTeam,项目名称:Tales-Generator,代码行数:8,代码来源:GeometryTranslater.cs


示例15: OnApplyTemplate

 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     FullRect = (RectangleGeometry)GetTemplateChild("FullRect");
     HeaderRect = (RectangleGeometry)GetTemplateChild("HeaderRect");
     HeaderContainer = (ContentControl)GetTemplateChild("HeaderContainer");
     HeaderContainer.SizeChanged += HeaderContainer_SizeChanged;
 }
开发者ID:Marbulinek,项目名称:NIS,代码行数:8,代码来源:GroupBox.cs


示例16: AreBoundaryIntersecting

 public override bool AreBoundaryIntersecting(FrameworkElement cursorVisual)
 {
    RectangleGeometry cursorBounds =
        new RectangleGeometry(new Rect(0, 0, cursorVisual.ActualWidth, cursorVisual.ActualHeight));
    RectangleGeometry targetBounds =
        new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight));
    cursorBounds.Transform = (Transform)cursorVisual.TransformToVisual(this);
    return cursorBounds.FillContainsWithDetail(targetBounds) != IntersectionDetail.Empty;
 }
开发者ID:prgoodwin,项目名称:HabilisX,代码行数:9,代码来源:MagicLens.cs


示例17: GetOrCreateBoxGeometry

        protected override Geometry GetOrCreateBoxGeometry(Size renderSize)
        {
            var rect = new Rect(new Point(0, 0), renderSize);
            this.SetCurrentValue(RectProperty, rect);
            if (rect.Width <= 0 || rect.Height <= 0)
            {
                return Geometry.Empty;
            }

            if (this.CornerRadius.IsAllEqual())
            {
                // using TopLeft here as we have already checked that they are equal
                if (this.BoxGeometry is RectangleGeometry)
                {
                    return this.BoxGeometry;
                }

                var geometry = new RectangleGeometry();
                geometry.Bind(RectangleGeometry.RectProperty)
                    .OneWayTo(this, RectProperty);
                geometry.Bind(RectangleGeometry.RadiusXProperty)
                    .OneWayTo(this, CornerRadiusProperty, CornerRadiusTopLeftConverter.Default);
                geometry.Bind(RectangleGeometry.RadiusYProperty)
                    .OneWayTo(this, CornerRadiusProperty, CornerRadiusTopLeftConverter.Default);
                return geometry;
            }
            else
            {
                var geometry = new StreamGeometry();
                using (var context = geometry.Open())
                {
                    var cr = this.AdjustedCornerRadius();
                    var p = cr.TopLeft > 0
                        ? new Point(cr.TopLeft + this.StrokeThickness / 2, this.StrokeThickness / 2)
                        : new Point(this.StrokeThickness / 2, this.StrokeThickness / 2);
                    context.BeginFigure(p, true, true);
                    p = p.WithOffset(rect.Width - cr.TopLeft - cr.TopRight, 0);
                    context.LineTo(p, true, true);
                    p = context.DrawCorner(p, cr.TopRight, cr.TopRight);

                    p = p.WithOffset(0, rect.Height - cr.TopRight - cr.BottomRight);
                    context.LineTo(p, true, true);
                    p = context.DrawCorner(p, -cr.BottomRight, cr.BottomRight);

                    p = p.WithOffset(-rect.Width + cr.BottomRight + cr.BottomLeft, 0);
                    context.LineTo(p, true, true);
                    p = context.DrawCorner(p, -cr.BottomLeft, -cr.BottomLeft);

                    p = p.WithOffset(0, -rect.Height + cr.TopLeft + cr.BottomLeft);
                    context.LineTo(p, true, true);
                    context.DrawCorner(p, cr.TopLeft, -cr.TopLeft);
                }

                geometry.Freeze();
                return geometry;
            }
        }
开发者ID:JohanLarsson,项目名称:Gu.Wpf.Geometry,代码行数:57,代码来源:BoxBalloon.cs


示例18: NewWindow_SizeChanged

 protected void NewWindow_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (IsCornerRadius)
     {
         System.Windows.Rect r = new System.Windows.Rect(e.NewSize);
         RectangleGeometry gm = new RectangleGeometry(r, 7, 7); // 40 is radius here
         ((UIElement)sender).Clip = gm;
     }
 }       
开发者ID:PeterDu0404,项目名称:demo,代码行数:9,代码来源:NewWindow.cs


示例19: AreBoundaryIntersecting

 public override bool AreBoundaryIntersecting(FrameworkElement item)
 {
    RectangleGeometry itemBounds =
        new RectangleGeometry(new Rect(0, 0, item.ActualWidth, item.ActualHeight));
    RectangleGeometry rulerBounds =
        new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight));
    itemBounds.Transform = (Transform)item.TransformToVisual(this);
    return itemBounds.FillContainsWithDetail(rulerBounds) != IntersectionDetail.Empty;
 }
开发者ID:prgoodwin,项目名称:HabilisX,代码行数:9,代码来源:Ruler.cs


示例20: OnApplyTemplate

    public override void OnApplyTemplate()
    {
      base.OnApplyTemplate();

      BodyRectangle = (RectangleGeometry)GetTemplateChild(ElementBodyRectangletName);
      HeaderRectangle = (RectangleGeometry)GetTemplateChild(ElementHeaderRectangleName);
      HeaderContainer = (ContentControl)GetTemplateChild(ElementHeaderContainerName);
      HeaderContainer.SizeChanged += HeaderContainer_SizeChanged;
    }
开发者ID:modulexcite,项目名称:LoreSoft.Shared,代码行数:9,代码来源:GroupBox.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Media.RotateTransform类代码示例发布时间:2022-05-26
下一篇:
C# Media.RadialGradientBrush类代码示例发布时间: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