Ejemplo n.º 1
0
        protected override void OnStart(AppHost host)
        {
            var listbox = new LayoutFarm.CustomWidgets.ListBox(300, 400);

            listbox.SetLocation(10, 10);
            listbox.BackColor = KnownColors.FromKnownColor(KnownColor.LightGray);
            //add list view to viewport
            host.AddChild(listbox);
            //add
            RequestFont listItemFont = new RequestFont("tahoma", 18);

            for (int i = 0; i < 10; ++i)
            {
                var listItem = new LayoutFarm.CustomWidgets.ListItem(400, 20);
                if ((i % 2) == 0)
                {
                    listItem.BackColor = KnownColors.FromKnownColor(KnownColor.OrangeRed);
                }
                else
                {
                    listItem.BackColor = KnownColors.FromKnownColor(KnownColor.Orange);
                }
                listItem.SetFont(listItemFont);
                listItem.Text = "A" + i;
                listbox.AddItem(listItem);
            }
        }
Ejemplo n.º 2
0
        //
        protected override void OnStart(AppHost host)
        {
            _textbox = new LayoutFarm.CustomWidgets.TextBox(400, 30, false);
            _textbox.SetLocation(20, 20);
            var style2 = new TextEditing.TextSpanStyle();

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

            var textSplitter = new LayoutFarm.CustomWidgets.ContentTextSplitter();

            _textbox.TextSplitter = textSplitter;
            _listbox = new CustomWidgets.ListBox(300, 200);
            _listbox.SetLocation(0, 40);
            _listbox.Visible = false;
            //------------------------------------
            //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(_listbox);
            //------------------------------------
            BuildSampleCountryList();
        }
Ejemplo n.º 3
0
 public SuggestionWindowMx(int w, int h)
 {
     _floatWindow = new CustomWidgets.UIFloatWindow(w, h);
     _listbox     = new CustomWidgets.ListBox(w, h);
     _floatWindow.AddContent(_listbox);
     _listbox.ListItemMouseEvent    += listView_ListItemMouseEvent;
     _listbox.ListItemKeyboardEvent += listView_ListItemKeyboardEvent;
 }