public override void DrawDynamicFigure(Point p1, PictureBox pictureBox, bool shift) { apCanvas.currentBitmap = new Bitmap(apCanvas.tmpBitmap); Bitmap newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height); Graphics g = Graphics.FromImage(apCanvas.currentBitmap); if (shift == false || formFigure is CircleForm || formFigure is SquareForm || formFigure is RecTriangleForm || formFigure is PolygonForm) { List <Point> figurePoints = formFigure.CalculateFigure(startPoint, p1); brush.DrawFigure(formFigure, newBitmap, pictureBox, figurePoints); } else if (formFigure is EllipseForm) { List <Point> figurePoints = new CircleForm().CalculateFigure(startPoint, p1); brush.DrawFigure(new CircleForm(), newBitmap, pictureBox, figurePoints); } else if (formFigure is IsoTriangleForm) { List <Point> figurePoints = new RecTriangleForm().CalculateFigure(startPoint, p1); brush.DrawFigure(new RecTriangleForm(), newBitmap, pictureBox, figurePoints); } else { List <Point> figurePoints = new SquareForm().CalculateFigure(startPoint, p1); brush.DrawFigure(new SquareForm(), newBitmap, pictureBox, figurePoints); } typeOfFilling.Fill(formFigure.GetCenter(startPoint, p1), pictureBox, newBitmap); g.DrawImage(newBitmap, 0, 0, pictureBox.Width - 1, pictureBox.Height - 1); pictureBox.Image = apCanvas.currentBitmap; }
protected override void InitializeComponent() { form = new SquareForm("Login shit"); form.Height = 599; form.Width = 750; Panel panel = new Panel { Name = "logo", BackgroundImageLayout = ImageLayout.Center, BackgroundImage = Image.FromFile("logo.jpg"), Width = 400, Height = 400 }; form.Controls.Add(panel); FlatPanel panelMain = new FlatPanel("main") { AutoSize = true, AutoSizeMode = AutoSizeMode.GrowOnly, Dock = System.Windows.Forms.DockStyle.None, BackColor = colors.LightGray1, Padding = new Padding(1), Left = panel.Width, }; form.Controls.Add(panelMain); FlatPanel panelLogin = new FlatPanel("main") { AutoSize = true, Dock = System.Windows.Forms.DockStyle.None, BackColor = colors.LighterGray1, Padding = new Padding(20), Location = new Point(1, 1) }; panelMain.Controls.Add(panelLogin); // Don't touch in order to don't mess the center alignment FlatLabelTitle title = new FlatLabelTitle("Sign in", 0, 20); panelLogin.Controls.Add(title); FlatTextBoxAutoFocus _ = new FlatTextBoxAutoFocus("_"); panelLogin.Controls.Add(_); FlatPanel panelTxtName = new FlatPanel("Name") { AutoSize = true, AutoSizeMode = new AutoSizeMode(), Dock = System.Windows.Forms.DockStyle.None, BackColor = colors.White1, Padding = new Padding(4) }; panelTxtName.Location = new Point(20, 70); FlatTextBox txtName = new FlatTextBox("Name", 4, 4); panelTxtName.Controls.Add(txtName); panelLogin.Controls.Add(panelTxtName); FlatPanel panelTxtPassword = new FlatPanel("Password") { AutoSize = true, AutoSizeMode = new AutoSizeMode(), Dock = System.Windows.Forms.DockStyle.None, BackColor = colors.White1, Padding = new Padding(4), }; panelTxtPassword.Location = new Point(20, 110); FlatTextBox txtPassword = new FlatTextBox("Password", 4, 4); panelTxtPassword.Controls.Add(txtPassword); panelLogin.Controls.Add(panelTxtPassword); button = new FlatButton("Log in"); panelLogin.Controls.Add(button); button.Width = panelTxtName.Width; button.Location = new Point(20, button.Parent.Height + 20); button.Click += new System.EventHandler(TryLogin); panelLogin.Height += button.Height + 30; int positionX = centerElement.Horizontal(title.Size.Width, panelLogin.ClientSize.Width); title.Location = new System.Drawing.Point(positionX, title.Location.Y); panelMain.Top = centerElement.Vertical(panelMain.Height, form.ClientSize.Height); panelLogin.Controls.Add( new FlatLabelError("Oops! It looks like you may have forgotten your password.", 0, button.Height + 30) { Dock = DockStyle.Bottom, MaximumSize = new Size(panelLogin.Width - 40, 0), Visible = false } ); }