Exemplo n.º 1
0
        /// <summary>
        /// aktualisiert das Feld nodeGraphics
        /// </summary>
        private void UpdateNodeGraphics()
        {
            if ((position != null) && (inSlope != null) && (outSlope != null))
            {
                // Linien zu den Stützpunkten
                _nodeGraphics[0] = new System.Drawing.Drawing2D.GraphicsPath(new PointF[] { inSlopeAbs, position }, new byte[] { 1, 1 });
                _nodeGraphics[1] = new System.Drawing.Drawing2D.GraphicsPath(new PointF[] { outSlopeAbs, position }, new byte[] { 1, 1 });

                // Stützpunkte
                System.Drawing.Drawing2D.GraphicsPath inPoint = new System.Drawing.Drawing2D.GraphicsPath();
                inPoint.AddEllipse(inSlopeRect);
                _nodeGraphics[2] = inPoint;

                System.Drawing.Drawing2D.GraphicsPath outPoint = new System.Drawing.Drawing2D.GraphicsPath();
                // wir versuchen ein Dreieck zu zeichnen *lol*
                Vector2 dir = outSlope.Normalized;
                outPoint.AddPolygon(
                    new PointF[] {
                    (6 * dir) + outSlopeAbs,
                    (6 * dir.RotateCounterClockwise(Math.PI * 2 / 3)) + outSlopeAbs,
                    (6 * dir.RotateCounterClockwise(Math.PI * 4 / 3)) + outSlopeAbs,
                    (6 * dir) + outSlopeAbs
                });
                _nodeGraphics[3] = outPoint;
            }
        }
Exemplo n.º 2
0
 //配置位圆形窗体
 private void Float_Paint(object sender, PaintEventArgs e)
 {
     System.Drawing.Drawing2D.GraphicsPath mypath = new System.Drawing.Drawing2D.GraphicsPath();
     //mypath.AddEllipse(10, 10, this.Width - 30, this.Height - 20);
     mypath.AddEllipse(100, 5, this.ClientSize.Width - 100, this.ClientSize.Height - 15);
     this.Region = new Region(mypath);
 }
Exemplo n.º 3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            using (System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath())
            {
                path.AddEllipse(0, 0, this.ClientSize.Width - 1, this.ClientSize.Height - 1);

                if (bolMouseHoverFlag)
                {
                    using (SolidBrush b = new SolidBrush(this.HoverBackColor))
                    {
                        e.Graphics.FillPath(b, path);
                    }
                    using (Pen p = new Pen(this.HoverBorderColor))
                    {
                        e.Graphics.DrawPath(p, path);
                    }
                }
                else
                {
                    using (SolidBrush b = new SolidBrush(this.BackColor))
                    {
                        e.Graphics.FillPath(b, path);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void WindowMain_Load(object sender, EventArgs e)
        {
            LowerUserControl infoPanel = new LowerUserControl();

            if (Login.adminstatus)
            {
                infoPanel.LabelAdminstatus.Text = "Administrator";
            }
            else
            {
                infoPanel.LabelAdminstatus.Text = "Faculty Member";
            }

            infoPanel.LabelUsername.Text = Login.name;

            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(10, 10, pictureBox1.Width - 3, pictureBox1.Height - 3);
            Region rg = new Region(gp);

            pictureBox1.Region = rg;
            infoPanel.pictureBox1.ImageLocation = Login.path;

            SmallisizeIcon.Visible = false;
            this.WindowState       = FormWindowState.Maximized;
            AuthorPanel.Controls.Add(infoPanel);
            CreateUserControl(new Welcome());
        }
Exemplo n.º 5
0
 private void Teacher_Load(object sender, EventArgs e)
 {
     System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
     path.AddEllipse(0, 0, 900, 630);
     this.Region = new Region(path);
     this.Show();
 }
Exemplo n.º 6
0
        public BBControl(int X, int Y, int dx, int dy)
        {
            InitializeComponent();
            this.Location = new Point(X, Y);
            Random rannd = new Random();
            this.dx = dx;
            this.dy = dy;
            while (dy == 0)
            {
                this.dy = rannd.Next(-50, 50);
            }
            while (dx == 0)
            {
                this.dx = rannd.Next(-50, 50);
            }
            Color color = Color.FromArgb(rannd.Next(255), rannd.Next(255), rannd.Next(255));
            while (color == Color.White)
            {
                color = Color.FromArgb(rannd.Next(255), rannd.Next(255), rannd.Next(255));
            }
            this.BackColor = color;
            this.Width = 2 * rannd.Next(2, 25);
            this.Height = this.Width;

            System.Drawing.Drawing2D.GraphicsPath Button_Path = new System.Drawing.Drawing2D.GraphicsPath();

            Button_Path.AddEllipse(0, 0, this.Width, this.Height);

            Region Button_Region = new Region(Button_Path);

            this.Region = Button_Region;

            thread = new Thread(DoWork);
            thread.Start();
        }
Exemplo n.º 7
0
        // <Snippet1>
        private void rectangleShape1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            System.Drawing.Drawing2D.GraphicsPath shapePath = new System.Drawing.Drawing2D.GraphicsPath();

            // Set a new rectangle to the same size as the RectangleShape's
            // ClientRectangle property.
            Rectangle newRectangle = rectangleShape1.ClientRectangle;

            // Decrease the size of the rectangle.
            newRectangle.Inflate(-10, -10);

            // Draw the new rectangle's border.
            e.Graphics.DrawEllipse(System.Drawing.Pens.Black, newRectangle);

            // Create a semi-transparent brush.
            SolidBrush br = new SolidBrush(Color.FromArgb(128, 0, 0, 255));

            // Fill the new rectangle.
            e.Graphics.FillEllipse(br, newRectangle);
            //Increase the size of the rectangle to include the border.
            newRectangle.Inflate(1, 1);

            // Create an oval region within the new rectangle.
            shapePath.AddEllipse(newRectangle);
            e.Graphics.DrawPath(Pens.Black, shapePath);

            // Set the RectangleShape's Region property to the newly created
            // oval region.
            rectangleShape1.Region = new System.Drawing.Region(shapePath);
        }
Exemplo n.º 8
0
 protected override void OnPaint(PaintEventArgs pevent)
 {
     System.Drawing.Drawing2D.GraphicsPath grPath = new System.Drawing.Drawing2D.GraphicsPath();
     grPath.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);
     this.Region = new System.Drawing.Region(grPath);
     base.OnPaint(pevent);
 }
Exemplo n.º 9
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //контур для кнопки Поиска
            System.Drawing.Drawing2D.GraphicsPath button6 = new System.Drawing.Drawing2D.GraphicsPath();
            button6.AddEllipse(0, 0, this.button6.Width, this.button6.Height);
            Region Button_Region = new Region(button6);

            this.button6.Region = Button_Region;

            //контур для кнопки сброса поиска
            System.Drawing.Drawing2D.GraphicsPath button7 = new System.Drawing.Drawing2D.GraphicsPath();
            button7.AddEllipse(0, 0, this.button7.Width, this.button7.Height);
            Region Button_Region2 = new Region(button7);

            this.button7.Region = Button_Region2;

            //контур для кнопки открытия
            System.Drawing.Drawing2D.GraphicsPath button1 = new System.Drawing.Drawing2D.GraphicsPath();
            button1.AddEllipse(0, 0, this.button1.Width, this.button1.Height);
            Region Button_Region3 = new Region(button1);

            this.button1.Region = Button_Region3;

            //контур для кнопки сохранения
            System.Drawing.Drawing2D.GraphicsPath button2 = new System.Drawing.Drawing2D.GraphicsPath();
            button2.AddEllipse(0, 0, this.button2.Width, this.button2.Height);
            Region Button_Region4 = new Region(button2);

            this.button2.Region = Button_Region4;
        }
