protected override void OnStartDemo(SampleViewport viewport)
        {
            textbox = new LayoutFarm.CustomWidgets.TextBox(400, 300, true);
            textbox.SetLocation(20, 20);
            var textSplitter = new CustomWidgets.ContentTextSplitter();
            textbox.TextSplitter = textSplitter;
            sgBox = new SuggestionWindowMx(300, 200);
            sgBox.UserConfirmSelectedItem += new EventHandler(sgBox_UserConfirmSelectedItem);
            sgBox.ListItemKeyboardEvent += new EventHandler<UIKeyEventArgs>(sgBox_ListItemKeyboardEvent);
            sgBox.Hide();
            //------------------------------------
            //create special text surface listener
            var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener();
            textSurfaceListener.CharacterAdded += (s, e) => UpdateSuggestionList();
            textSurfaceListener.CharacterRemoved += (s, e) => UpdateSuggestionList();
            textSurfaceListener.PreviewArrowKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown);
            textSurfaceListener.PreviewEnterKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown);
            textbox.TextEventListener = textSurfaceListener;
            //------------------------------------ 

            viewport.AddContent(textbox);
            viewport.AddContent(sgBox.GetPrimaryUI());
            //------------------------------------ 
            BuildSampleCountryList();
        }
コード例 #2
0
        //
        protected override void OnStart(AppHost host)
        {
            _textbox = new LayoutFarm.CustomWidgets.TextBox(400, 300, true);
            _textbox.SetLocation(20, 20);
            var style1 = new TextEditing.TextSpanStyle();

            style1.ReqFont            = new PixelFarm.Drawing.RequestFont("tahoma", 14);
            style1.FontColor          = new PixelFarm.Drawing.Color(0, 0, 0);
            _textbox.DefaultSpanStyle = style1;

            var textSplitter = new CustomWidgets.ContentTextSplitter();

            _textbox.TextSplitter = textSplitter;
            _sgBox = new SuggestionWindowMx(300, 200);
            _sgBox.UserConfirmSelectedItem += new EventHandler(sgBox_UserConfirmSelectedItem);
            _sgBox.ListItemKeyboardEvent   += new EventHandler <UIKeyEventArgs>(sgBox_ListItemKeyboardEvent);
            _sgBox.Hide();
            //------------------------------------
            //create special text surface listener
            var textSurfaceListener = new LayoutFarm.TextEditing.TextSurfaceEventListener();

            textSurfaceListener.CharacterAdded      += (s, e) => UpdateSuggestionList();
            textSurfaceListener.CharacterRemoved    += (s, e) => UpdateSuggestionList();
            textSurfaceListener.PreviewArrowKeyDown += new EventHandler <TextEditing.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown);
            textSurfaceListener.PreviewEnterKeyDown += new EventHandler <TextEditing.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown);
            _textbox.TextEventListener = textSurfaceListener;
            //------------------------------------

            host.AddChild(_textbox);
            host.AddChild(_sgBox.GetPrimaryUI());
            //------------------------------------
            BuildSampleCountryList();
        }
コード例 #3
0
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var textbox1 = new LayoutFarm.CustomWidgets.TextBox(400, 100, true);
     var style1 = new Text.TextSpanStyle();
     style1.FontInfo = new PixelFarm.Drawing.RequestFont("tahoma", 10);// viewport.P.GetFont("tahoma", 10, PixelFarm.Drawing.FontStyle.Regular);
     textbox1.DefaultSpanStyle = style1;
     viewport.AddContent(textbox1);
     var textbox2 = new LayoutFarm.CustomWidgets.TextBox(400, 500, true);
     textbox2.SetLocation(20, 120);
     viewport.AddContent(textbox2);
     var textSplitter = new ContentTextSplitter(); 
     textbox2.TextSplitter = textSplitter;
     textbox2.Text = "Hello World!";
 }