NEWS

[C#] Hướng dẫn tạo conner circle image trong PictureBox

[C#] Hướng dẫn tạo conner circle image trong PictureBox
Đăng bởi: Thảo Meo - Lượt xem: 9611 15:27:13, 27/07/2018C#   In bài viết

Bài viết hôm nay, mình sẽ tiếp tục hướng dẫn cho các bạn cách tạo conner circle image trong picturebox C#.

Nếu các bạn viết ứng dụng có hình ảnh nhân viên và các bạn muốn có khung hình tròn bao quanh hình thì mình sẽ làm thế nào, các bạn  có thể xem demo ở hình bên dưới.

Demo Tạo Conner Circle Image PictureBox C#:

conner circle image c#

Source code Conner Circle Image C#:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Conner_PictureBox
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            pictureBox1.LoadAsync("http://i569.photobucket.com/albums/ss134/hongchautkn/PHUONGTHAO.jpg");

            Rectangle r = new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height);
            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;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            pictureBox2.LoadAsync("http://i569.photobucket.com/albums/ss134/hongchautkn/PHUONGTHAO.jpg");
        }
    }
}

HAPPY CODING heart

THÔNG TIN TÁC GIẢ

BÀI VIẾT LIÊN QUAN

[C#] Hướng dẫn tạo conner circle image trong PictureBox
Đăng bởi: Thảo Meo - Lượt xem: 9611 15:27:13, 27/07/2018C#   In bài viết

CÁC BÀI CÙNG CHỦ ĐỀ

Đọc tiếp
.