Exemplo n.º 10
0
        public Form_Emp(byte Emp_Code)
        {
            InitializeComponent();
            this.Emp_Code = Emp_Code;
            Employees_Class emp = new Employees_Class();

            ProfilLabel.Text = emp.Profil_Label(Emp_Code);
            switch (Emp_Code)
            {
            case 2: PhotoPictureBox.Image = Курсовой_проект_РЕКЛАМА.Properties.Resources.ИванВасильевич; break;

            case 3: PhotoPictureBox.Image = Курсовой_проект_РЕКЛАМА.Properties.Resources.Че_Гевара; break;

            case 4: PhotoPictureBox.Image = Курсовой_проект_РЕКЛАМА.Properties.Resources.Женщина_афро_волосы; break;

            case 5: PhotoPictureBox.Image = Курсовой_проект_РЕКЛАМА.Properties.Resources.клеопатра; break;
            }

            dgv_Advertisements.Visible = dgv_Air.Visible = dgv_Clients.Visible = dgv_Own_Statistic.Visible
                                                                                     = dgv_Own_Adver.Visible = dgv_Own_Client.Visible = groupBox_V_Reklama.Visible = groupBox_Nothing.Visible = menuStrip1.Visible
                                                                                                                                                                                                    = groupBox_Clients.Visible = groupBox_Own_Stat.Visible = Panel_Buttons.Enabled = false;

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddEllipse(0, 0, 120, 120);
            Region rgn = new Region(path);

            PhotoPictureBox.Region    = rgn;
            PhotoPictureBox.BackColor = System.Drawing.SystemColors.ActiveCaption;

            textBoxClientLastName.MaxLength = textBoxClientName.MaxLength = textBoxClientSurname.MaxLength = 20;
            textBoxReklama.MaxLength        = 25;
            textBoxInterval.MaxLength       = 2;
        }
Exemplo n.º 11
0
        private void Menu_Load(object sender, EventArgs e)
        {
            checarNivel();
            preencherData();
            this.KeyPreview = true;
            //this.KeyDown += new KeyEventHandler(Menu_KeyDown);

            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pictureBox1.Width - 3, pictureBox1.Height - 3);
            Region rg = new Region(gp);

            pictureBox1.Region = rg;

            mostrarNome.Text = Login.nomeMenu;

            if (checkBox1.Checked)
            {
                CadProdutos cad = new CadProdutos();
                cad.FormBorderStyle = FormBorderStyle.None;
                cad.BackColor       = Color.Black;
            }
            else
            {
                CadProdutos cad = new CadProdutos();
                cad.FormBorderStyle = FormBorderStyle.Sizable;
            }
        }
Exemplo n.º 12
0
        // 圆角代码
        public void Round(System.Drawing.Region region)
        {
            // -----------------------------------------------------------------------------------------------
            // 已经是.net提供给我们的最容易的改窗体的属性了(以前要自己调API)
            System.Drawing.Drawing2D.GraphicsPath oPath = new System.Drawing.Drawing2D.GraphicsPath();
            int x          = 0;
            int y          = 0;
            int thisWidth  = this.Width;
            int thisHeight = this.Height;
            int angle      = _Radius;

            if (angle > 0)
            {
                oPath.AddEllipse(x, y, this.Width, this.Height);        // 左下角
                oPath.CloseAllFigures();
                Region = new System.Drawing.Region(oPath);
            }
            // -----------------------------------------------------------------------------------------------
            else
            {
                oPath.AddLine(x + angle, y, thisWidth - angle, y);                   // 顶端
                oPath.AddLine(thisWidth, y + angle, thisWidth, thisHeight - angle);  // 右边
                oPath.AddLine(thisWidth - angle, thisHeight, x + angle, thisHeight); // 底边
                oPath.AddLine(x, y + angle, x, thisHeight - angle);
                oPath.Flatten();                                                     // 左边
                oPath.CloseAllFigures();
                Region = new System.Drawing.Region(oPath);
            }
        }
Exemplo n.º 13
0
        //создание PictureBox-ов
        private void createPictureBoxes(int n)
        {
            if (!is_builded)
            {
                return;
            }
            //пометка вершин конечными
            isfinal = new bool[n];
            used    = new bool[n];
            isfinal[isfinal.Length - 1] = true;

            /*
             *  Если вершина по eps переходу соединена с конечной - она конечна.
             *  Конечной считается последняя
             *  eps Переходы в последнем столбце
             */
            for (int i = 0; i < n; ++i)
            {
                Array.Clear(used, 0, used.Length);
                checkfinal(i);
            }

            //размеры PictureBox-а
            int w = 50;
            int h = 50;

            //добавление скругления PictureBox-а, но не отрисовка самого круга
            System.Drawing.Drawing2D.GraphicsPath roundpb = new System.Drawing.Drawing2D.GraphicsPath();
            roundpb.AddEllipse(0, 0, w, h);
            Region regionpb = new Region(roundpb);

            for (int i = 0; i < n; ++i)
            {
                var cur = new PictureBox();
                cur.Image  = new Bitmap(w, h);
                cur.Width  = w;
                cur.Height = h;
                using (Graphics g = Graphics.FromImage(cur.Image))
                {
                    //отрисовка круга и дополнительного круга, если вершина конечна
                    Pen myBorderPen = new Pen(Color.Black, 1.8f);
                    if (isfinal[i])
                    {
                        g.DrawEllipse(myBorderPen, 4, 4, w - 8, h - 8);
                    }
                    g.DrawEllipse(myBorderPen, 1, 1, w - 2, h - 2);
                    //вписывание названия вершины
                    g.DrawString("S" + i, Font, Brushes.Black, (float)w / 2 - 10, (float)h / 2 - 10);
                }
                //расположение
                cur.Left = 10 + 60 * (i % 5);
                //выводим по пять в ряд
                cur.Top        = 10 + 60 * (i / 5);
                cur.MouseDown += pb_MouseDown;
                cur.Region     = regionpb;

                pbs.Add(cur);
                panel1.Controls.Add(cur);
            }
        }
Exemplo n.º 14
0
Arquivo: Form1.cs Projeto: Hlebes/PW9
        private void Form1_Load(object sender, EventArgs e)
        {
            this.MaximizeBox = false;

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddEllipse(ball.ClientRectangle);
            ball.Region = new Region(path);

            int X          = 10;                                                             // кол-во полей по горизонтали
            int Y          = 4;                                                              // кол-во полей по вертикали
            int blockSizeX = 78;                                                             // устанавливаем размер полей
            int blockSizeY = 25;                                                             // устанавливаем размер полей

            for (int x = 1; x <= X; x++)                                                     // цикл по столбцам
            {
                for (int y = 1; y <= Y; y++)                                                 // цикл по строкам
                {
                    Panel block = new Panel();                                               // создаём новое поле
                    block.Width       = blockSizeX;                                          // устанавливаем ширину
                    block.Height      = blockSizeY;                                          // устанавливаем высоту
                    block.Location    = new Point(x * blockSizeX - 50, y * blockSizeY + 20); // перемещаем поле на нужное место
                    block.BorderStyle = BorderStyle.FixedSingle;                             // устанавливаем стиль границы обрамления
                    this.Controls.Add(block);                                                // добавление поля в коллекцию элементов управления
                }
            }
        }
Exemplo n.º 15
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try {
                var             profileUrl = $"{InstagramURL}/{txtUsername.Text}/";
                HttpWebRequest  request    = (HttpWebRequest)WebRequest.Create(profileUrl);
                HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                using (StreamReader sr = new StreamReader(response.GetResponseStream())) {
                    richTextBox1.Text = sr.ReadToEnd();
                }

                var username = RegexCheck("\"full_name\":\"(.*?)\",");
                ParseDetails(out string followers, out string following, out string postCount, out string lastPostDateFormatted);

                // Show fields on form
                textBox1.Text = username;
                textBox2.Text = followers;
                textBox3.Text = following;
                textBox4.Text = postCount;
                textBox5.Text = lastPostDateFormatted;

                // Show profile picture
                var profilePictureURL = RegexCheck("\"profile_pic_url\":\"(.*?)\"");
                pictureBox1.Load(profilePictureURL);

                // Make picture round
                System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
                path.AddEllipse(0, 0, pictureBox1.Height, pictureBox1.Height);
                pictureBox1.Region = new Region(path);
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 16
0
        private void TheWell_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            CheckForIllegalCrossThreadCalls = false;
            Rectangle r = new Rectangle(0, 0, panel1.Width, panel1.Height);

            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            int d = 50;

            gp.AddEllipse(new Rectangle(0, 2, 370, 370));
            panel1.Region = new Region(gp);


            Rectangle r2 = new Rectangle(0, 0, panel3.Width, panel3.Height);

            System.Drawing.Drawing2D.GraphicsPath gp2 = new System.Drawing.Drawing2D.GraphicsPath();
            gp2.AddEllipse(new Rectangle(0, 2, 370, 370));
            panel3.Region = new Region(gp2);


            Rectangle r3 = new Rectangle(0, 0, pictureBox9.Width, pictureBox9.Height);

            System.Drawing.Drawing2D.GraphicsPath gp3 = new System.Drawing.Drawing2D.GraphicsPath();
            gp3.AddEllipse(new Rectangle(0, 0, 370, 370));
            pictureBox9.Region = new Region(gp3);

            timer1          = new System.Windows.Forms.Timer();
            timer1.Tick    += new EventHandler(timer1_Tick);
            timer1.Interval = 1000; // 1 second
            timer1.Start();
            timee.Text = counter.ToString();
        }
Exemplo n.º 17
0
        static public void ElipseToPath(System.Drawing.Drawing2D.GraphicsPath gp, FloatPoint xp, double rad_max, double velo)
        {
            FloatPoint pnew = Centered(xp, rad_max, velo);
            FloatPoint hp   = GetPressureRadius(rad_max, velo);

            gp.AddEllipse(xp.X - hp.X, xp.Y - hp.Y, hp.X, hp.Y);
        }
Exemplo n.º 18
0
 public phoneButton()
 {
     InitializeComponent();
     System.Drawing.Drawing2D.GraphicsPath gPath = new System.Drawing.Drawing2D.GraphicsPath();
     gPath.AddEllipse(0, 0, this.Width, this.Height);
     this.Region = new Region(gPath);
 }
Exemplo n.º 19
0
 protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
 {
     base.OnPaint(e);
     System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
     path.AddEllipse(0, 0, this.Width, this.Height);
     this.Region = new Region(path);
 }
Exemplo n.º 20
0
        static public void ElipseToPath(System.Drawing.Drawing2D.GraphicsPath gp, FloatPoint xp, double radius)
        {
            FloatPoint rp = new FloatPoint(radius), hp = rp * 0.5f, dp = rp * 2.0f;
            FloatPoint p = xp - rp;

            gp.AddEllipse(p.X, p.Y, dp.X, dp.Y);
        }
