Menu ▾ ▴

#25 Group selection / LayerUITypeEditor exception

F11_NetronGL
open
5
2006-01-16
2006-01-16
No

I've noticed in my application that if I have the
property editor up and select multiple items using the
mouse-down selection rectangle, that this exception
gets thrown.

If I use shift-LeftMouse to select multiple items, I
don't get this exception.

I replaced the Cobalt NetronGraphLib with the latest
CVS version of Netron_F11 and see the same result in
the Cobalt application. Also the NetronQuickStart app
can reproduce the problem.

LayerUITypeEditor.cs: line 65
//fetching the color of the layer requires a long deep
access...
args.Graphics.FillRectangle(new SolidBrush
(((Entity)((PropertyBag)
args.Context.Instance).Owner).Layer.LayerColor), r);

System.InvalidCastException was unhandled by user code
Message="Unable to cast object of type
'System.Object[]' to type 'Netron.GraphLib.PropertyBag'."
Source="NetronGraphLib"
StackTrace:
at
Netron.GraphLib.LayerUITypeEditor.PaintValue(PaintValueEventArgs
args) in
C:\ATM_MAIN\NetronSourceForge\Netron_F11\NetronGraphLibrary\UI\Layers\LayerUITypeEditor.cs:line
65
at
System.Windows.Forms.PropertyGridInternal.GridEntry.PaintValue(Object
val, Graphics g, Rectangle rect, Rectangle clipRect,
PaintValueFlags paintFlags)
at
System.Windows.Forms.PropertyGridInternal.PropertyGridView.DrawValue(Graphics
g, Rectangle rect, Rectangle clipRect, GridEntry
gridEntry, Object value, Boolean drawSelected, Boolean
checkShouldSerialize, Boolean fetchValue, Boolean
paintInPlace)
at
System.Windows.Forms.PropertyGridInternal.PropertyGridView.DrawValueEntry(Graphics
g, Rectangle rect, Rectangle clipRect, GridEntry
gridEntry, Object value, Boolean fetchValue)
at
System.Windows.Forms.PropertyGridInternal.PropertyGridView.DrawValueEntry(Graphics
g, Int32 row, Rectangle& clipRect)

Discussion

  • Jeffrey A. Hare

    Jeffrey A. Hare - 2006-01-16

    Logged In: YES
    user_id=434021

    I should have noted that this exception is caught and
    ignored, so doesn't show up outside the debugger. I guess
    this lowers its priority.

     
  • Mark Johnson, Berlin Germany

    Logged In: YES
    user_id=1246985

    Noted for further consideration, other options requested.

     
  • Mark Johnson, Berlin Germany

    Logged In: YES
    user_id=1246985

    After working this for three hous, I suddenly wonder why
    this running at all.

    So the Question should be asked : should this return with
    no action when more than on Object is selected.

    Fact is :
    Under normal use 'args.Context.Instance' is a
    - PropertyDescriptorGridEntry
    with mouse-down selection it is a
    - MultiPropertyDescriptorGridEntry
    (this fails since 'PropertyDescriptorGridEntry' is
    expected)

    with shift-LeftMouse it
    - does not seem to be called at all.

    I don't know where this setting is.
    I think the best thing would be to return if the casting
    fails.

     
  • Mark Johnson, Berlin Germany

    • assigned_to: mj10777-de-eu --> illumineo
     

Log in to post a comment.