Ejemplo n.º 1
0
        //private static GraphicsPath GetPath(string text, Font font)
        //{
        //    var fontMetrics = (from c in text.Distinct()
        //                       select new { Char = c, Metrics = Metrics(c, font) }).
        //                       ToDictionary(c => c.Char, c=> c.Metrics);
        //    // Measure each character and check the metrics against the overall metrics of rendering
        //    // an entire word with kerning.
        //}
        //private static RectangleF Metrics(char c, Font font)
        //{
        //    var path = new GraphicsPath();
        //    path.AddString(c.ToString(), font.FontFamily, (int)font.Style, font.Size, new Point(0, 0), StringFormat.GenericTypographic);
        //    return path.GetBounds();
        //}

#if Net4
        public override void RegisterEvents(ISvgEventCaller caller)
        {
            //register basic events
            base.RegisterEvents(caller);

            //add change event for text
            caller.RegisterAction <string, string>(this.ID + "/onchange", OnChange);
        }
Ejemplo n.º 2
0
        /*
         *      onfocusin = "<anything>"
         *      onfocusout = "<anything>"
         *      onactivate = "<anything>"
         *      onclick = "<anything>"
         *      onmousedown = "<anything>"
         *      onmouseup = "<anything>"
         *      onmouseover = "<anything>"
         *      onmousemove = "<anything>"
         *      onmouseout = "<anything>"
         */

#if Net4
        /// <summary>
        /// Use this method to provide your implementation ISvgEventCaller which can register Actions
        /// and call them if one of the events occurs. Make sure, that your SvgElement has a unique ID.
        /// The SvgTextElement overwrites this and regsiters the Change event tor its text content.
        /// </summary>
        /// <param name="caller"></param>
        public virtual void RegisterEvents(ISvgEventCaller caller)
        {
            if (caller != null && !string.IsNullOrEmpty(this.ID))
            {
                var rpcID = this.ID + "/";

                caller.RegisterAction <float, float, int, int, bool, bool, bool, string>(rpcID + "onclick", CreateMouseEventAction(RaiseMouseClick));
                caller.RegisterAction <float, float, int, int, bool, bool, bool, string>(rpcID + "onmousedown", CreateMouseEventAction(RaiseMouseDown));
                caller.RegisterAction <float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseup", CreateMouseEventAction(RaiseMouseUp));
                caller.RegisterAction <float, float, int, int, bool, bool, bool, string>(rpcID + "onmousemove", CreateMouseEventAction(RaiseMouseMove));
                caller.RegisterAction <float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseover", CreateMouseEventAction(RaiseMouseOver));
                caller.RegisterAction <float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseout", CreateMouseEventAction(RaiseMouseOut));
                caller.RegisterAction <int, bool, bool, bool, string>(rpcID + "onmousescroll", OnMouseScroll);
            }
        }
Ejemplo n.º 3
0
        /*
         *  onfocusin = "<anything>"
         *  onfocusout = "<anything>"
         *  onactivate = "<anything>"
         *      onclick = "<anything>"
         *      onmousedown = "<anything>"
         *      onmouseup = "<anything>"
         *      onmouseover = "<anything>"
         *      onmousemove = "<anything>"
         *      onmouseout = "<anything>"
         */

        /// <summary>
        /// Use this method to provide your implementation ISvgEventCaller which can register Actions
        /// and call them if one of the events occurs. Make sure, that your SvgElement has a unique ID.
        /// </summary>
        /// <param name="caller"></param>
        public void RegisterEvents(ISvgEventCaller caller)
        {
            if (caller != null && !string.IsNullOrWhiteSpace(this.ID))
            {
                var rpcID = this.ID + "/";

                caller.RegisterAction <float, float, int, int>(rpcID + "onclick", OnClick);
                caller.RegisterAction <float, float, int, int>(rpcID + "onmousedown", OnMouseDown);
                caller.RegisterAction <float, float, int>(rpcID + "onmouseup", OnMouseUp);
                caller.RegisterAction <float, float>(rpcID + "onmousemove", OnMouseMove);
                caller.RegisterAction <float>(rpcID + "onmousescroll", OnMouseScroll);
                caller.RegisterAction(rpcID + "onmouseover", OnMouseOver);
                caller.RegisterAction(rpcID + "onmouseout", OnMouseOut);
            }
        }
Ejemplo n.º 4
0
        //private static GraphicsPath GetPath(string text, Font font)
        //{
        //    var fontMetrics = (from c in text.Distinct()
        //                       select new { Char = c, Metrics = Metrics(c, font) }).
        //                       ToDictionary(c => c.Char, c=> c.Metrics);
        //    // Measure each character and check the metrics against the overall metrics of rendering
        //    // an entire word with kerning.
        //}
        //private static RectangleF Metrics(char c, Font font)
        //{
        //    var path = new GraphicsPath();
        //    path.AddString(c.ToString(), font.FontFamily, (int)font.Style, font.Size, new Point(0, 0), StringFormat.GenericTypographic);
        //    return path.GetBounds();
        //}

#if Net4
        public override void RegisterEvents(ISvgEventCaller caller)
        {
            //register basic events
            base.RegisterEvents(caller); 
            
            //add change event for text
            caller.RegisterAction<string, string>(this.ID + "/onchange", OnChange);
        }