示例#1
0
文件: PButton.cs 项目: profK/Proteus
        public PButton(string text, string bkgImage = null) : base(MakeHTML(text, bkgImage))
        {
            objRefFromJS = DotNetObjectReference.Create(this);
            if (bkgImage != null)
            {
                _styleSettings["background-size"]   = "100%";
                _styleSettings["background-origin"] = "content";
                _styleSettings["background-image"]  = "url(" + bkgImage + ")";
            }

            ProteusContext.JSInvokeVoid("Proteus.attachOnClick",
                                        _domElement, objRefFromJS, "OnClickReceiver");
        }
示例#2
0
        public override void RenderLocal(Matrix localXform)
        {
            ProteusContext.Log("Render matrix=" + localXform.ToString());
            Point origin = localXform.TransformPoint(Point.Zero);

            //ProteusContext.JSInvokeVoid(
            //    "Proteus.setElementLayout",_domElement,origin.X,
            //    origin.Y,Size.Width,Size.Height);
            _styleSettings["position"] = "fixed";
            _styleSettings["left"]     = origin.X + "px";
            _styleSettings["top"]      = origin.Y + "px";
            _styleSettings["width"]    = Size.Width + "px";
            _styleSettings["height"]   = Size.Height + "px";
            ProteusContext.JSInvokeVoid(
                "Proteus.resetStyle", _domElement, _styleSettings);
        }
示例#3
0
        public HTMLComponent(string html)
        {
            _domElement = ProteusContext.JSInvoke <IJSObjectReference>(
                "Proteus.htmlToElement", html);
            _objRefFromJS = DotNetObjectReference.Create(this);
            float[] sza = ProteusContext.JSInvoke <float[]>(
                "Proteus.getElementSize", _domElement);
            Size size = new Size(sza[0], sza[1]);

            ProteusContext.Log(html);
            ProteusContext.Log("html size=" + size.ToString());
            NaturalSize = size;
            MinSize     = NaturalSize;
            ProteusContext.JSInvokeVoid("Proteus.setMouseCallbacks", _domElement,
                                        _objRefFromJS, "DoJSMouseDown", "DoJSMouseUp", "DoJSMouseMove");
        }