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


C# Media.RectangleGeometry类代码示例

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


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


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