Exemplo n.º 1
0
        private void DiagnosticsForm_Load(object sender, System.EventArgs e)
        {
//         if(this.Height > 50)
//            panel1.Height = this.Height - 50;
//         if(this.Width > 50)
//            panel1.Width = this.Width - 50;
            //panel1.Height = this.Height;
            panel1.Width = this.Width;

            panel1.Update();
        }
Exemplo n.º 2
0
        private void GraphArea_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            selectImage = (Image)Form1.myImage.Clone();
            using (Graphics selectGraph = Graphics.FromImage(selectImage))
            {
                int   pointIndex = 0;
                float minError   = 640 * 640 + 480 * 480;         //Max number that it is possible to have

                for (ushort i = 0; i <= 359; i++)
                {
                    errorVector[i] = Convert.ToSingle((e.X - circleXvalue[i]) * (e.X - circleXvalue[i])
                                                      + (e.Y - circleYvalue[i]) * (e.Y - circleYvalue[i]));
                    if (errorVector[i] < minError)
                    {
                        pointIndex = i;                         //at the end pintIndex has the angle as well
                        minError   = errorVector[i];
                    }
                }

                selectGraph.DrawEllipse(Pens.Red, circleXvalue[pointIndex] - 1, circleYvalue[pointIndex] - 1, 2, 2);         //Draw circles to indicate the selected point
                selectGraph.DrawEllipse(Pens.Red, circleXvalue[pointIndex] - 2, circleYvalue[pointIndex] - 2, 4, 4);


                GraphArea.Invalidate();
                GraphArea.Update();

                Form1.ml  = Math.Sqrt(Math.Pow(circleXvalue[pointIndex] - 320, 2) + Math.Pow(circleYvalue[pointIndex] - 240, 2)) / 220; //220=Gama(1), Center point is 320,240
                Form1.al1 = (pointIndex < 180)?(-pointIndex):(360 - pointIndex);                                                        //Make it in +/- format

                this.lbltxtAng.Text = Convert.ToString(Form1.al1);
                this.lbltxtMag.Text = Convert.ToString(Math.Round(Form1.ml, 3));

                this.btnContinue.Enabled = true;               //enables the Continue botton that user can decide between continuing the design or re-selecting the point
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// When the mouse moves, update the X and Y coordinates of the mouse cursor
        /// </summary>
        private void PointEditorUI_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Point movePt = new Point(e.X, e.Y);
            // scale the location back to the coordinates of
            // the actual control.
            //
            Point p = PointToTarget(movePt);

            label1.Text = "x: " + p.X + ", y:" + p.Y;

            // if the left button is down, update the polygon.
            //
            if (e.Button == MouseButtons.Left && this.targetIndex != -1)
            {
                targetPoints[targetIndex] = movePt;
                panel1.Invalidate();
                panel1.Update();
            }
        }
 private void InvalidateAndUpdate(Panel panel)
 {
     panel.Invalidate(true);
     panel.Update();
 }
