- [DEVEXPRESS] Chia sẻ source code cách tạo biểu đồ sơ đồ tổ chức công ty Org Chart trên Winform C#
- [C#] Hướng dẫn tạo Auto Number trên Datagridview winform
- [DATABASE] Hướng dẫn tạo Procedure String Split in Mysql
- [C#] Thiết lập dấu (,) hay dấu (.) ở định dạng số đúng với định dạng số Việt Nam
- [C#] Chia sẻ source code Game Spin Lucky Wheel
- [C#] Hướng dẫn Encode and Decode HTML
- Hướng dẫn tạo tài khoản Chat Open AI GPT tại Việt Nam
- [C#] Hướng dẫn thay đổi giao diện ứng dụng Winform theo giao diện của Windows
- [VB.NET] Hiệu ứng Acrylic, Mica, Tabbed Blur Effect trên Winform
- [DEVEXPRESS] Hướng dẫn sử dụng HTML Template trên Combobox Edit
- [C#] Chia sẻ source code Orange Rain in Winform
- [DEVEXPRESS] Hướng dẫn sử dụng HTML Template trên XtraMessageBox Winform Devexpress 22.2.3
- [DEVEXPRESS] Hướng dẫn sử dụng HTML and CSS Code Viewer trên Winform
- [C#] Number Effect Counter up and down in winform
- [C#] Hướng dẫn Supend and Resume Process ID in Winform
- [C#] Hiển thị line number trên Richtextbox Winform
- [C#] Fake Blue Screen BSOD in winform
- [C#] Chia sẽ code demo sử dụng Async Parallel Foreach and For in Winform
- [C#] Sử dụng ActionBlock run X task at time winform
- [C#] Hướng dẫn sử dụng Property Grid để lưu và tải lại thông tin cấu hình user trên winform
[C#] Thiết kế đồng hồ kỹ thuật số có hiệu ứng scrolling winform
Xin chào các bạn, bài viết hôm nay mình sẻ hướng dẫn các bạn thiết kế đồng hồ kỹ thuật số trên lập trình c#, winform có hiệu ứng scrolling.
[C#] Digital Clock with effect scrolling
Để thiết kế đồng hồ kỹ thuật số trên winform, thì đơn giản, các bạn chỉ cần gọi hàm DateTime.Now()
và ở sự kiện event Tick của Timer.
Và set interval = 1000 (1 giây) trong timer là xong.
Các bạn có thể thiết kế lại mẫu số theo nhu cầu yêu thích của các bạn, bài viết này mình sử dụng mẫu hình số như bên dưới:
Ở bài này mình thiết kế ứng dụng nó như một Gadget đồng hồ trên Desktop:
Video demo ứng dụng Digital Clock C#:
Ở ứng dụng này mình khi chạy đầu tiên, mình sẻ cài đặt ứng dụng hiển thị mặc định ở góc phải bên trên màn hình Desktop.
Full source code Digital Clock C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DigitalClock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.StartPosition = FormStartPosition.Manual;
foreach (var scrn in Screen.AllScreens)
{
if (scrn.Bounds.Contains(this.Location))
{
this.Location = new Point(scrn.Bounds.Right - this.Width, scrn.Bounds.Top);
return;
}
}
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
SendToBack();
}
private void timer_Tick(object sender, EventArgs e)
{
var hour = DateTime.Now.Hour;
var minute = DateTime.Now.Minute;
var second = DateTime.Now.Second;
if(second % 2 == 0)
{
lbl_splash.Visible = true;
}
else
{
lbl_splash.Visible = false;
}
txt_hour.Value = hour;
txt_minute.Value = minute;
txt_second.Value = second;
}
private void label6_Click(object sender, EventArgs e)
{
Process.Start("https://laptrinhvb.net");
}
}
}
Thanks for watching!
Pass Unrar: laptrinhvb.net