Exemplo n.º 21
0
 //Chnage Facing Direction CFD
 private void btnCFD_Paint(object sender, PaintEventArgs e)
 {
     System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new System.Drawing.Drawing2D.GraphicsPath();
        myGraphicsPath.AddEllipse(new Rectangle(0, 0, 100, 100));
        btnCFD.Size = new System.Drawing.Size(100, 100);
        btnCFD.Region = new Region(myGraphicsPath);
 }
Exemplo n.º 22
0
        private void CardForm_Load(object sender, EventArgs e)
        {
            System.Drawing.Drawing2D.GraphicsPath gp  = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Drawing2D.GraphicsPath gp2 = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, dernekLogo1.Width - 1, dernekLogo1.Height - 2);
            gp2.AddEllipse(0, 0, dernekLogo2.Width - 1, dernekLogo2.Height - 2);
            Region rg  = new Region(gp);
            Region rg2 = new Region(gp2);

            dernekLogo1.Region = rg;
            dernekLogo2.Region = rg2;

            nameLbl.Text            = MemberDetails.ad.ToUpper();
            surnameLbl.Text         = MemberDetails.soyad.ToUpper();
            branchLbl.Text          = MemberDetails.brans.ToUpper();
            titleLbl.Text           = "SPORCU";
            memberPic.ImageLocation = MemberDetails.foto;
            connection.Open();
            SqlCommand    sqlCommand    = new SqlCommand("select [Kulup Adi] from businessOwner where Id = 1", connection);
            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            sqlDataReader.Read();
            bNameLbl.Text = sqlDataReader["Kulup Adi"].ToString();
            connection.Close();
        }
Exemplo n.º 23
0
        public Form1()
        {
            InitializeComponent();
            saveLogs("InitializeComponent");
            cookies = ReadCookiesFromDisk("cookies.dat");

            if ((!check()) && (Properties.Settings.Default.email != "") && (Properties.Settings.Default.password != ""))
            {
                if (!auth())
                    resultLabel.Text = "Error authentication";
            }

            Microsoft.Win32.RegistryKey readKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\ETS2MP");
            if (readKey != null)
            {
                regInstallLocation  = (string)readKey.GetValue("InstallLocation");
                regInstallDir       = (string)readKey.GetValue("InstallDir");
            }
            else
            {
                saveLogs("Game not found!");
            }

            System.Drawing.Drawing2D.GraphicsPath Button_Path = new System.Drawing.Drawing2D.GraphicsPath();
            Button_Path.AddEllipse(0, 0, btnPlay.Width, btnPlay.Height);
            System.Drawing.Region Button_Region = new System.Drawing.Region(Button_Path);
            this.btnPlay.Region = Button_Region;
        }
Exemplo n.º 24
0
        public frmLogin()
        {
            InitializeComponent();

            foreach (Button btn in this.Controls.OfType<Button>())
            {//this will controll all button inside form
                btn.FlatStyle = FlatStyle.Standard;
                btn.ForeColor = Color.Black;
                btn.BackColor = Color.White;
                
            }
            foreach (TextBox txtbox in this.Controls.OfType<TextBox>())
            {//this will controll all textbox inside form
                txtbox.BorderStyle = BorderStyle.None;
                
            }

            //background
            this.BackgroundImage = Properties.Resources.bg;
            this.BackgroundImageLayout = ImageLayout.Stretch;
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pictureBox1.Width - 3, pictureBox1.Height - 3);
            Region rg = new Region(gp);
            pictureBox1.Region = rg;
        }
Exemplo n.º 25
0
 protected override void OnPaint(PaintEventArgs pevent)
 {
     this.Size = new Size(50, 50);
     System.Drawing.Drawing2D.GraphicsPath aCircle = new System.Drawing.Drawing2D.GraphicsPath();
     aCircle.AddEllipse(new System.Drawing.RectangleF(0, 0, 50, 50));
     this.Region = new Region(aCircle);
     base.OnPaint(pevent); 
 }
Exemplo n.º 26
0
 private void frmLogginpass_Load(object sender, EventArgs e)
 {
     lblUsuario.Text = nombreUser;
     System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
     gp.AddEllipse(0, 0, pbImgPerfil.Width - 3, pbImgPerfil.Height - 3);
     Region rg = new Region(gp);
     pbImgPerfil.Region = rg;
 }
Exemplo n.º 27
0
        public void CircleThis(PictureBox pic)  //bumba
        {
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pic.Width, pic.Height);
            Region rg = new Region(gp);

            pic.Region = rg;
        }
Exemplo n.º 28
0
 private void btnDrop_Paint(object sender, PaintEventArgs e)
 {
     System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new
                                                            System.Drawing.Drawing2D.GraphicsPath();
     myGraphicsPath.AddEllipse(new Rectangle(0, 0, 100, 100));
     btnDrop.Size   = new System.Drawing.Size(100, 100);
     btnDrop.Region = new Region(myGraphicsPath);
 }
Exemplo n.º 29
0
        public void Picture_Rond(PictureBox p)
        {
            System.Drawing.Drawing2D.GraphicsPath gd = new System.Drawing.Drawing2D.GraphicsPath();
            gd.AddEllipse(0, 0, p.Width - 3, p.Height - 3);
            Region rg = new Region(gd);

            p.Region = rg;
        }
Exemplo n.º 30
0
        private void Form1_Load(object sender, EventArgs e)
        {
            System.Drawing.Drawing2D.GraphicsPath myPath = new System.Drawing.Drawing2D.GraphicsPath();
            myPath.AddEllipse(0, 0, this.Width, this.Height);
            Region myRegion = new Region(myPath);

            this.Region = myRegion;
        }
Exemplo n.º 31
0
        private void roundImage()
        {
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, this.Width, this.Height);
            Region rg = new Region(gp);

            this.Region = rg;
        }
Exemplo n.º 32
0
        public void CircleThis(PictureBox pic)  //Just a function to redraw the ball into a circle.
        {
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pic.Width - 3, pic.Height - 3);
            Region rg = new Region(gp);

            pic.Region = rg;
        }
        /// <summary>
        /// Make picture box edges round
        /// </summary>
        /// <param name="picBox"></param>
        public static void RoundPictureBox(PictureBox picBox)
        {
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, picBox.Width - 3, picBox.Height - 3);
            Region rg = new Region(gp);

            picBox.Region = rg;
        }
