Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Strange black areas after placing ShapeNode (Read 3757 times)
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Strange black areas after placing ShapeNode
Jan 16th, 2010 at 11:50am
Print Post  
Due to some reasons there are strange black areas on a diagram view after placing ShapeNode.

1. Initially I have a diagram view without a horizontal scrollbar
2. Place a ShapeNode programmaticaly - everything is ok
3. With resizing of diagram view achieve appearing of horizontal scrollbar
4. Scroll the diagram to right
5. Place a new ShapeNode
Result: instead of node there is strange black area.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Strange black areas after placing ShapeNode
Reply #1 - Jan 17th, 2010 at 11:55am
Print Post  
I could not reproduce this. In point 5, are you placing it programmatically, by drag-and-drop from the shape-listbox control, or drawing it with the mouse? How are you resizing the view - using a splitter control, or the view is docked or anchored to the form?

Stoyan
  
Back to top
 
IP Logged
 
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: Strange black areas after placing ShapeNode
Reply #2 - Jan 18th, 2010 at 5:27am
Print Post  
I place a second node programmaticaly. The view is docked and anchored to the form.

This is some code how I do it:
[code]
       public IGraphicElement CreateNode(IUnderlyingObject element, Point location)
       {
           var node = new SituationShape(diagram) { Id = element.Id };
           setNodeClientLocation(node, location);
           addNode(node);
           return node;
       }

       protected void setNodeClientLocation(DiagramNode node, Point location)
       {
           node.Bounds = new RectangleF(diagramView.ClientToDoc(location), node.Bounds.Size);
       }

       protected void addNode(DiagramNode node)
       {
           doInitNode(node);
           diagram.Items.Add(node);
       }

       public SituationShape(Diagram diagram)
           : base(diagram)
       {
           TextFormat.Alignment = StringAlignment.Center;
           TextFormat.LineAlignment = StringAlignment.Center;
           Shape = Shapes.RoundRect;
           Bounds = new RectangleF(Bounds.Location, new SizeF(HORIZ_SITUATION_NODE_SIZE, VERT_SITUATION_NODE_SIZE));
       }
[/code]

and some node management:
[code]
           if (..)
           {
               Shape.Shape = UnderlyingObject.IsCalculated ? Shapes.RoundRect : Shapes.Rectangle;
           }
           else
           {
               Shape.Shape = Shapes.Ellipse;
           }

           switch (..)
           {
               case 1:
                   Shape.Brush = new MindFusion.Drawing.SolidBrush(Color.White);
                   if (Shape.ShadowColor == Color.Transparent)
                   {
                       Shape.ShadowColor = _defaultShadowColor;
                   }
                   Shape.Pen.DashStyle = DashStyle.Solid;
                   Shape.Pen.DashPattern = null;
                   break;
               case 2:
                   Shape.Brush = new MindFusion.Drawing.SolidBrush(Color.LightGray);
                   if (Shape.ShadowColor == Color.Transparent)
                   {
                       Shape.ShadowColor = _defaultShadowColor;
                   }
                   Shape.Pen.DashStyle = DashStyle.Dash;
                   Shape.Pen.DashPattern = new float[] { 10, 10 };
                   break;
               case 3:
                   Shape.Brush = new MindFusion.Drawing.SolidBrush(Color.Transparent);
                   if (Shape.ShadowColor != Color.Transparent)
                   {
                       _defaultShadowColor = Shape.ShadowColor;
                       Shape.ShadowColor = Color.Transparent;
                   }
                   Shape.Pen.DashStyle = DashStyle.Dot;
                   Shape.Pen.DashPattern = new float[] { 2, 5 };
                   break;
               default:
                   throw new ArgumentOutOfRangeException();
           }
[/code]
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Strange black areas after placing ShapeNode
Reply #3 - Jan 18th, 2010 at 11:09am
Print Post  
Does that black area resemble the node's shape? Also are you using any custom-drawing code?

Stoyan
  
Back to top
 
IP Logged
 
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: Strange black areas after placing ShapeNode
Reply #4 - Jan 18th, 2010 at 11:28am
Print Post  
No, it doesn't. Sometimes there is some part of shape which is not hided by the black area (and I can say it's always without shadow). The black area doesn't have a definite shape, it's just a set of black areas. I'll send to you a screenshot.
I've already sent to you all code related to this node.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Strange black areas after placing ShapeNode
Reply #5 - Jan 18th, 2010 at 1:08pm
Print Post  
This looks suspicious, it probably would create a very thick pen once the view is scrolled:
e.Item.Pen.Width = diagramView.ClientToDoc(new Point(1)).X;

Could you try setting the pen.Width to 0 and check how the shape is drawn then?
  
Back to top
 
IP Logged
 
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: Strange black areas after placing ShapeNode
Reply #6 - Jan 18th, 2010 at 1:20pm
Print Post  
Where should I do it?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Strange black areas after placing ShapeNode
Reply #7 - Jan 18th, 2010 at 1:26pm
Print Post  
The diagram_ItemAdded handler in your user control does that.
  
Back to top
 
IP Logged
 
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: Strange black areas after placing ShapeNode
Reply #8 - Jan 18th, 2010 at 2:18pm
Print Post  
Thanks a lot, cool! It works now. I spent a lot of time to investigate this.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint