Example #1
0
                public void CancelDrag(IInputModeContext inputModeContext, PointD originalLocation)
                {
                    // restore original value
                    ClipboardBusinessObject clipboardBusinessObject = node.Tag as ClipboardBusinessObject;

                    if (clipboardBusinessObject != null)
                    {
                        clipboardBusinessObject.Value = originalValue;
                    }
                }
Example #2
0
                public void InitializeDrag(IInputModeContext inputModeContext)
                {
                    // remember the original value so the drag can be cancelled correctly
                    ClipboardBusinessObject clipboardBusinessObject = node.Tag as ClipboardBusinessObject;

                    if (clipboardBusinessObject != null)
                    {
                        originalValue = clipboardBusinessObject.Value;
                    }
                }
Example #3
0
                public void HandleMove(IInputModeContext inputModeContext, PointD originalLocation, PointD newLocation)
                {
                    double minVal     = node.Layout.X + 10;
                    double maxVal     = node.Layout.X + node.Layout.Width - 10;
                    double currentVal = newLocation.X;
                    double ratio      = ((currentVal - minVal) / (maxVal - minVal));
                    ClipboardBusinessObject clipboardBusinessObject = node.Tag as ClipboardBusinessObject;

                    if (clipboardBusinessObject != null)
                    {
                        double oldValue = clipboardBusinessObject.Value;
                        clipboardBusinessObject.Value = ratio;
                    }
                }
Example #4
0
            public void Paint(IRenderContext renderContext, Graphics graphics)
            {
                var node   = Node;
                var layout = node.Layout;

                // Draw a rounded rectangle
                double roundingX = layout.Width * roundingFactor;
                double roundingY = layout.Height * roundingFactor;

                ClipboardBusinessObject businessObject = node.Tag as ClipboardBusinessObject;

                GraphicsPath upperPath = new GraphicsPath();
                GraphicsPath lowerPath = new GraphicsPath();

                upperPath.AddBezier((float)layout.X, (float)(layout.Y + roundingY), (float)layout.X,
                                    (float)(layout.Y + (roundingY / 2)),
                                    (float)(layout.X + (roundingX / 2)), (float)layout.Y, (float)(layout.X + roundingX), (float)layout.Y);
                upperPath.AddLine((float)(layout.X + roundingX), (float)layout.Y,
                                  (float)(layout.X + layout.Width - roundingX), (float)layout.Y);

                upperPath.AddBezier((float)(layout.X + layout.Width - roundingX), (float)(layout.Y),
                                    (float)(layout.X + layout.Width - (roundingX / 2)), (float)(layout.Y),
                                    (float)(layout.X + layout.Width), (float)(layout.Y + (roundingY / 2)), (float)(layout.X + layout.Width),
                                    (float)(layout.Y + roundingY));
                upperPath.AddLine((float)(layout.X + layout.Width), (float)(layout.Y + roundingY),
                                  (float)(layout.X + layout.Width), (float)(layout.Y + layout.Height / 2));

                upperPath.AddLine((float)(layout.X + layout.Width), (float)(layout.Y + layout.Height / 2), (float)(layout.X),
                                  (float)(layout.Y + layout.Height / 2));
                upperPath.AddLine((float)(layout.X), (float)(layout.Y + layout.Height / 2), (float)layout.X,
                                  (float)(layout.Y + roundingY));


                lowerPath.AddBezier((float)(layout.X + layout.Width), (float)(layout.Y + layout.Height - roundingY),
                                    (float)(layout.X + layout.Width), (float)(layout.Y + layout.Height - (roundingY / 2)),
                                    (float)(layout.X + layout.Width - (roundingX / 2)), (float)(layout.Y + layout.Height),
                                    (float)(layout.X + layout.Width - roundingX), (float)(layout.Y + layout.Height));
                lowerPath.AddLine((float)(layout.X + layout.Width - roundingX), (float)(layout.Y + layout.Height),
                                  (float)(layout.X + roundingX), (float)(layout.Y + layout.Height));

                lowerPath.AddBezier((float)(layout.X + roundingX), (float)(layout.Y + layout.Height),
                                    (float)(layout.X + (roundingX / 2)), (float)(layout.Y + layout.Height),
                                    (float)(layout.X), (float)(layout.Y + layout.Height - (roundingY / 2)), (float)(layout.X),
                                    (float)(layout.Y + layout.Height - roundingY));
                lowerPath.AddLine((float)layout.X, (float)(layout.Y + layout.Height - roundingY), (float)(layout.X),
                                  (float)(layout.Y + (layout.Height / 2)));
                lowerPath.AddLine((float)layout.X, (float)(layout.Y + (layout.Height / 2)), (float)(layout.X + layout.Width),
                                  (float)(layout.Y + (layout.Height / 2)));
                lowerPath.AddLine((float)(layout.X + layout.Width), (float)(layout.Y + (layout.Height / 2)),
                                  (float)(layout.X + layout.Width), (float)(layout.Y + layout.Height - roundingY));

                graphics.FillPath(
                    new LinearGradientBrush(
                        new RectangleF((float)layout.X, (float)layout.Y, (float)layout.Width, (float)layout.Height),
                        Mix(Color.SkyBlue, Color.White, 0.5), Mix(Color.DodgerBlue, Color.White, 0.5),
                        90f), upperPath);
                graphics.FillPath(
                    new LinearGradientBrush(
                        new RectangleF((float)layout.X, (float)layout.Y, (float)layout.Width, (float)layout.Height),
                        Color.SkyBlue, Color.DodgerBlue, 90f), lowerPath);


                if (businessObject != null)
                {
                    // Draw a line to vizualize the business object's value
                    graphics.DrawLine(Pens.Black, (float)(layout.X + 10), (float)(layout.Y + (layout.Height * 3 / 4)),
                                      (float)(layout.X + 10 + (layout.Width - 20) * businessObject.Value),
                                      (float)(layout.Y + (layout.Height * 3 / 4)));
                    // Display the business object's name
                    graphics.DrawString(businessObject.Name, new Font("Arial", 8), Brushes.Black, (float)(layout.X + 10),
                                        (float)layout.Y + 10);
                }
            }