Exemplo n.º 5
0
        private Panel DisplayMenuItems()
        {
            int defaultSkipHeight = 10; // 10 px;
            int defaultSkipWidth = 4;
            int currentHeight = 4;
            int currentIndexOf = 0;
            List<Menu> MenuItems = new Database().GetAllMenus();

            Panel pnl = new Panel();

            pnl.AutoScroll = false;
            pnl.AutoSize = true;
            pnl.Width = 2000;
            pnl.Height = 1000;

            foreach (Menu m in MenuItems)
            {
                int currentWidth = 4;

                Label lblItemID = new Label();
                Label lblItemName = new Label();
                Label lblItemPrice = new Label();
                TextBox tbxAmmount = new TextBox();
                Button btnRemove = new Button();
                Button btnAdd = new Button();

                lblItemID.Name = String.Format("lblItemID{0}", currentIndexOf.ToString());
                lblItemName.Name = "lblItemName" + currentIndexOf.ToString();
                lblItemPrice.Name = "lblItemPrice" + currentIndexOf.ToString();
                tbxAmmount.Name = "tbxAmmount" + currentIndexOf.ToString();
                btnRemove.Name = "btnRemove" + currentIndexOf.ToString();
                btnAdd.Name = "btnAdd" + currentIndexOf.ToString();

                lblItemID.Enabled = true;
                lblItemName.Enabled = true;
                lblItemPrice.Enabled = true;
                tbxAmmount.Enabled = true;
                btnRemove.Enabled = true;
                btnAdd.Enabled = true;

                lblItemID.AutoSize = true;
                lblItemName.AutoSize = true;
                lblItemPrice.AutoSize = true;
                tbxAmmount.AutoSize = true;
                btnRemove.AutoSize = true;
                btnAdd.AutoSize = true;

                lblItemID.Text = m.MenuID.Value.ToString();
                lblItemName.Text = m.Entree + "\n" +
                              m.MainCourse + "\n" +
                              m.Dessert;
                lblItemPrice.Text = m.Price.ToString();
                tbxAmmount.Text = "0";
                btnRemove.Text = "-";
                btnAdd.Text = "+";

                lblItemID.Location = new Point(currentWidth, currentHeight);
                currentWidth += defaultSkipWidth + lblItemID.Width;
                lblItemName.Location = new Point(currentWidth, currentHeight);
                currentWidth += defaultSkipWidth + lblItemName.Width;
                lblItemPrice.Location = new Point(currentWidth, currentHeight);
                currentWidth += defaultSkipWidth + lblItemPrice.Width;
                tbxAmmount.Location = new Point(currentWidth, currentHeight);
                currentWidth += defaultSkipWidth + tbxAmmount.Width;
                btnRemove.Location = new Point(currentWidth, currentHeight);
                currentWidth += defaultSkipWidth + btnAdd.Width;
                btnAdd.Location = new Point(currentWidth, currentHeight);

                btnRemove.Click += new System.EventHandler(this.btnMenuItemsRemove_Click);
                btnAdd.Click += new System.EventHandler(this.btnMenuItemsAdd_Click);

                pnl.Controls.Add(lblItemID);
                pnl.Controls.Add(lblItemName);
                pnl.Controls.Add(lblItemPrice);
                pnl.Controls.Add(tbxAmmount);
                pnl.Controls.Add(btnRemove);
                pnl.Controls.Add(btnAdd);

                currentIndexOf++;
                currentHeight += lblItemName.Size.Height + defaultSkipHeight;
            }

            pnl.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            pnl.Update();
            return pnl;
        }
Exemplo n.º 6
0
 protected void TaskMediator(Panel stepPanel, TextBox stepLogTextBox, List<String> messages)
 {
     stepPanel.Update();
       FlushMessages(messages, stepLogTextBox);
       stepPanel.Update();
 }
Exemplo n.º 7
0
        public void AgregarEvento(int iId, DateTime dFecha, string sTitulo, string sEvento)
        {
            var oEvento = Datos.GetEntity<ClienteEventoCalendario>(c => c.ClienteEventoCalendarioID == iId);
            var oAdeudo = Datos.GetEntity<ClientesCreditoView>(c => c.ClienteID == oEvento.ClienteID);

            var pnlEvento = new Panel();
            pnlEvento.Tag = iId;
            this.flpEventos.Controls.Add(pnlEvento);
            Util.CopiarPropiedades(this.pnlMuestra, pnlEvento, "Visible");

            foreach (Control oControl in this.pnlMuestra.Controls)
            {
                // Se crea el control nuevo
                Control oNuevo = null;
                if (oControl is DateTimePicker)
                    oNuevo = new DateTimePicker() { Name = "dtp" };
                else if (oControl is Button)
                    oNuevo = new Button();
                else if (oControl is Label)
                    oNuevo = new Label() { TextAlign = (oControl as Label).TextAlign };

                // Se copian las propiedades de la base/muestra
                Util.CopiarPropiedades(oControl, oNuevo, "Visible");
                oNuevo.Name = oControl.Name;

                // Se configuran los eventos para los controles especiales
                if (oControl == this.btnRevisado)
                {
                    oNuevo.Click += this.btnBien_Click;
                }
                else if (oControl == this.dtpFecha)
                {
                    var dtp = (oNuevo as DateTimePicker);
                    dtp.Format = DateTimePickerFormat.Custom;
                    dtp.CustomFormat = "dd/MM/yyy hh:mm tt";
                    dtp.Checked = true;
                    dtp.Value = oEvento.Fecha;
                    dtp.ValueChanged += dtpFecha_ValueChanged;
                }
                else if (oControl == this.lblCambio)
                {
                    oNuevo.Visible = false;
                }
                else if (oControl == this.lblCliente)
                {
                    oNuevo.Text = oAdeudo.Nombre;
                }
                else if (oControl == this.lblVencido || oControl == this.lblAdeudo)
                {
                    oNuevo.Text = (oControl == this.lblVencido ? oAdeudo.AdeudoVencido : oAdeudo.Adeudo).Valor().ToString(GlobalClass.FormatoMoneda);
                }
                else if (oControl == this.lblContacto)
                {
                    oNuevo.Text = oAdeudo.CobranzaContacto;
                }

                // Se agrega al panel
                pnlEvento.Controls.Add(oNuevo);
                pnlEvento.Refresh();
                pnlEvento.Update();
            }
        }