Hiện nay, trên windows 11, chúng ta có Copilot bản preview, khi các bạn chạy ứng dụng, thấy app nào luôn neo ở góc bên phải, và chiếm luôn không gian đó của màn hình.
Trên C#, các bạn thực hiện đơn giản theo các bước sau:
Đầu tiên, các bạn cài thư viện tip2tail.WinFormAppBarLib từ Nuget:
NuGet\Install-Package tip2tail.WinFormAppBarLib -Version 1.2.1
VIDEO HƯỚNG DẪN:
Full source code 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;
using tip2tail.WinFormAppBarLib;
namespace AppBarDesktop
{
public partial class Form1 : Form
{
public Form1()
{
// AppBarHelper.PreventShowDesktop(this.Handle);
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
AppBarHelper.AppBarMessage = "HUNG.PRO.VN";
AppBarHelper.SetAppBar(this, AppBarEdge.None);
}
private void button2_Click(object sender, EventArgs e)
{
AppBarHelper.SetAppBar(this, AppBarEdge.None);
}
private void button5_Click(object sender, EventArgs e)
{
AppBarHelper.SetAppBar(this, AppBarEdge.Left);
}
private void button3_Click(object sender, EventArgs e)
{
AppBarHelper.SetAppBar(this, AppBarEdge.Right);
}
private void button4_Click(object sender, EventArgs e)
{
AppBarHelper.SetAppBar(this, AppBarEdge.Bottom);
}
private void button1_Click(object sender, EventArgs e)
{
AppBarHelper.SetAppBar(this, AppBarEdge.Top);
}
}
}
Chúc cấc bạn thành công với thủ thuật trên.
Theo LapTrinhVB.Net


Comments
Good code <3 tks for share
ReplyDeletehi <3
Deletehi, tks you <3
Delete