本文整理汇总了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);
}
示例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();
}
示例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
};
}
示例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()");
}
}
示例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(); };
}
示例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);
};
}
示例7: RectangleGeometry
protected override GeometryHitTestResult HitTestCore
(GeometryHitTestParameters hitTestParameters)
{
var geometry = new RectangleGeometry(VisualTreeHelper.GetDescendantBounds(this));
return new GeometryHitTestResult
(this, geometry.FillContainsWithDetail(hitTestParameters.HitGeometry));
}
示例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);
}
示例9: GetOneInfoInsideRect
public FrameworkElement GetOneInfoInsideRect(RectangleGeometry rect) {
_infoShape = null;
VisualTreeHelper.HitTest(_graphCanvas, null,
InfoHitTestSelOneResultCallback,
new GeometryHitTestParameters(rect));
return _infoShape;
}
示例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;
}
示例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);
}
示例12: GetNodeOrRailUnderMouse
public object GetNodeOrRailUnderMouse(RectangleGeometry rect) {
_nodeUnderMouse = null;
_railUnderMouse = null;
VisualTreeHelper.HitTest(_graphCanvas, null,
NodeOrRailHitTestSelOnlyOneNodeCallback,
new GeometryHitTestParameters(rect));
return (object)_nodeUnderMouse ?? _railUnderMouse;
}
示例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");
}
示例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;
}
示例15: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
FullRect = (RectangleGeometry)GetTemplateChild("FullRect");
HeaderRect = (RectangleGeometry)GetTemplateChild("HeaderRect");
HeaderContainer = (ContentControl)GetTemplateChild("HeaderContainer");
HeaderContainer.SizeChanged += HeaderContainer_SizeChanged;
}