protected override void OnPaintBackground(PaintEventArgs e)
        {
            FetchDisplayTextEventArgs eArgs = new FetchDisplayTextEventArgs(-1, ItemState.None);

            OnFetchDisplayInfo(eArgs);

            Brush b_brush = brushes.GetBrush(eArgs.Colors.BackgroundColor);

            e.Graphics.FillRectangle(b_brush, e.ClipRectangle);
        }
Exemple #2
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            FetchInfoToDislayEventArgs eArgs = new FetchInfoToDislayEventArgs(-1);

            OnFetchInfoToDislay(eArgs);

            e.Graphics.FillRectangle(brushes.GetBrush(eArgs.Colors.BackgroundColor), ClientRectangle);

            if (show_border)
            {
                ControlPaint.DrawBorder3D
                    (e.Graphics,
                    ClientRectangle);
            }
        }
Exemple #3
0
        void MakePen()
        {
            SolidColorBrush brush = BrushCache.GetBrush(Colour);

            pen = new Pen(brush, Thickness);
            pen.Freeze();
        }
Exemple #4
0
        public SolidColorBrush GetBrush(string name)
        {
            InitAliasColorMappings();

            var mapping = _aliasToColorMapping[name];

            return(BrushCache.GetBrush(mapping.Color));
        }
        public NodeControl()
        {
            InitializeComponent();

            // set the default handler for adding edges
            edgeAddingHandler = delegate(NodeBase from, NodeBase to)
            {
                EdgeBase edge = new Edge(from, to);
                myCanvas.AddEdge(edge);
            };

            newEdgePen = new Pen(BrushCache.GetBrush(Colors.White), 3);
            newEdgePen.Freeze();
            marqueePen = new Pen(BrushCache.GetBrush(Colors.White), 3);
            marqueePen.Freeze();
            marqueeFill = BrushCache.GetBrush(Color.FromArgb(50, 255, 255, 255));

            ResetView();
        }
Exemple #6
0
        public object?Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            // For a more sophisticated converter, check also the targetType and react accordingly..
            if (value is Color color)
            {
                return(BrushCache.GetBrush(color));
            }

            // Could support more source types if wish

            Type type = value.GetType();

            throw new InvalidOperationException("Unsupported type [" + type.Name + "]");
        }
Exemple #7
0
        void ShowWatermark()
        {
            if (string.IsNullOrEmpty(Text) && !string.IsNullOrEmpty(Watermark))
            {
                isWatermarked = true;

                //save the existing binding so it can be restored
                textBinding = BindingOperations.GetBinding(this, TextProperty);

                //blank out the existing binding so we can throw in our Watermark
                BindingOperations.ClearBinding(this, TextProperty);

                //set the signature watermark gray
                Foreground = BrushCache.GetBrush(Colors.LightGray);

                //display our watermark text
                Text = Watermark;
            }
        }
Exemple #8
0
        public SolidColorBrush GetBrush(string name)
        {
            InitAliasColorMappings();

            if (string.IsNullOrEmpty(name))
            {
                // Default color for example the unused space in knowledge loss
                return(DefaultDrawingPrimitives.DefaultBrush);
            }

            if (_aliasToColorMapping.ContainsKey(name) is false)
            {
                // A developer name is not known! This should not happen.
                Debug.WriteLine($"No color mapping found for developer {name}");
                return(Brushes.Black);
            }
            var mapping = _aliasToColorMapping[name];

            return(BrushCache.GetBrush(mapping.Color));
        }
Exemple #9
0
        public MyCanvas()
        {
            IsHitTestVisible = false;

            TransformGroup transforms = new TransformGroup();

            transforms.Children.Add(translate);
            transforms.Children.Add(scale);

            //RenderTransformOrigin = new Point(0.5, 0.5);
            RenderTransform = transforms;

            quadTree = new QuadTree();
            Physics  = new ForceDirectedPhysics();

            whiteBrush = BrushCache.GetBrush(Colors.White);
            fontColour = BrushCache.GetBrush(Colors.White);

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Render);

            timer.Interval = TimeSpan.FromMilliseconds(16);
            timer.Tick    += timer_Tick;
            timer.Start();

            Thread physicsThread = new Thread(RunPhysics);

            physicsThread.IsBackground = true;
            //physicsThread.Start();

            SizeChanged += MyCanvas_SizeChanged;
        }
Exemple #10
0
 private void UpdateText()
 {
     formattedText = new FormattedText("text!", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Helvetica"), 12, BrushCache.GetBrush(Colors.White));
 }
Exemple #11
0
 protected override void OnColourChanged()
 {
     brush = BrushCache.GetBrush(Colour);
 }
Exemple #12
0
 static GraphItem()
 {
     highlightBrush = BrushCache.GetBrush(Color.FromArgb(150, 255, 255, 0));
 }