Exemple #1
0
        Point offset    = new Point(0, 0); //记录动了多少距离
        public Shopping_Basket_Form(Order order)
        {
            InitializeComponent();
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            int totalprice = 0;

            foreach (OrderItem orderItem1 in order.OrderItems)
            {
                totalprice += orderItem1.Amount * orderItem1.Cuisine.UnitPrice;
            }
            lblTotalPrice.Text = totalprice.ToString();

            int i = 0;

            foreach (OrderItem orderItem in order.OrderItems)
            {
                Image            image   = ImageToByte.BytesToImage(orderItem.Cuisine.Picture);
                Shopping_Control control = new Shopping_Control(image);
                control.CuisineName = orderItem.Cuisine.Name;
                control.Detail      = orderItem.Cuisine.Description;
                control.Amount      = orderItem.Amount;
                pnlOrderItemShow.Controls.Add(control);
                control.SetBounds(0, i * 75, 300, 75);
                control.Location = new Point(10, i * 80 + 10);
                i++;
            }
        }
        public Shopping_Basket_Form(Order order)
        {
            int i = 0;

            foreach (OrderItem orderItem in order.OrderItems)
            {
                Shopping_Control control = new Shopping_Control();
                control.DataBindings.Add("CuisineName", orderItem.Cuisine, "Name");
                control.DataBindings.Add("Image", orderItem.Cuisine, "Picture");
                control.DataBindings.Add("Detail", orderItem.Cuisine, "Description");
                control.DataBindings.Add("Amount", orderItem, "Description");
                pnlOrderItemShow.Controls.Add(control);
                control.SetBounds(0, i * 75, 267, 75);
                i++;
            }
        }
        public Submit_Form(Order order)
        {
            this.order = order;
            InitializeComponent();
            TotalPrice.Text = order.TotalPrice.ToString();
            OrderTime.Text  = order.OrderTime;
            int i = 0;

            foreach (OrderItem orderItem in order.OrderItems)
            {
                Shopping_Control control = new Shopping_Control();
                control.DataBindings.Add("CuisineName", orderItem.Cuisine, "Name");
                control.DataBindings.Add("Image", orderItem.Cuisine, "Picture");
                control.DataBindings.Add("Detail", orderItem.Cuisine, "Description");
                control.DataBindings.Add("Amount", orderItem, "Description");
                pnlOrderItemShow.Controls.Add(control);
                control.SetBounds(0, i * 75, 267, 75);
                i++;
            }
        }