Exemplo n.º 34
0
        public void crearCirculoIMG()
        {
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pbFotoPerfil.Width, pbFotoPerfil.Height);
            Region rg = new Region(gp);

            pbFotoPerfil.Region = rg;
        }
Exemplo n.º 35
0
        private void makeRoundPictureBox(PictureBox i_PictureBox, int i_WidthRound, int i_HeightRound)
        {
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, i_PictureBox.Width - i_WidthRound, i_PictureBox.Height - i_HeightRound);
            Region rg = new Region(gp);

            i_PictureBox.Region = rg;
        }
Exemplo n.º 36
0
        public void ArredondaFoto()
        {
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pictureBox1.Width - 2, pictureBox1.Height - 2);
            Region rg = new Region(gp);

            pictureBox1.Region = rg;
        }
Exemplo n.º 37
0
 private void frmLogin_Load(object sender, EventArgs e)
 {
     //Creating circle path
     FillRoleCombo();
     System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
     path.AddEllipse(0, 0, 400, 400);
     this.Region = new Region(path);
    
    
 }
Exemplo n.º 38
0
        public BBControl(int X, int Y, int dx, int dy, int width, int height)
        {
            InitializeComponent();
            this.Location = new Point(X, Y);
            this.dx = dx;
            this.dy = dy;
            this.BackColor = Color.Black;
            this.Width = width;
            this.Height = height;

            System.Drawing.Drawing2D.GraphicsPath Button_Path = new System.Drawing.Drawing2D.GraphicsPath();

            Button_Path.AddEllipse(0, 0, this.Width, this.Height);

            Region Button_Region = new Region(Button_Path);

            this.Region = Button_Region;
        }
Exemplo n.º 39
0
        private void modifyFormDesign() {

            foreach (Button btn in this.Controls.OfType<Button>())
            {//this will controll all button inside form
                btn.FlatStyle = FlatStyle.Standard;
                btn.ForeColor = Color.Black;
                btn.BackColor = Color.White;
                btn.Cursor = Cursors.Hand;
            }
            foreach (TextBox txtbox in this.Controls.OfType<TextBox>())
            {//this will controll all textbox inside form
                txtbox.BorderStyle = BorderStyle.None;

            }

            //background
            this.BackgroundImage = Properties.Resources.bg;
            this.BackgroundImageLayout = ImageLayout.Stretch;
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pictureBox1.Width, pictureBox1.Height);
            
            Region rg = new Region(gp);
            //pictureBox1.Region = rg;
        }
Exemplo n.º 40
0
        protected override void PaintControlBackground(ItemPaintArgs pa)
        {
            bool resetClip = false;
            eDotNetBarStyle effectiveStyle = this.EffectiveStyle;

            bool isGlassEnabled = this.IsGlassEnabled;
            if (isGlassEnabled)
            {
                RibbonForm f = this.FindForm() as RibbonForm;
                if (f != null)
                {
                    pa.Graphics.SetClip(new Rectangle(0, 0, this.Width, f.GlassHeight - ((effectiveStyle == eDotNetBarStyle.Office2010 || effectiveStyle == eDotNetBarStyle.Metro) && pa.GlassEnabled ? Office2010GlassExcludeTopPart : 1)),
                        System.Drawing.Drawing2D.CombineMode.Exclude);
                    resetClip = true;
                }
            }

            if (isGlassEnabled && (effectiveStyle == eDotNetBarStyle.Office2010 || effectiveStyle == eDotNetBarStyle.Metro))
            {
                ElementStyle style = GetBackgroundStyle();
                if (style != null)
                {
                    Rectangle r = new Rectangle(0, Office2010GlassExcludeTopPart - 2, this.Width, this.Height + 8);
                    using (System.Drawing.Drawing2D.GraphicsPath fillPath = new System.Drawing.Drawing2D.GraphicsPath())
                    {
                        //if (StyleManager.Style == eStyle.Office2010Black)
                        //{
                        //    fillPath.AddRectangle(r);
                        //    using (System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(r, style.BackColor2, style.BackColor, 90))
                        //        pa.Graphics.FillPath(brush, fillPath);
                        //}
                        //else
                        {
                            fillPath.AddEllipse(r);
                            using (System.Drawing.Drawing2D.PathGradientBrush brush = new System.Drawing.Drawing2D.PathGradientBrush(fillPath))
                            {
                                brush.CenterColor = style.BackColor;
                                brush.SurroundColors = new Color[] { style.BackColor2 };
                                brush.CenterPoint = new PointF(r.Width / 2, r.Bottom - Office2010GlassExcludeTopPart / 2);
                                System.Drawing.Drawing2D.Blend blend = new System.Drawing.Drawing2D.Blend();
                                blend.Factors = new float[] { 0f, .85f, 1f, };
                                blend.Positions = new float[] { 0f, .65f, 1f };
                                brush.Blend = blend;
                                pa.Graphics.FillPath(brush, fillPath);
                            }
                        }
                    }
                }
            }
            else
                base.PaintControlBackground(pa);

            if (resetClip) pa.Graphics.ResetClip();

            m_QuickToolbarBounds = Rectangle.Empty;
            m_CaptionBounds = Rectangle.Empty;
            m_SystemCaptionItemBounds = Rectangle.Empty;

            Rendering.BaseRenderer renderer = GetRenderer();
            if (renderer != null && this.Parent is RibbonControl)
            {
                RibbonControlRendererEventArgs rargs = new RibbonControlRendererEventArgs(pa.Graphics, this.Parent as RibbonControl, pa.GlassEnabled);
                rargs.ItemPaintArgs = pa;
                renderer.DrawRibbonControlBackground(rargs);

                if (m_CaptionVisible)
                    renderer.DrawQuickAccessToolbarBackground(new RibbonControlRendererEventArgs(pa.Graphics, this.Parent as RibbonControl, pa.GlassEnabled));
            }

            if (m_TabGroupsVisible)
            {
                PaintTabGroups(pa);
            }

            // Paint form caption text
            if (renderer != null && m_CaptionVisible)
            {
                RibbonControlRendererEventArgs rer = new RibbonControlRendererEventArgs(pa.Graphics, this.Parent as RibbonControl, pa.GlassEnabled);
                rer.ItemPaintArgs = pa;
                renderer.DrawRibbonFormCaptionText(rer);
            }

#if TRIAL
            if (NativeFunctions.ColorExpAlt())
				{
					pa.Graphics.Clear(Color.White);
					TextDrawing.DrawString(pa.Graphics, "Trial Version Expired :-(", this.Font, Color.FromArgb(128, Color.Black), this.ClientRectangle, eTextFormat.HorizontalCenter | eTextFormat.VerticalCenter);
				}
                //else
                //{
                //    TextDrawing.DrawString(pa.Graphics, "Trial Version", this.Font, Color.FromArgb(128, Color.Black), new Rectangle(0, 0, this.Width - 12, this.Height-4), eTextFormat.Right | eTextFormat.Bottom);
                //}
#endif
        }
