/// <summary> /// Test whether label collides. /// </summary> /// <param name="newLabel"></param> /// <returns>true if label collided with another (more important or earlier) label</returns> public Boolean SimpleCollisionTest(Label2D newLabel) { if (labelList.Contains(newLabel)) { return false; } Size2D newSize = TextRenderer.MeasureString(newLabel.Text, newLabel.Font); newSize = new Size2D(newSize.Width + 2 * newLabel.CollisionBuffer.Width, newSize.Height + 2 * newLabel.CollisionBuffer.Height); Rectangle2D newRect = new Rectangle2D(new Point2D(newLabel.Location.X - newLabel.CollisionBuffer.Width, newLabel.Location.Y - newLabel.CollisionBuffer.Height), newSize); foreach (Label2D label in labelList) { Size2D size = TextRenderer.MeasureString(label.Text, label.Font); size = new Size2D(size.Width + 2*label.CollisionBuffer.Width, size.Height + 2*label.CollisionBuffer.Height); Rectangle2D rect = new Rectangle2D( new Point2D(label.Location.X - newLabel.CollisionBuffer.Width, label.Location.Y - label.CollisionBuffer.Height), size); if (newRect.Intersects(rect)) { return true; } } labelList.Add(newLabel); return false; }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { var contentWidth = 0.0; var contentHeight = 0.0; if (Orientation == Orientation.Vertical) { foreach (var child in Children) { child.Measure(new Size2D(availableSize.Width, Double.PositiveInfinity)); contentWidth = Math.Max(contentWidth, child.DesiredSize.Width); contentHeight = contentHeight + child.DesiredSize.Height; } } else { foreach (var child in Children) { child.Measure(new Size2D(Double.PositiveInfinity, availableSize.Height)); contentWidth = contentWidth + child.DesiredSize.Width; contentHeight = Math.Max(contentHeight, child.DesiredSize.Height); } } return new Size2D(contentWidth, contentHeight); }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { var sizeLeft = 0.0; var sizeTop = 0.0; var sizeRight = 0.0; var sizeBottom = 0.0; foreach (var child in Children) { var availableSizeForChild = new Size2D( availableSize.Width - (sizeLeft + sizeRight), availableSize.Height - (sizeTop + sizeBottom)); child.Measure(availableSizeForChild); switch (GetDock(child)) { case Dock.Left: sizeLeft += child.DesiredSize.Width; break; case Dock.Top: sizeTop += child.DesiredSize.Height; break; case Dock.Right: sizeRight += child.DesiredSize.Width; break; case Dock.Bottom: sizeBottom += child.DesiredSize.Height; break; } } return new Size2D(sizeLeft + sizeRight, sizeTop + sizeBottom); }
public void Size2D_IsConstructedProperly() { var result = new Size2D(123.45, 456.78); TheResultingValue(result) .ShouldBe(123.45, 456.78); }
public void Size2DEqualityTests() { Size2D s1 = new Size2D(); Size2D s2 = Size2D.Empty; Size2D s3 = Size2D.Zero; Size2D s4 = new Size2D(0, 0); Size2D s5 = new Size2D(9, 10); Assert.Equal(s1, s2); Assert.NotEqual(s1, s3); Assert.Equal(s3, s4); Assert.NotEqual(s1, s5); Assert.NotEqual(s3, s5); IVectorD v1 = s1; IVectorD v2 = s2; IVectorD v3 = s3; IVectorD v4 = s4; IVectorD v5 = s5; Assert.Equal(v1, v2); Assert.NotEqual(v1, v3); Assert.Equal(v3, v4); Assert.NotEqual(v1, v5); Assert.NotEqual(v3, v5); Assert.Equal(v5, s5); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (child != null) { child.Arrange(new RectangleD(Point2D.Zero, finalSize), options); } return finalSize; }
public void Size2D_EqualsObject() { var size1 = new Size2D(123.45, 456.78); var size2 = new Size2D(123.45, 456.78); TheResultingValue(size1.Equals((Object)size2)).ShouldBe(true); TheResultingValue(size1.Equals("This is a test")).ShouldBe(false); }
public VirtualButton(Size2D<int> CustomHitbox, bool Animate = false) { this.CustomHitbox = CustomHitbox; this.Animate = Animate; PressedAnimation = "Pressed"; ReleasedAnimation = "Released"; }
public void Size2D_Area_IsCalculatedCorrectly() { var size1 = new Size2D(123.45, 456.78); TheResultingValue(size1.Area).ShouldBe(123.45 * 456.78); var size2 = new Size2D(222.22, 55555.55); TheResultingValue(size2.Area).ShouldBe(222.22 * 55555.55); }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { if (Track != null) { Track.InvalidateMeasure(); } return base.MeasureOverride(availableSize); }
public SpriteOscillator(Size2D<int> MinSize, Size2D<int> MaxSize, float Frequency, Size2D<int>? IdleSize = null, bool Oscillate = true) { this.MinSize = MinSize; this.MaxSize = MaxSize; this.IdleSize = IdleSize; this.Frequency = Frequency; this.Oscillate = Oscillate; }
public StyleFont(StyleFontFamily family, Size2D emSize, StyleFontStyle style) { if (family == null) throw new ArgumentNullException("family"); _fontFamily = family; _size = emSize; _style = style; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var arrangedSize = base.ArrangeOverride(finalSize, options); if (VisualTreeHelper.GetParent(adornerLayer) == this) { adornerLayer.Arrange(new RectangleD(Point2D.Zero, finalSize)); } return arrangedSize; }
public LabelStyle(StyleFont font, StyleBrush foreground, StyleBrush background, Point2D offset, Size2D collisionBuffer, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) : base(font, foreground, background, offset, collisionBuffer, horizontalAlignment, verticalAlignment) {}
public static Size2D GetRotatedSize(Size2D size, double angleOfRotation) { double cosOfAngleOfRotation = Math.Cos(angleOfRotation); double sinOfAngleOfRotation = Math.Sin(angleOfRotation); double rotatedWidth = Math.Abs(cosOfAngleOfRotation) * size.Width + Math.Abs(sinOfAngleOfRotation) * size.Height; double rotatedHeight = Math.Abs(sinOfAngleOfRotation) * size.Width + Math.Abs(cosOfAngleOfRotation) * size.Height; return new Size2D(rotatedWidth, rotatedHeight); }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { if (child != null) { child.Measure(availableSize); return child.DesiredSize; } return Size2D.Zero; }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { var desiredSize = base.MeasureOverride(availableSize); if (VisualTreeHelper.GetParent(adornerLayer) == this) { adornerLayer.Measure(availableSize); } return desiredSize; }
public void Size2D_OpInequality() { var size1 = new Size2D(123.45, 456.78); var size2 = new Size2D(123.45, 456.78); var size3 = new Size2D(123.45, 555.55); var size4 = new Size2D(222.22, 456.78); TheResultingValue(size1 != size2).ShouldBe(false); TheResultingValue(size1 != size3).ShouldBe(true); TheResultingValue(size1 != size4).ShouldBe(true); }
public void Size2D_EqualsSize2D() { var size1 = new Size2D(123.45, 456.78); var size2 = new Size2D(123.45, 456.78); var size3 = new Size2D(123.45, 555.55); var size4 = new Size2D(222.22, 456.78); TheResultingValue(size1.Equals(size2)).ShouldBe(true); TheResultingValue(size1.Equals(size3)).ShouldBe(false); TheResultingValue(size1.Equals(size4)).ShouldBe(false); }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { foreach (var child in Children) child.Measure(availableSize); var contentSize = (Orientation == Orientation.Vertical) ? MeasureVertically(availableSize) : MeasureHorizontally(availableSize); return contentSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (Orientation == Orientation.Vertical) { finalSize = ArrangeVertically(finalSize, options); } else { finalSize = ArrangeHorizontally(finalSize, options); } return finalSize; }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { var font = Font; if (!font.IsLoaded) return Size2D.Zero; View.Resources.StringFormatter.Reset(); View.Resources.StringFormatter.AddArgument(Value); View.Resources.StringFormatter.Format(Format ?? "{0}", View.Resources.StringBuffer); var face = font.Resource.Value.GetFace(FontStyle); return face.MeasureString(View.Resources.StringBuffer); }
public RTDeviceService() { #if NETFX_CORE var bounds = Window.Current.Bounds; ScreenResolution = new Size2D<int>((int)bounds.Width, (int)bounds.Height); IsKeyboardSupported = 0 != new Windows.Devices.Input.KeyboardCapabilities().KeyboardPresent; IsMouseSupported = 0 != new Windows.Devices.Input.MouseCapabilities().MousePresent; IsTouchSupported = 0 != new Windows.Devices.Input.TouchCapabilities().TouchPresent; #else throw new Exception("Not a WinRT device !"); #endif }
private static ImageArray GetImageArray(string sourceFormat, int maxLevel, int size) { string format = ResourceManager.GetImagePath(sourceFormat); Size2D imageSize = new Size2D(size, size); TexImageArray imageArray = TextureHelper.GetImageArray(format, maxLevel, imageSize); for (int i = 0; i < imageArray.Depth; i++) { imageArray[i].Bounds = new Region2D(GetInitialIndex(imageArray[i], size), imageSize); } return imageArray; }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { var desiredSize = new Size2D(AdornedElement.RenderSize.Width, AdornedElement.RenderSize.Height); var childrenCount = VisualTreeHelper.GetChildrenCount(this); for (int i = 0; i < childrenCount; i++) { var child = VisualTreeHelper.GetChild(this, i) as UIElement; if (child != null) { child.Measure(desiredSize); } } return desiredSize; }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { var totalPadding = BorderThickness + Padding; var totalPaddingWidth = totalPadding.Left + totalPadding.Right; var totalPaddingHeight = totalPadding.Top + totalPadding.Bottom; var child = Child; if (child == null) { return new Size2D(totalPaddingWidth, totalPaddingHeight); } var childAvailableSize = availableSize - totalPadding; child.Measure(childAvailableSize); return new Size2D( child.DesiredSize.Width + totalPaddingWidth, child.DesiredSize.Height + totalPaddingHeight); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var totalPadding = BorderThickness + Padding; var totalPaddingWidth = totalPadding.Left + totalPadding.Right; var totalPaddingHeight = totalPadding.Top + totalPadding.Bottom; var child = Child; if (child != null) { var childArrangeRect = new RectangleD( totalPadding.Left, totalPadding.Right, Math.Max(0, finalSize.Width - totalPaddingWidth), Math.Max(0, finalSize.Height - totalPaddingHeight)); child.Arrange(childArrangeRect, options); } return finalSize; }
public XNAGraphicsService(XNAContext Context, GraphicsDeviceManager GraphicsDeviceManager, GraphicsDevice GraphicsDevice, SpriteBatch SpriteBatch, Size2D<int> ViewportSize, bool KeepViewportRatio = false) { this.KeepViewportRatio = KeepViewportRatio; SideColor = new Primitives.Graphic.Color(0, 0, 0, 255); graphicsDeviceManager = GraphicsDeviceManager; graphicsDevice = GraphicsDevice; spriteBatch = SpriteBatch; context = Context; whiteTexture = new Texture2D(graphicsDevice, 1, 1, false, SurfaceFormat.Color); whiteTexture.SetData(new[] { Color.White }); this.ViewportSize = ViewportSize; ClearColor = new Primitives.Graphic.Color(0, 0, 0, 255); FrameDuration = TimeSpan.FromMilliseconds(1000f / 33f); context.IsFixedTimeStep = true; context.TargetElapsedTime = FrameDuration; ComputeSize(); }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { var templatedParentElement = TemplatedParent as UIElement; if (templatedParentElement == null) return availableSize; var hCanScroll = CanScrollHorizontally; var vCanScroll = CanScrollVertically; var contentAvailableSize = new Size2D( hCanScroll ? Double.PositiveInfinity : availableSize.Width, vCanScroll ? Double.PositiveInfinity : availableSize.Height ); var contentSize = base.MeasureOverride(contentAvailableSize); var presenterSize = new Size2D( Math.Min(availableSize.Width, contentSize.Width), Math.Min(availableSize.Height, contentSize.Height) ); var extentChanged = (extentWidth != contentSize.Width || extentHeight != contentSize.Height); extentWidth = contentSize.Width; extentHeight = contentSize.Height; var viewportChanged = (viewportWidth != presenterSize.Width || viewportHeight != presenterSize.Height); viewportWidth = presenterSize.Width; viewportHeight = presenterSize.Height; if (templatedParentElement != null && (extentChanged || viewportChanged)) { templatedParentElement.InvalidateMeasure(); } return presenterSize; }
public void ImageLoadingDownloadImageSynchronouslyByUrl() { tlog.Debug(tag, $"ImageLoadingDownloadImageSynchronouslyByUrl START"); using (Size2D size2d = new Size2D(NUIApplication.GetDefaultWindow().WindowSize.Width, NUIApplication.GetDefaultWindow().WindowSize.Height)) { var testingTarget = ImageLoader.DownloadImageSynchronously(new Uri(bmp_path), size2d, FittingModeType.Center); Assert.IsNotNull(testingTarget, "Can't create success object PixelBuffer."); Assert.IsInstanceOf <PixelBuffer>(testingTarget, "Should return PixelBuffer instance."); testingTarget.Dispose(); } try { ImageLoader.DownloadImageSynchronously(new Uri(bmp_path), null, FittingModeType.FitHeight); } catch (ArgumentNullException) { tlog.Debug(tag, $"ImageLoadingDownloadImageSynchronouslyByUrl END (OK)"); Assert.Pass("Caught ArgumentNullException : Passed!"); } }
/// <summary> /// Given a size, this will return the native symbolizer that has been adjusted to the specified size. /// </summary> /// <param name="size">The size of the symbol.</param> /// <param name="color">The color of the symbol.</param> /// <returns>The adjusted symbolizer.</returns> public IFeatureSymbolizer GetSymbolizer(double size, Color color) { IFeatureSymbolizer copy = Symbolizer.Copy(); // preserve aspect ratio, larger dimension specified if (copy is IPointSymbolizer ps) { Size2D s = ps.GetSize(); double ratio = size / Math.Max(s.Width, s.Height); s.Width *= ratio; s.Height *= ratio; ps.SetSize(s); ps.SetFillColor(color); } if (copy is ILineSymbolizer ls) { ls.SetWidth(size); ls.SetFillColor(color); } return(copy); }
public DiagramNode( [NotNull] IModelNode modelNode, DateTime addedAt, Point2D absoluteTopLeft, Point2D relativeTopLeft, Size2D size, Point2D childrenAreaTopLeft, Size2D childrenAreaSize, Maybe <ModelNodeId> parentNodeId) { ModelNode = modelNode; AbsoluteTopLeft = absoluteTopLeft; RelativeTopLeft = relativeTopLeft; AddedAt = addedAt; Size = size; ChildrenAreaTopLeft = childrenAreaTopLeft; ChildrenAreaSize = childrenAreaSize; ParentNodeId = parentNodeId; ShapeId = modelNode.Id.ToShapeId(); AbsoluteRect = CalculateAbsoluteRect(); RelativeRect = CalculateRelativeRect(); }
/// <inheritdoc/> protected override Size2D MeasureOverride(Size2D availableSize) { var panelWidth = 0.0; var panelHeight = 0.0; var childrenWidth = 0.0; var childrenHeight = 0.0; foreach (var child in Children) { var availableSizeForChild = new Size2D( availableSize.Width - childrenWidth, availableSize.Height - childrenHeight); child.Measure(availableSizeForChild); switch (GetDock(child)) { case Dock.Left: case Dock.Right: panelHeight = Math.Max(panelHeight, childrenHeight + child.DesiredSize.Height); childrenWidth += child.DesiredSize.Width; break; case Dock.Top: case Dock.Bottom: panelWidth = Math.Max(panelWidth, childrenWidth + child.DesiredSize.Width); childrenHeight += child.DesiredSize.Height; break; } } var totalWidth = Math.Max(panelWidth, childrenWidth); var totalHeight = Math.Max(panelHeight, childrenHeight); return(new Size2D(totalWidth, totalHeight)); }
void Initialize() { Window.Instance.KeyEvent += OnKeyEvent; Window.Instance.BackgroundColor = Color.Blue; Size2D WindowinSize = Window.Instance.WindowSize; WindowWidth = (int)WindowinSize[0]; int WindowHeight = (int)WindowinSize[1]; /// the buttons visual view ButtonVisualView = new VisualView(); ButtonVisualView.Size2D = new Size2D((int)(WindowWidth - 2 * FrameSize), (int)((WindowHeight - 3 * FrameSize) * ButtonToMainRatio)); ButtonVisualView.ParentOrigin = ParentOrigin.BottomLeft; ButtonVisualView.PositionUsesPivotPoint = true; ButtonVisualView.PivotPoint = PivotPoint.BottomLeft; ButtonVisualView.Position2D = new Position2D(FrameSize, -FrameSize); InitializeButtons(); Buttons[0].BackgroundColor = new Color(0.66f, 0.6f, 0.9f, 1); Window.Instance.Add(ButtonVisualView); /// the main visual view MainVisualView = new VisualView(); CurrentWidth = WindowWidth - 2 * FrameSize; CurrentHeight = (int)((WindowHeight - 3 * FrameSize) * (1 - ButtonToMainRatio)); MainVisualView.Size2D = new Size2D(3 * WindowWidth, CurrentHeight); MainVisualView.ParentOrigin = ParentOrigin.TopLeft; MainVisualView.PositionUsesPivotPoint = true; MainVisualView.PivotPoint = PivotPoint.TopLeft; MainVisualView.Position2D = new Position2D(0, FrameSize); MainVisualView.BackgroundColor = Color.Blue; Window.Instance.Add(MainVisualView); CurrentVisualView.Add(CreateVisualView1()); CurrentVisualView.Add(CreateVisualView2()); CurrentVisualView.Add(CreateVisualView3()); }
public void VisualBaseGetNaturalSize() { tlog.Debug(tag, $"VisualBaseGetNaturalSize START"); try { VisualFactory visualfactory = VisualFactory.Instance; using (PropertyMap propertyMap = new PropertyMap()) { propertyMap.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text)); var testingTarget = visualfactory.CreateVisual(propertyMap); Assert.IsNotNull(testingTarget, "Can't create success object VisualBase"); Assert.IsInstanceOf <VisualBase>(testingTarget, "Should return VisualBase instance."); using (Size2D size2d = new Size2D(1, 2)) { testingTarget.GetNaturalSize(size2d); Assert.AreEqual(0.0f, size2d.Height, "The Height got from GetNaturalSize is not right"); Assert.AreEqual(0.0f, size2d.Width, "The Width got from GetNaturalSize is not right"); } testingTarget.Dispose(); } visualfactory.Dispose(); } catch (Exception e) { tlog.Error(tag, "Caught Exception" + e.ToString()); LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } tlog.Debug(tag, $"VisualBaseGetNaturalSize END (OK)"); }
/// <summary> /// Creates and initializes a new instance of the SourceMenu class. /// Create Items for Menu ScrollContainer /// </summary> /// <param name="menuSize">menu size</param> /// <param name="itemSize">item size</param> public SourceMenu(Size2D menuSize, Size2D itemSize) { _menuSize = menuSize; _itemSize = itemSize; _showHideMenuEffect = new Effect[2]; _showMenuAnimation = new Animation(Constants.ShowMenuDuration); _showMenuAnimation.EndAction = Animation.EndActions.Cancel; _menu = new ScrollMenu(); _menu.Name = "sourceMenu"; _menu.WidthResizePolicy = ResizePolicyType.Fixed; _menu.HeightResizePolicy = ResizePolicyType.Fixed; _menu.Size2D = _menuSize; _menu.PositionUsesPivotPoint = true; _menu.ParentOrigin = ParentOrigin.BottomRight; _menu.PivotPoint = PivotPoint.BottomRight; _menu.FocusCenter = false; _menu.HoldFocusWhileInactive = true; _menu.StartActive = true; _menu.ItemDimensions = _itemSize; _menu.Gap = Constants.SourceMenuPadding; _menu.Margin = Constants.SourceMenuMargin; _menu.FocusScale = Constants.SourceFocusScale; _menu.ScrollEndMargin = Constants.SourceMenuScrollEndMargin; _menu.ClippingMode = ClippingModeType.ClipToBoundingBox; for (int i = 0; i < Constants.MenuItemsCount; ++i) { ScrollMenu.ScrollItem scrollItem = new ScrollMenu.ScrollItem(); scrollItem.item = new ImageView(Constants.ResourcePath + "/images/SourceMenu/mi" + i + ".png"); scrollItem.item.Name = ("menu-item_" + _menu.ItemCount); _menu.AddItem(scrollItem); } }
public MapControlWnd(Workspace workspace, MapControl mapcontrol) { m_workspace = workspace; m_MapControl = mapcontrol; InitializeComponent(); // 调整mapControl的状态 m_MapControl.Action = SuperMap.UI.Action.Pan; m_MapControl.MouseDown += new MouseEventHandler(map_MouseDown); m_MapControl.GeometrySelected += new SuperMap.UI.GeometrySelectedEventHandler(m_mapControl_GeometrySelected); //m_MapControl.Paint += new PaintEventHandler(m_mapControl_Paint); //m_MapControl.Click += new EventHandler(map_Click); pStyle = new GeoStyle(); pStyle.LineColor = System.Drawing.Color.Red; pStyle.LineWidth = 2; //设置跟踪层图标大小 size = new Size2D(); size.Height = 10; size.Width = 10; }
/// <summary> /// Updates the cache which contains the element's laid-out text. /// </summary> /// <param name="availableSize">The amount of space in which the element's text can be laid out.</param> private void UpdateTextLayoutCache(Size2D availableSize) { if (textLayoutCommands != null) { textLayoutCommands.Clear(); } if (View == null || containingControl == null) { return; } var content = Content; var contentElement = content as UIElement; if (contentElement == null) { if (textLayoutCommands == null) { textLayoutCommands = new TextLayoutCommandStream(); } var font = containingControl.Font; if (font.IsLoaded) { var availableSizeInPixels = Display.DipsToPixels(availableSize); var settings = new TextLayoutSettings(font, (Int32)Math.Ceiling(availableSizeInPixels.Width), (Int32)Math.Ceiling(availableSizeInPixels.Height), TextFlags.Standard, containingControl.FontStyle); View.Resources.TextRenderer.CalculateLayout(textParserResult, textLayoutCommands, settings); } } }
/// <summary> /// Calculates the size of the track's decrease button. /// </summary> /// <param name="trackSize">The size of the track.</param> /// <param name="thumbSize">The size of the track's thumb.</param> /// <returns>The size of the track's decrease button.</returns> protected Size2D CalculateDecreaseButtonSize(Size2D trackSize, Size2D thumbSize) { var orientation = this.Orientation; var val = Value; var min = Minimum; var max = Maximum; if (min == max) { return((orientation == Orientation.Horizontal) ? new Size2D(0, trackSize.Height) : new Size2D(trackSize.Width, 0)); } var trackLength = (orientation == Orientation.Horizontal) ? trackSize.Width : trackSize.Height; var thumbLength = (orientation == Orientation.Horizontal) ? thumbSize.Width : thumbSize.Height; var available = trackLength - thumbLength; var percent = (val - min) / (max - min); var used = available * percent; return((orientation == Orientation.Horizontal) ? new Size2D(Math.Max(0, Math.Floor(used)), trackSize.Height) : new Size2D(trackSize.Width, Math.Max(0, Math.Floor(used)))); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { PrepareForArrange(ColumnDefinitions); PrepareForArrange(RowDefinitions); FinalizeDimension(ColumnDefinitions, finalSize.Width); FinalizeDimension(RowDefinitions, finalSize.Height); foreach (var cell in virtualCells) { var childElement = cell.Element; var childColumn = ColumnDefinitions[cell.ColumnIndex]; var childRow = RowDefinitions[cell.RowIndex]; var childArea = new RectangleD(childColumn.Position, childRow.Position, Math.Max(0, CalculateSpanDimension(ColumnDefinitions, cell.ColumnIndex, cell.ColumnSpan)), Math.Max(0, CalculateSpanDimension(RowDefinitions, cell.RowIndex, cell.RowSpan))); childElement.Arrange(childArea); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var positionX = 0.0; var positionY = 0.0; if (Orientation == Orientation.Vertical) { foreach (var child in Children) { child.Arrange(new RectangleD(positionX, positionY, finalSize.Width, child.DesiredSize.Height)); positionY += child.DesiredSize.Height; } } else { foreach (var child in Children) { child.Arrange(new RectangleD(positionX, positionY, child.DesiredSize.Width, finalSize.Height)); positionX += child.DesiredSize.Width; } } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var positionX = 0.0; var positionY = 0.0; if (Orientation == Orientation.Vertical) { foreach (var child in Children) { child.Arrange(new RectangleD(positionX, positionY, finalSize.Width, child.DesiredSize.Height)); positionY += child.DesiredSize.Height; } } else { foreach (var child in Children) { child.Arrange(new RectangleD(positionX, positionY, child.DesiredSize.Width, finalSize.Height)); positionX += child.DesiredSize.Width; } } return finalSize; }
public void Initialize() { NUIApplication.GetDefaultWindow().KeyEvent += OnKeyEvent; Size2D stageSize = NUIApplication.GetDefaultWindow().WindowSize; // Background mRootActor = CreateBackground("LauncherBackground"); // Add logo ImageView logo = new ImageView(LOGO_PATH); logo.Name = "LOGO_IMAGE"; logo.PositionUsesPivotPoint = true; logo.PivotPoint = PivotPoint.TopCenter; logo.ParentOrigin = new Position(0.5f, 0.1f, 0.5f); logo.WidthResizePolicy = ResizePolicyType.UseNaturalSize; logo.HeightResizePolicy = ResizePolicyType.UseNaturalSize; float logoScale = (float)(NUIApplication.GetDefaultWindow().Size.Height) / 1080.0f; logo.Scale = new Vector3(logoScale, logoScale, 0); //// The logo should appear on top of everything. mRootActor.Add(logo); // Scrollview occupying the majority of the screen mScrollView = new ScrollView(); mScrollView.PositionUsesPivotPoint = true; mScrollView.PivotPoint = PivotPoint.BottomCenter; mScrollView.ParentOrigin = new Vector3(0.5f, 1.0f - 0.05f, 0.5f); mScrollView.WidthResizePolicy = ResizePolicyType.FillToParent; mScrollView.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent; mScrollView.SetSizeModeFactor(new Vector3(0.0f, 0.6f, 0.0f)); ushort buttonsPageMargin = (ushort)((1.0f - TABLE_RELATIVE_SIZE.X) * 0.5f * stageSize.Width); mScrollView.SetPadding(new PaddingType(buttonsPageMargin, buttonsPageMargin, 0, 0)); mScrollView.ScrollCompleted += OnScrollComplete; mScrollView.ScrollStarted += OnScrollStart; mPageWidth = stageSize.Width * TABLE_RELATIVE_SIZE.X * 0.5f; // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show View bubbleContainer = new View(); bubbleContainer.WidthResizePolicy = bubbleContainer.HeightResizePolicy = ResizePolicyType.FillToParent; bubbleContainer.PositionUsesPivotPoint = true; bubbleContainer.PivotPoint = PivotPoint.Center; bubbleContainer.ParentOrigin = ParentOrigin.Center; SetupBackground(bubbleContainer); mRootActor.Add(bubbleContainer); mRootActor.Add(mScrollView); // Add scroll view effect and setup constraints on pages ApplyScrollViewEffect(); // Add pages and tiles Populate(); if (mCurPage != mScrollView.GetCurrentPage()) { mScrollView.ScrollTo(mCurPage, 0.0f); } // Remove constraints for inner cube effect ApplyCubeEffectToPages(); // Set initial orientation uint degrees = 0; Rotate(degrees); // Background animation mAnimationTimer = new Timer(BACKGROUND_ANIMATION_DURATION); mAnimationTimer.Tick += PauseBackgroundAnimation; mAnimationTimer.Start(); mBackgroundAnimsPlaying = true; tlog.Debug(tag, $"Initialize() end!"); }
private void OnDiagramNodeSizeChanged(DiagramId diagramId, IDiagramNode diagramNode, Size2D newSize) { GetDiagramService(diagramId).UpdateDiagramNodeSize(diagramNode, newSize); }
protected PushButton CreateButton(string name, string text, Size2D size = null) { PushButton button = new PushButton(); if (null != size) { button.Size2D = size; } button.Focusable = true; button.Name = name; // Create the label which will show when _pushbutton focused. PropertyMap _focusText = CreateTextVisual(text, Color.Black); // Create the label which will show when _pushbutton unfocused. PropertyMap _unfocusText = CreateTextVisual(text, Color.White); button.Label = _unfocusText; // Create normal background visual. PropertyMap normalMap = CreateImageVisual(normalImagePath); // Create focused background visual. PropertyMap focusMap = CreateImageVisual(focusImagePath); // Create pressed background visual. PropertyMap pressMap = CreateImageVisual(pressImagePath); button.SelectedVisual = pressMap; button.SelectedBackgroundVisual = pressMap; button.UnselectedBackgroundVisual = normalMap; button.FocusGained += (obj, e) => { button.UnselectedBackgroundVisual = focusMap; button.UnselectedVisual = focusMap; button.Label = _focusText; }; // Chang background Visual and Label when focus lost. button.FocusLost += (obj, e) => { button.UnselectedBackgroundVisual = normalMap; button.UnselectedVisual = normalMap; button.Label = _unfocusText; }; // Chang background Visual when pressed. button.KeyEvent += (obj, ee) => { if ("Return" == ee.Key.KeyPressedName) { if (Key.StateType.Down == ee.Key.State) { button.UnselectedBackgroundVisual = pressMap; Tizen.Log.Fatal("NUI", "Press in pushButton sample!!!!!!!!!!!!!!!!"); } else if (Key.StateType.Up == ee.Key.State) { button.UnselectedBackgroundVisual = focusMap; Tizen.Log.Fatal("NUI", "Release in pushButton sample!!!!!!!!!!!!!!!!"); } } return(false); }; return(button); }
/// <summary> /// Text Sample Application initialization. /// </summary> public void Initialize() { // Set the background Color of Window. Window.Instance.BackgroundColor = Color.Black; mWindowSize = Window.Instance.Size; // Create Title TextLabel TextLabel Title = new TextLabel("Text Field"); Title.HorizontalAlignment = HorizontalAlignment.Center; Title.VerticalAlignment = VerticalAlignment.Center; // Set Text color to White Title.TextColor = Color.White; Title.PositionUsesPivotPoint = true; Title.ParentOrigin = ParentOrigin.TopCenter; Title.PivotPoint = PivotPoint.TopCenter; Title.Position2D = new Position2D(0, mWindowSize.Height / 10); // Use Samsung One 600 font Title.FontFamily = "Samsung One 600"; // Set MultiLine to false; Title.MultiLine = false; Title.PointSize = mLargePointSize; Window.Instance.GetDefaultLayer().Add(Title); // Create textField. CreateTextField(); // Create buttons to show some functions or properties. CreateButtons(); mCurruntButtonIndex = 0; // Create subTitle TextLabel TextLabel subTitle = new TextLabel("Swipe and Click the button"); subTitle.HorizontalAlignment = HorizontalAlignment.Center; subTitle.VerticalAlignment = VerticalAlignment.Center; // Set Text color to White subTitle.TextColor = Color.White; subTitle.PositionUsesPivotPoint = true; subTitle.ParentOrigin = ParentOrigin.BottomCenter; subTitle.PivotPoint = PivotPoint.BottomCenter; subTitle.Position2D = new Position2D(0, -30); // Use Samsung One 600 font subTitle.FontFamily = "Samsung One 600"; // Set MultiLine to false; subTitle.MultiLine = false; subTitle.PointSize = mSmallPointSize; Window.Instance.GetDefaultLayer().Add(subTitle); // Animation setting for the button animation mTableViewAnimation = new Animation[2]; mTableViewAnimation[0] = new Animation(); mTableViewAnimation[0].Duration = 100; mTableViewAnimation[0].AnimateBy(mTableView, "Position", new Vector3(-360, 0, 0)); mTableViewAnimation[1] = new Animation(); mTableViewAnimation[1].Duration = 100; mTableViewAnimation[1].AnimateBy(mTableView, "Position", new Vector3(360, 0, 0)); // Add Signal Callback functions Window.Instance.TouchEvent += OnWindowTouched; Window.Instance.KeyEvent += OnKey; }
// >>> TO XNA /// <summary> /// Convers a <see cref="Size2D"/> into to a <see cref="XnaPoint"/>. /// </summary> /// <param name="source">Source <see cref="Size2D"/>.</param> /// <returns>The <see cref="XnaPoint"/>.</returns> public static XnaPoint ToXnaPoint(this Size2D source) => new XnaPoint(source.Width, source.Height);
private void OnDiagramNodeHeaderSizeChanged(DiagramId diagramId, [NotNull] IDiagramNode diagramNode, Size2D newSize) { GetDiagramService(diagramId).UpdateNodeHeaderSize(diagramNode.Id, newSize); }
/// <summary> /// Loads the content. /// </summary> public void LoadContent() { if (string.IsNullOrWhiteSpace(Text)) { Text = string.Empty; } LoadContentFile(); LoadAlphaMaskFile(); font = ResourceManager.Instance.LoadSpriteFont("Fonts/" + FontName); if (SpriteSize == Size2D.Empty) { Size2D size = Size2D.Empty; if (texture != null) { size.Width = texture.Width; size.Height = texture.Height; } else { size.Width = (int)font.MeasureString(Text).X; size.Height = (int)font.MeasureString(Text).Y; } SpriteSize = size; } if (SourceRectangle == Rectangle2D.Empty) { SourceRectangle = new Rectangle2D(Point2D.Empty, SpriteSize); } RenderTarget2D renderTarget = new RenderTarget2D( GraphicsManager.Instance.Graphics.GraphicsDevice, SpriteSize.Width, SpriteSize.Height); GraphicsManager.Instance.Graphics.GraphicsDevice.SetRenderTarget(renderTarget); GraphicsManager.Instance.Graphics.GraphicsDevice.Clear(Color.Transparent); if (texture != null) { GraphicsManager.Instance.SpriteBatch.Begin(); GraphicsManager.Instance.SpriteBatch.Draw(texture, Vector2.Zero, Color.White); GraphicsManager.Instance.SpriteBatch.End(); } texture = renderTarget; GraphicsManager.Instance.Graphics.GraphicsDevice.SetRenderTarget(null); SetEffect(ref fadeEffect); SetEffect(ref rotationEffect); SetEffect(ref zoomEffect); SetEffect(ref animationEffect); if (!string.IsNullOrEmpty(Effects)) { List <string> split = Effects.Split(':').ToList(); split.ForEach(ActivateEffect); } }
protected override IDiagramNode CreateInstance(IModelNode modelNode, Size2D size, Point2D center) => new PropertyDiagramNode((PropertyNode)modelNode, (TypeDiagramNode)ParentDiagramNode);
public void UpdateSize(ModelNodeId nodeId, Size2D newSize) { MutateWithLockThenRaiseEvents(diagramMutator => diagramMutator.UpdateSize(nodeId, newSize)); }
private static bool IsInsideImage(Size2D size, int x, int y) { return(IsInRange(x, 0, size.Width) && IsInRange(y, 0, size.Height)); }
void Initialize() { Window.Instance.BackgroundColor = Color.Black; mWindowSize = Window.Instance.Size; // Applies a new theme to the application. // This will be merged on top of the default Toolkit theme. // If the application theme file doesn't style all controls that the // application uses, then the default Toolkit theme will be used // instead for those controls. StyleManager.Get().ApplyTheme(mCustomThemeUrl); // Create Title TextLabel mTitle = new TextLabel("Script"); mTitle.HorizontalAlignment = HorizontalAlignment.Center; mTitle.VerticalAlignment = VerticalAlignment.Center; // Set Text color to White mTitle.TextColor = Color.White; mTitle.PositionUsesPivotPoint = true; mTitle.ParentOrigin = ParentOrigin.TopCenter; mTitle.PivotPoint = PivotPoint.TopCenter; mTitle.Position2D = new Position2D(0, mWindowSize.Height / 10); // Use Samsung One 600 font mTitle.FontFamily = "Samsung One 600"; // Not use MultiLine of TextLabel mTitle.MultiLine = false; mTitle.PointSize = mLargePointSize; Window.Instance.GetDefaultLayer().Add(mTitle); // Create subTitle TextLabel mRadioButtonTitle = new TextLabel("Radio Button"); mRadioButtonTitle.HorizontalAlignment = HorizontalAlignment.Center; mRadioButtonTitle.VerticalAlignment = VerticalAlignment.Center; // Set Text color to White mRadioButtonTitle.TextColor = Color.White; mRadioButtonTitle.PositionUsesPivotPoint = true; mRadioButtonTitle.ParentOrigin = ParentOrigin.TopCenter; mRadioButtonTitle.PivotPoint = PivotPoint.TopLeft; mRadioButtonTitle.Position2D = new Position2D(-150, 110); // Use Samsung One 600 font mRadioButtonTitle.FontFamily = "Samsung One 600"; // Not use MultiLine of TextLabel mRadioButtonTitle.MultiLine = false; mRadioButtonTitle.PointSize = mMiddlePointSize; Window.Instance.GetDefaultLayer().Add(mRadioButtonTitle); // Create RadioButtons mRadioButtons = new RadioButton[2]; for (int i = 0; i < 2; ++i) { // Create new RadioButton mRadioButtons[i] = new RadioButton(); // Set RadioButton size mRadioButtons[i].Size2D = new Size2D(300, 65); mRadioButtons[i].PositionUsesPivotPoint = true; mRadioButtons[i].ParentOrigin = ParentOrigin.Center; mRadioButtons[i].PivotPoint = PivotPoint.CenterLeft; // Set RadioButton Position mRadioButtons[i].Position = new Position(-150, -20, 0) + new Position(160, 0, 0) * i; mRadioButtons[i].Label = CreateTextVisual(ButtonText[i], mMiddlePointSize * 2.0f, Color.White); mRadioButtons[i].Scale = new Vector3(0.5f, 0.5f, 0.5f); // Add click event callback function mRadioButtons[i].Clicked += OnRadioButtonClicked; Window.Instance.GetDefaultLayer().Add(mRadioButtons[i]); } mRadioButtons[0].Selected = true; // Create TextLabel for the CheckBox Button mCheckBoxButtonTitle = new TextLabel("CheckBox Button"); mCheckBoxButtonTitle.HorizontalAlignment = HorizontalAlignment.Center; mCheckBoxButtonTitle.VerticalAlignment = VerticalAlignment.Center; mCheckBoxButtonTitle.TextColor = Color.White; mCheckBoxButtonTitle.PositionUsesPivotPoint = true; mCheckBoxButtonTitle.ParentOrigin = ParentOrigin.TopCenter; mCheckBoxButtonTitle.PivotPoint = PivotPoint.TopLeft; mCheckBoxButtonTitle.Position2D = new Position2D(-150, 190); mCheckBoxButtonTitle.FontFamily = "Samsung One 600"; mCheckBoxButtonTitle.MultiLine = false; mCheckBoxButtonTitle.PointSize = mMiddlePointSize; Window.Instance.GetDefaultLayer().Add(mCheckBoxButtonTitle); // Create CheckBoxButton mCheckBoxButtons = new CheckBoxButton[2]; for (int i = 0; i < 2; ++i) { // Create new CheckBox Button mCheckBoxButtons[i] = new CheckBoxButton(); mCheckBoxButtons[i].PositionUsesPivotPoint = true; mCheckBoxButtons[i].ParentOrigin = ParentOrigin.Center; mCheckBoxButtons[i].PivotPoint = PivotPoint.CenterLeft; mCheckBoxButtons[i].Position = new Position(-150, 60, 0) + new Position(160, 0, 0) * i; mCheckBoxButtons[i].Label = CreateTextVisual(ButtonText[1], mMiddlePointSize + 1.0f, Color.White); mCheckBoxButtons[i].Scale = new Vector3(0.8f, 0.8f, 0.8f); mCheckBoxButtons[i].StateChanged += OnCheckBoxButtonClicked; Window.Instance.GetDefaultLayer().Add(mCheckBoxButtons[i]); } // Create PushButton mPushButton = new PushButton(); mPushButton.PositionUsesPivotPoint = true; mPushButton.ParentOrigin = ParentOrigin.BottomCenter; mPushButton.PivotPoint = PivotPoint.BottomCenter; mPushButton.Name = "ChangeTheme"; mPushButton.Size2D = new Size2D(230, 35); mPushButton.ClearBackground(); mPushButton.Position = new Position(0, -50, 0); PropertyMap normalTextMap = CreateTextVisual("Change Theme", mMiddlePointSize, Color.White); mPushButton.Label = normalTextMap; mPushButton.Clicked += OnPushButtonClicked; Window.Instance.GetDefaultLayer().Add(mPushButton); Window.Instance.KeyEvent += OnKey; }
private void OnDiagramNodeSizeChanged(IDiagramNode diagramNode, Size2D oldSize, Size2D newSize) { if (_followedDiagramNodes != null && _followedDiagramNodes.Contains(diagramNode)) { EnsureUiThread(MoveViewport); } }
public static SizeF Convert(Size2D viewSize) { SizeF gdiSize = new SizeF((Single)viewSize.Width, (Single)viewSize.Height); return(gdiSize); }
public TexImageArray(Size2D size, params Image[] images) : base(size, images) { }
// >>> TO SYSTEM /// <summary> /// Convers a <see cref="Size2D"/> into to a <see cref="SystemSize"/>. /// </summary> /// <param name="source">Source <see cref="Size2D"/>.</param> /// <returns>The <see cref="SystemSize"/>.</returns> public static SystemSize ToSystemPoint(this Size2D source) => new SystemSize(source.Width, source.Height);
// Calculate menu's position based on Anchor and parent's positions. // If there is not enought space, then menu's size can be also resized. private void CalculateMenuPosition() { if ((Anchor == null) || (Content == null)) { return; } if (Items == null) { return; } if ((Size2D.Width == 0) && (Size2D.Height == 0)) { return; } int menuScreenPosX = 0; int menuScreenPosY = 0; if (HorizontalPositionToAnchor == RelativePosition.Start) { if (GetRootView().LayoutDirection == ViewLayoutDirectionType.LTR) { menuScreenPosX = (int)Anchor.ScreenPosition.X - Size2D.Width; } else { menuScreenPosX = (int)Anchor.ScreenPosition.X + Anchor.Margin.Start + Anchor.Size2D.Width + Anchor.Margin.End; } } else if (HorizontalPositionToAnchor == RelativePosition.Center) { menuScreenPosX = (int)Anchor.ScreenPosition.X + Anchor.Margin.Start + (Anchor.Size2D.Width / 2) - (Size2D.Width / 2); } else { if (GetRootView().LayoutDirection == ViewLayoutDirectionType.LTR) { menuScreenPosX = (int)Anchor.ScreenPosition.X + Anchor.Margin.Start + Anchor.Size2D.Width + Anchor.Margin.End; } else { menuScreenPosX = (int)Anchor.ScreenPosition.X - Size2D.Width; } } if (VerticalPositionToAnchor == RelativePosition.Start) { menuScreenPosY = (int)Anchor.ScreenPosition.Y - Size2D.Height; } else if (VerticalPositionToAnchor == RelativePosition.Center) { menuScreenPosY = (int)Anchor.ScreenPosition.Y + Anchor.Margin.Top + (Anchor.Size2D.Height / 2) - (Size2D.Height / 2); } else { menuScreenPosY = (int)Anchor.ScreenPosition.Y + Anchor.Margin.Top + Anchor.Size2D.Height + Anchor.Margin.Bottom; } int menuSizeW = Size2D.Width; int menuSizeH = Size2D.Height; // Check if menu is not inside parent's boundary in x coordinate system. if (menuScreenPosX + Size2D.Width > Window.Size.Width) { menuScreenPosX = Window.Size.Width - Size2D.Width; if (menuScreenPosX < 0) { menuScreenPosX = 0; menuSizeW = Window.Size.Width; } } else if (menuScreenPosX < 0) { menuScreenPosX = 0; menuSizeW = Window.Size.Width; } // Check if menu is not inside parent's boundary in y coordinate system. if (menuScreenPosY + Size2D.Height > Window.Size.Height) { menuScreenPosY = Window.Size.Height - Size2D.Height; if (menuScreenPosY < 0) { menuScreenPosY = 0; menuSizeH = Window.Size.Height; } } else if (menuScreenPosY < 0) { menuScreenPosY = 0; menuSizeH = Window.Size.Height; } // Position is relative to parent's coordinate system. var menuPosX = menuScreenPosX; var menuPosY = menuScreenPosY; if ((Position2D.X != menuPosX) || (Position2D.Y != menuPosY) || (Size2D.Width != menuSizeW) || (Size2D.Height != menuSizeH)) { Position2D = new Position2D(menuPosX, menuPosY); Size2D = new Size2D(menuSizeW, menuSizeH); } }
/// <summary> /// Initializes a new instance of the <see cref="RenderSizeChangedEntry"/> structure. /// </summary> /// <param name="element">The element which has requested a RenderSizeChanged event.</param> /// <param name="previousSize">The element's size prior to the layout change.</param> public RenderSizeChangedEntry(UIElement element, Size2D previousSize) { this.Element = element; this.PreviousSize = previousSize; }
/// <summary> /// Before a shape is selected, moving the mouse over a shape will highlight that shape by changing /// its appearance. This tests features to determine the first feature to qualify as the highlight. /// </summary> /// <param name="e">The GeoMouseArgs parameter contains information about the mouse location /// and geographic coordinates.</param> /// <returns>A value indicating whether the shape was successfully highlighted.</returns> private bool ShapeHighlight(GeoMouseArgs e) { if (e == null) { throw new ArgumentNullException("e", "e is null."); } Rectangle mouseRect = new Rectangle(_mousePosition.X - 3, _mousePosition.Y - 3, 6, 6); Extent ext = Map.PixelToProj(mouseRect); IPolygon env = ext.ToEnvelope().ToPolygon(); bool requiresInvalidate = false; foreach (IFeature feature in _featureSet.Features) { if (_featureSet.FeatureType == FeatureType.Point || _featureSet.FeatureType == FeatureType.MultiPoint) { MapPointLayer mpl = _layer as MapPointLayer; if (mpl != null) { int w = 3; int h = 3; PointCategory pc = mpl.GetCategory(feature) as PointCategory; if (pc != null) { if (pc.Symbolizer.ScaleMode != ScaleMode.Geographic) { Size2D size = pc.Symbolizer.GetSize(); w = (int)size.Width; h = (int)size.Height; } } _imageRect = new Rectangle(e.Location.X - (w / 2), e.Location.Y - (h / 2), w, h); if (_imageRect.Contains(Map.ProjToPixel(feature.Geometry.Coordinates[0]))) { _activeFeature = feature; _oldCategory = mpl.GetCategory(feature); if (_selectedCategory == null) { _selectedCategory = _oldCategory.Copy(); _selectedCategory.SetColor(Color.Red); _selectedCategory.LegendItemVisible = false; } mpl.SetCategory(_activeFeature, _selectedCategory); } } requiresInvalidate = true; } else { if (feature.Geometry.Intersects(env)) { _activeFeature = feature; _oldCategory = _layer.GetCategory(_activeFeature); if (_featureSet.FeatureType == FeatureType.Polygon) { IPolygonCategory pc = _activeCategory as IPolygonCategory; if (pc == null) { _activeCategory = new PolygonCategory(Color.FromArgb(55, 255, 0, 0), Color.Red, 1) { LegendItemVisible = false }; } } if (_featureSet.FeatureType == FeatureType.Line) { ILineCategory pc = _activeCategory as ILineCategory; if (pc == null) { _activeCategory = new LineCategory(Color.Red, 3) { LegendItemVisible = false }; } } _layer.SetCategory(_activeFeature, _activeCategory); requiresInvalidate = true; } } } return(requiresInvalidate); }