예제 #1
0
 private void showNodeArcProperties(PropertyBag shapeProps, designGraph graph)
 {
     this.nodeArcProps.Enabled = true;
     this.propertiesTabControl.SelectedIndex = 0;
     try
     {
         if ((shapeProps.Owner.GetType()) == (typeof(Connection)))
         {
             arc temparc = graph.arcs.Find(delegate(arc b)
                 { return (b.displayShape == shapeProps.Owner); });
             if (temparc.Bag == null) temparc.initPropertiesBag();
             this.nodeArcProps.SelectedObject = temparc.Bag;
         }
         else
         {
             node tempnode = graph.nodes.Find(delegate(node b)
                 { return (b.displayShape == shapeProps.Owner); });
             if (tempnode.Bag == null) tempnode.initPropertiesBag();
             this.nodeArcProps.SelectedObject = tempnode.Bag;
         }
     }
     catch
     {
         this.nodeArcProps.Enabled = false;
         this.propertiesTabControl.SelectedIndex = 1;
     }
 }
예제 #2
0
 public void initPropertiesBag()
 {
     rulePropsBag = new PropertyBag(this);
     this.AddPropertiesToBag();
     rulePropsBag.GetValue += new PropertySpecEventHandler(GetPropertyBagValue);
     rulePropsBag.SetValue += new PropertySpecEventHandler(SetPropertyBagValue);
 }
예제 #3
0
 private void graphControl1_ShowNodeProperties(object sender, Netron.GraphLib.PropertyBag props)
 {
     ShowShapeProperties(props.Owner as Shape);
 }
예제 #4
0
 private void showDisplayProperties(Netron.GraphLib.UI.GraphControl GC, PropertyBag shapeProps)
 {
     try
     {
         this.displayProps.SelectedObject = shapeProps;
     }
     catch (Exception exc)
     {
         MessageBox.Show("The display properties cannot be displayed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         SearchIO.output(exc.Message, 2);
     }
 }
 private void graphControl1_ShowNodeProperties(object sender, Netron.GraphLib.PropertyBag props)
 {
     propertyGrid1.SelectedObject = props;
 }
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <remarks>
        /// Notice the double buffering directives at the end
        /// </remarks>
        public GraphControl()
        {
            //Make sure the control repaints as it is resized
            SetStyle(ControlStyles.ResizeRedraw, true);
            //allow dragdrop
            this.AllowDrop=true;
            //instantiate the layout factory
            layoutFactory=new LayoutFactory(this);

            //instanciating an attached extract to the canvas
            extract = new GraphAbstract();
            extract.Site=this;

            //init the transmission timer
            transmissionTimer.Interval = AutomataPulse;
            transmissionTimer.Tick += new EventHandler(OnTransmissionTimer); //attach of the handler

            //enable double buffering of graphics
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            //instantiate the library collection
            mLibraries = new GraphObjectsLibraryCollection();

            this.KeyDown+=new KeyEventHandler(OnKeyDown);
            this.KeyPress+=new KeyPressEventHandler(OnKeyPress);

            AddBaseMenu();
            bag = new PropertyBag();
            AddProperties();

            this.AutoScroll=true;
            this.HScroll=true;
            this.VScroll=true;

            try
            {
                Assembly ass= Assembly.GetExecutingAssembly();
                MouseCursors.Add = new Cursor(  ass.GetManifestResourceStream("Netron.GraphLib.Resources.Add.cur"));
                MouseCursors.Cross = new Cursor(    ass.GetManifestResourceStream("Netron.GraphLib.Resources.Cross.cur"));
                MouseCursors.Grip =  new Cursor(   ass.GetManifestResourceStream("Netron.GraphLib.Resources.Grip.cur"));
                MouseCursors.Move =  new Cursor(  ass.GetManifestResourceStream("Netron.GraphLib.Resources.Move.cur"));
                MouseCursors.Select =  new Cursor(  ass.GetManifestResourceStream("Netron.GraphLib.Resources.Select.cur"));
            }
            catch(Exception exc)
            {
                Trace.WriteLine(exc.Message);
            }
        }
 public void RaiseShowProps(PropertyBag props)
 {
     if(ShowNodeProperties !=null)
         ShowNodeProperties(this,props);
 }
예제 #8
0
        /// <summary>
        /// Initializes the class. This method is necessary when deserializing since various elements like
        /// the Pen cannot be serialized to file and have to be, hence, set after deserialization.
        /// </summary>
        protected internal virtual void InitEntity()
        {
            bluepen= new Pen(Brushes.DarkSlateBlue,1F);
            blackpen = new Pen(Brushes.Black,1F);
            mUID = Guid.NewGuid();
            recalculateSize = false;
            mFont = new Font(mFontFamily,mFontSize,FontStyle.Regular,GraphicsUnit.Point);
            pen=new Pen(Brushes.Black, mPenWidth);
            bag=new PropertyBag(this);
            try
            {
                bag.GetValue+=new PropertySpecEventHandler(GetPropertyBagValue);
                bag.SetValue+=new PropertySpecEventHandler(SetPropertyBagValue);
                bag.Properties.Add(new PropertySpec("Text",typeof(string),"Appearance","The text attached to the entity","[Not set]"));
                //					PropertySpec spec=new PropertySpec("MDI children",typeof(string[]));
                //					spec.Attributes=new Attribute[]{new System.ComponentModel.ReadOnlyAttribute(true)};
                //					bag.Properties.Add(spec);
                AddProperties(); //add the user defined shape properties

            }
            catch(Exception exc)
            {
                Debug.WriteLine(exc.Message);
            }
        }
 public PropertySpecDescriptor(PropertySpec item, PropertyBag bag, string name, Attribute[] attrs)
     : base(name, attrs)
 {
     this.bag = bag;
     this.item = item;
 }