Exemplo n.º 1
0
        public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
        {
            if (!this.HasReadyRenderElement)
            {
                //first time
                RenderElement baseRenderElement = base.GetPrimaryRenderElement(rootgfx);

                //1. add place holder first
                placeHolder      = new CustomTextRun(rootgfx, this.Width - 4, this.Height - 4);
                placeHolder.Text = placeHolderText;
                placeHolder.SetLocation(1, 1);
                placeHolder.TextColor = Color.FromArgb(180, Color.LightGray);

                baseRenderElement.AddChild(placeHolder);

                //2. textbox
                myTextBox = new TextBox(this.Width - 4, this.Height - 4, multiline);
                myTextBox.BackgroundColor = Color.Transparent;
                myTextBox.SetLocation(2, 2);

                textEvListener = new Text.TextSurfaceEventListener();

                myTextBox.TextEventListener = textEvListener;
                textEvListener.KeyDown     += new EventHandler <Text.TextDomEventArgs>(textEvListener_KeyDown);
                baseRenderElement.AddChild(myTextBox);

                return(baseRenderElement);
            }
            else
            {
                return(base.GetPrimaryRenderElement(rootgfx));
            }
        }
Exemplo n.º 2
0
 public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
 {
     if (!this.HasReadyRenderElement)
     {
         //first time
         RenderElement baseRenderElement = base.GetPrimaryRenderElement(rootgfx);
         //1. add place holder first
         placeHolder = new CustomTextRun(rootgfx, this.Width - 4, this.Height - 4);
         placeHolder.Text = placeHolderText;
         placeHolder.SetLocation(1, 1);
         placeHolder.TextColor = Color.FromArgb(180, Color.LightGray);
         baseRenderElement.AddChild(placeHolder);
         //2. textbox 
         myTextBox = new TextBox(this.Width - 4, this.Height - 4, multiline);
         myTextBox.BackgroundColor = Color.Transparent;
         myTextBox.SetLocation(2, 2);
         textEvListener = new Text.TextSurfaceEventListener();
         myTextBox.TextEventListener = textEvListener;
         textEvListener.KeyDown += new EventHandler<Text.TextDomEventArgs>(textEvListener_KeyDown);
         baseRenderElement.AddChild(myTextBox);
         return baseRenderElement;
     }
     else
     {
         return base.GetPrimaryRenderElement(rootgfx);
     }
 }