當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。