Exemplo n.º 1
0
        bool IForm.Refresh()
        {
            int start_x         = 8;
            int first_col_width = 0;
            int start_y         = 90;
            int end_y           = 96;
            int col             = 1;
            int row             = 0;
            int rows            = 1;

            //refresh the list box
            lstPlan.Items.Clear();
            foreach (Product product in _app.CurrentCampaign.Products)
            {
                lstPlan.Items.Add(product);
            }


            Graphics     g   = Graphics.FromHwnd(this.Handle);
            IManager     bso = new ProdTypeBSO();
            ArrayList    types;
            DisplayTheme theme = _app.Theme;

            types = (ArrayList)bso.GetAll();                            //product types
            rows  = types.Count / 2;
            foreach (ProductType type in types)
            {
                AfniLink link = new AfniLink();
                link.Text   = type.ProductTypeDescription;
                link.Height = 20;
                link.Width  = (int)g.MeasureString(link.Text, link.Font).Width + 50;
                if (link.Width > first_col_width)
                {
                    first_col_width = link.Width;
                }
                link.Tag             = type;
                link.Icon            = VLoopIcons.Next;
                link.ForeColor       = Color.Blue;
                link.LinkColor       = Color.Blue;
                link.ActiveLinkColor = Color.Blue;
                link.Font            = new Font("Tahoma", 8.25F);
                link.Left            = (col == 1 ? start_x : first_col_width + 20);
                link.Top             = start_y + (row * (link.Height + 10));
                link.LinkClicked    += new EventHandler(this.OnLinkClicked);
                this.Controls.Add(link);
                if (row == (rows - 1))
                {
                    row = 0;
                    col = 2;
                }
                else
                {
                    row++;
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        private void AddProdTypesToMenu()
        {
            IManager     bso   = new ProdTypeBSO();
            ArrayList    types = (ArrayList)bso.GetAll();
            AfniMenuItem menuItem;

            foreach (ProductType type in types)
            {
                menuItem        = new AfniMenuItem();
                menuItem.Text   = type.ProductTypeDescription;
                menuItem.Key    = type;
                menuItem.Click += new EventHandler(OnNewItemClick);
                menuItem_New.MenuItems.Add(menuItem);
            }
        }