Exemplo n.º 41
0
        /// <summary>
        /// Repaints the form with cool background and stuff
        /// </summary>
        /// <param name="graph">The graphics object to paint to, the element will be drawn to 0,0</param>
        public virtual void Paint(Graphics graph)
        {
            //Sets up the colors to use
            Pen outlinePen = new Pen(MapWindow.Main.Global.ColorFromHSL(Color.GetHue(), Color.GetSaturation(), Color.GetBrightness() * 0.6 * Highlight), 1.75F);
            Color gradientTop = MapWindow.Main.Global.ColorFromHSL(Color.GetHue(), Color.GetSaturation(), Color.GetBrightness() * 0.7 * Highlight);
            Color gradientBottom = MapWindow.Main.Global.ColorFromHSL(Color.GetHue(), Color.GetSaturation(), Color.GetBrightness() * 1.0 * Highlight);

            //The path used for drop shadows
            System.Drawing.Drawing2D.GraphicsPath shadowPath = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Drawing2D.ColorBlend colorBlend = new System.Drawing.Drawing2D.ColorBlend(3);
            colorBlend.Colors = new Color[] { Color.Transparent, Color.FromArgb(180, Color.DarkGray), Color.FromArgb(180, Color.DimGray) };
            colorBlend.Positions = new float[] { 0f, 0.125f,1f};

            //Draws Rectangular Shapes
            if (Shape == ModelShapes.Rectangle)
            {
                //Draws the shadow
                shadowPath.AddPath(GetRoundedRect(new Rectangle(5, 5, this.Width, this.Height), 10), true);
                System.Drawing.Drawing2D.PathGradientBrush shadowBrush = new System.Drawing.Drawing2D.PathGradientBrush(shadowPath);
                shadowBrush.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp;
                shadowBrush.InterpolationColors = colorBlend;
                graph.FillPath(shadowBrush, shadowPath);

                //Draws the basic shape
                System.Drawing.Rectangle fillRectange = new Rectangle(0, 0, this.Width - 5, this.Height - 5);
                System.Drawing.Drawing2D.GraphicsPath fillArea = GetRoundedRect(fillRectange, 5);
                System.Drawing.Drawing2D.LinearGradientBrush myBrush = new System.Drawing.Drawing2D.LinearGradientBrush(fillRectange, gradientBottom, gradientTop, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
                graph.FillPath(myBrush, fillArea);
                graph.DrawPath(outlinePen, fillArea);
                
                //Draws the status light
                drawStatusLight(graph);
                
                //Draws the text
                SizeF textSize = graph.MeasureString(Name, Font, this.Width);
                RectangleF textRect;
                if ((textSize.Width < this.Width) || (textSize.Height < this.Height))
                    textRect = new RectangleF((this.Width - textSize.Width) / 2, (this.Height - textSize.Height) / 2, textSize.Width, textSize.Height);
                else
                    textRect = new RectangleF(0, (this.Height - textSize.Height) / 2, this.Width, textSize.Height);
                graph.DrawString(Name, Font, new SolidBrush(Color.FromArgb(50, Color.Black)), textRect);
                textRect.X = textRect.X - 1;
                textRect.Y = textRect.Y - 1;
                graph.DrawString(Name, Font, System.Drawing.Brushes.Black, textRect);

                //Garbage collection
                fillArea.Dispose();
                myBrush.Dispose();
            }

            //Draws Ellipse Shapes
            if (_shape == ModelShapes.Ellipse)
            {
                //Draws the shadow
                shadowPath.AddEllipse(0, 5, this.Width+5, this.Height);
                System.Drawing.Drawing2D.PathGradientBrush shadowBrush = new System.Drawing.Drawing2D.PathGradientBrush(shadowPath);
                shadowBrush.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp;
                shadowBrush.InterpolationColors = colorBlend;
                graph.FillPath(shadowBrush, shadowPath);

                //Draws the Ellipse
                System.Drawing.Rectangle fillArea = new Rectangle(0, 0, this.Width, this.Height);
                System.Drawing.Drawing2D.LinearGradientBrush myBrush = new System.Drawing.Drawing2D.LinearGradientBrush(fillArea, gradientBottom, gradientTop, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
                graph.FillEllipse(myBrush, 1, 1, this.Width - 5, this.Height - 5);
                graph.DrawEllipse(outlinePen, 1, 1, this.Width - 5, this.Height - 5);

                //Draws the text
                SizeF textSize = graph.MeasureString(_name, _font, this.Width);
                RectangleF textRect;
                if ((textSize.Width < this.Width) || (textSize.Height < this.Height))
                    textRect = new RectangleF((this.Width - textSize.Width) / 2, (this.Height - textSize.Height) / 2, textSize.Width, textSize.Height);
                else
                    textRect = new RectangleF(0, (this.Height - textSize.Height) / 2, this.Width, textSize.Height);
                graph.DrawString(Name, Font, new SolidBrush(Color.FromArgb(50, Color.Black)), textRect);
                textRect.X = textRect.X - 1;
                textRect.Y = textRect.Y - 1;
                graph.DrawString(Name, Font, System.Drawing.Brushes.Black, textRect);

                //Garbage collection
                myBrush.Dispose();
            }

            //Draws Triangular Shapes
            if (_shape == ModelShapes.Triangle)
            {
                //Draws the shadow
                Point[] ptShadow = new Point[4];
                ptShadow[0] = new Point(5, 5);
                ptShadow[1] = new Point(this.Width + 5, ((this.Height - 5) / 2) + 5);
                ptShadow[2] = new Point(5, this.Height+2);
                ptShadow[3] = new Point(5, 5);
                shadowPath.AddLines(ptShadow);
                System.Drawing.Drawing2D.PathGradientBrush shadowBrush = new System.Drawing.Drawing2D.PathGradientBrush(shadowPath);
                shadowBrush.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp;
                shadowBrush.InterpolationColors = colorBlend;
                graph.FillPath(shadowBrush, shadowPath);

                //Draws the shape
                Point[] pt = new Point[4];
                pt[0] = new Point(0, 0);
                pt[1] = new Point(this.Width - 5, (this.Height-5) / 2);
                pt[2] = new Point(0, this.Height-5);
                pt[3] = new Point(0, 0);
                System.Drawing.Drawing2D.GraphicsPath myPath = new System.Drawing.Drawing2D.GraphicsPath();
                myPath.AddLines(pt);
                System.Drawing.Rectangle fillArea = new Rectangle(1, 1, this.Width - 5, this.Height - 5);
                System.Drawing.Drawing2D.LinearGradientBrush myBrush = new System.Drawing.Drawing2D.LinearGradientBrush(fillArea, gradientBottom, gradientTop, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
                graph.FillPath(myBrush, myPath);
                graph.DrawPath(outlinePen, myPath);

                //Draws the text
                SizeF textSize = graph.MeasureString(Name, Font, this.Width);
                RectangleF textRect;
                if ((textSize.Width < this.Width) || (textSize.Height < this.Height))
                    textRect = new RectangleF((this.Width - textSize.Width) / 2, (this.Height - textSize.Height) / 2, textSize.Width, textSize.Height);
                else
                    textRect = new RectangleF(0, (this.Height - textSize.Height) / 2, this.Width, textSize.Height);
                graph.DrawString(Name, Font, System.Drawing.Brushes.Black, textRect);

                //Garbage collection
                myBrush.Dispose();
            }
            
            //Garbage collection
            shadowPath.Dispose();
            outlinePen.Dispose();
        }
Exemplo n.º 42
0
        //マップを作成する関数 (深さ優先探索)
        private void d_maze_create(int data, int x, int y)
        {
            Button bt = new Button();
            bt.Size = new Size(40, 40);
            bt.Location = new Point(10 + 10 * x + 40 * x, 10 + 10 * y + 40 * y);
            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddEllipse(new Rectangle(5, 5, 30, 30));
            bt.Region = new Region(path);
            Bitmap canvas = new Bitmap(bt.Width, bt.Height);
            Pen p = new Pen(Color.Black, 5);
            Graphics g = Graphics.FromImage(canvas);
            g.DrawEllipse(p, 5, 5, 30, 30);
            g.Dispose();
            bt.Image = canvas;
            pb2.Controls.Add(bt);

            if(data == 0)
                bt.BackColor = Color.White;
            if(data == 1)
                bt.BackColor = Color.Black;
            if(data == 2)
                bt.BackColor = Color.Blue;
            if (data == 3)
                bt.BackColor = Color.Green;
        }
Exemplo n.º 43
0
 //Rename Button
 private void btnRename_Paint(object sender, PaintEventArgs e)
 {
     //Instantiate a new instance of the GraphicsPath class.
     System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new
     System.Drawing.Drawing2D.GraphicsPath();
     myGraphicsPath.AddEllipse(new Rectangle(0, 0, 100, 100));
     //Set the control's Region property to the instance
     //of the GraphicsPath class you created above.
     btnRename.Size = new System.Drawing.Size(100, 100);
     btnRename.Region = new Region(myGraphicsPath);
 }
Exemplo n.º 44
0
 protected override void GeneratePath()
 {
     _Path = new System.Drawing.Drawing2D.GraphicsPath();
     _Path.AddEllipse(new Rectangle(this.Location, this.Size));
 }
Exemplo n.º 45
0
            // コンストラクタ
            public Node(string value)
            {
                //値の設定
                this.Value = value;

                //コントロール(ノード)の設定
                this.button = new System.Windows.Forms.Button();
                this.button.Size = new Size(70, 70);
                System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
                path.AddEllipse(new Rectangle(10, 10, radius, radius));
                this.button.Region = new Region(path);
                this.button.BackColor = Color.White;
                this.button.Text = value;
                this.button.Font = new Font("Arial", 15, FontStyle.Bold);
                //円の描写
                Bitmap canvas = new Bitmap(this.button.Width, this.button.Height);
                Pen p = new Pen(Color.Black, 5);
                Graphics g = Graphics.FromImage(canvas);
                g.DrawEllipse(p, 10, 10, 50, 50);
                g.Dispose();
                this.button.Image = canvas;
            }
Exemplo n.º 46
0
        /// <summary>
        /// Toma una imagen (el slide completo) y recorta un area circular delimitada por el elemento CCuadrado
        /// </summary>
        /// <param name="srcImage">Imagen original de la que se extraera el corte circular</param>
        /// <param name="elemento">Area de corte</param>
        /// <returns>Imagen recortada</returns>
        public static Bitmap CropCirle(Bitmap srcImage, CCuadrado elemento)
        {
            // primero se extrae el area rectangular del slide que se pasa como argumento
            Bitmap bmp = new Bitmap(elemento.width * 2, elemento.width * 2);
            Graphics g = Graphics.FromImage(bmp);
            Rectangle selectedArea = new Rectangle();
            selectedArea.X = elemento.x - elemento.width;
            selectedArea.Y = elemento.y - elemento.width;
            selectedArea.Width = selectedArea.Height = elemento.width * 2;
            g.DrawImage(srcImage, 0, 0, selectedArea, GraphicsUnit.Pixel);

            // la imagen bmp contiene el recorte rectangular
            // ahora se debe volver un circulo

            Bitmap dstImage = new Bitmap(bmp.Width, bmp.Height, bmp.PixelFormat);
            g = Graphics.FromImage(dstImage);
            using (Brush br = new SolidBrush(Color.Black))
            {
                g.FillRectangle(br, 0, 0, dstImage.Width, dstImage.Height);
            }
            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddEllipse(0, 0, dstImage.Width, dstImage.Height);
            g.SetClip(path);
            g.DrawImage(bmp, 0, 0);

            return dstImage;
        }
Exemplo n.º 47
0
 protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
 {
     System.Drawing.Drawing2D.GraphicsPath shape = new System.Drawing.Drawing2D.GraphicsPath();
     shape.AddEllipse(0, 0, this.Width, this.Height);
     this.Region = new System.Drawing.Region(shape);
 }
Exemplo n.º 48
0
        /// <summary>
        /// aktualisiert das Feld nodeGraphics
        /// </summary>
        private void UpdateNodeGraphics()
        {
            if ((position != null) && (inSlope != null) && (outSlope != null))
                {
                // Linien zu den Stützpunkten
                _nodeGraphics[0] = new System.Drawing.Drawing2D.GraphicsPath(new PointF[] { inSlopeAbs, position }, new byte[] { 1, 1 });
                _nodeGraphics[1] = new System.Drawing.Drawing2D.GraphicsPath(new PointF[] { outSlopeAbs, position }, new byte[] { 1, 1 });

                // Stützpunkte
                System.Drawing.Drawing2D.GraphicsPath inPoint = new System.Drawing.Drawing2D.GraphicsPath();
                inPoint.AddEllipse(inSlopeRect);
                _nodeGraphics[2] = inPoint;

                System.Drawing.Drawing2D.GraphicsPath outPoint = new System.Drawing.Drawing2D.GraphicsPath();
                // wir versuchen ein Dreieck zu zeichnen *lol*
                Vector2 dir = outSlope.Normalized;
                outPoint.AddPolygon(
                    new PointF[] {
                        (6*dir) + outSlopeAbs,
                        (6*dir.RotateCounterClockwise(Math.PI * 2 / 3)) + outSlopeAbs,
                        (6*dir.RotateCounterClockwise(Math.PI * 4 / 3)) + outSlopeAbs,
                        (6*dir) + outSlopeAbs
                    });
                _nodeGraphics[3] = outPoint;
                }
        }
        static System.Drawing.Drawing2D.GraphicsPath ResolveGraphicsPath(GraphicsPath path)
        {
            //convert from graphics path to internal presentation
            System.Drawing.Drawing2D.GraphicsPath innerPath = path.InnerPath as System.Drawing.Drawing2D.GraphicsPath;
            if (innerPath != null)
            {
                return innerPath;
            }
            //--------
            innerPath = new System.Drawing.Drawing2D.GraphicsPath();
            path.InnerPath = innerPath;
            List<float> points;
            List<PathCommand> cmds;
            GraphicsPath.GetPathData(path, out points, out cmds);
            int j = cmds.Count;
            int p_index = 0;
            for (int i = 0; i < j; ++i)
            {
                PathCommand cmd = cmds[i];
                switch (cmd)
                {
                    default:
                        throw new NotSupportedException();
                    case PathCommand.Arc:
                        innerPath.AddArc(
                            points[p_index],
                            points[p_index + 1],
                            points[p_index + 2],
                            points[p_index + 3],
                            points[p_index + 4],
                            points[p_index + 5]);
                        p_index += 6;
                        break;
                    case PathCommand.Bezier:
                        innerPath.AddBezier(
                            points[p_index],
                            points[p_index + 1],
                            points[p_index + 2],
                            points[p_index + 3],
                            points[p_index + 4],
                            points[p_index + 5],
                            points[p_index + 6],
                            points[p_index + 7]);
                        p_index += 8;
                        break;
                    case PathCommand.CloseFigure:
                        innerPath.CloseFigure();
                        break;
                    case PathCommand.Ellipse:
                        innerPath.AddEllipse(
                            points[p_index],
                            points[p_index + 1],
                            points[p_index + 2],
                            points[p_index + 3]);
                        p_index += 4;
                        break;
                    case PathCommand.Line:
                        innerPath.AddLine(
                            points[p_index],
                            points[p_index + 1],
                            points[p_index + 2],
                            points[p_index + 3]);
                        p_index += 4;
                        break;
                    case PathCommand.Rect:
                        innerPath.AddRectangle(
                           new System.Drawing.RectangleF(
                          points[p_index],
                          points[p_index + 1],
                          points[p_index + 2],
                          points[p_index + 3]));
                        p_index += 4;
                        break;
                    case PathCommand.StartFigure:
                        break;
                }
            }


            return innerPath;
        }
Exemplo n.º 50
0
        public void roundOver(float playerCoordinateX, float playerCoordinateY, float radius, Graphics g, Rectangle ClientRectangle)
        {
            var circle = new System.Drawing.Drawing2D.GraphicsPath();
            circle.AddEllipse(playerCoordinateX, playerCoordinateY, radius, radius);

            g.SetClip(circle, System.Drawing.Drawing2D.CombineMode.Exclude);

            Brush brush = new SolidBrush(Color.FromArgb(30, Color.Black));
            g.FillRectangle(brush, 0, 0, currentView.backgroundImg.Width, currentView.backgroundImg.Height);

            // Image gameover = Resourses.gameover;
            //  g.DrawImage(gameover, ClientRectangle, this.currentScene.backgroundImg.Width / 2, this.currentScene.backgroundImg.Height/ 2,gameover.Width,gameover.Height);
        }
Exemplo n.º 51
0
        private void pictureBox_Paint(object sender, PaintEventArgs e)
        {
            Font font = new Font("Arial", 9.0f);

            PictureBox p = (PictureBox)sender;

            Rectangle r = new Rectangle(0, 0, p.Width, p.Height);
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(r.X, r.Y, 15, 15);

            p.Region = new Region(gp);
            p.BackColor = clienteEnvia.getCorTelepointer();
            // pictureBox1.BackColor = Color.Blue;

            e.Graphics.DrawString(p.Name, font, new SolidBrush(Color.Black), new PointF(2, 0));
        }
Exemplo n.º 52
0
        private void telefinger_Paint(object sender, PaintEventArgs e)
        {
            // TODO: Pensar em colocar Panels modificados no lugar de PictureBoxes
            // para poder utilizar a transparência
            PictureBox p = (PictureBox)sender;
            Color c;

            c = p.BackColor;

            // p.BackColor = System.Drawing.Color.Transparent;

            Point pp = new Point(p.Width / 2, p.Height / 2);
            Font font = new Font("Arial", 9.0f);

            Rectangle r = new Rectangle(0, 0, p.Width, p.Height);
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(r.X, r.Y, 15, 15);

            p.Region = new Region(gp);
            // pictureBox1.BackColor = Color.Blue;

            e.Graphics.DrawString(p.Name, font, new SolidBrush(Color.Black), new PointF(2, 0));
        }