Code Advance
I - Di chuyển Panel
using System.Runtime.InteropServices; [DllImport("user32.dll", EntryPoint = "ReleaseCapture")] private extern static void ReleaseCapture(); [DllImport("user32.dll", EntryPoint = "SendMessage")] private extern static int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); private void pnlTitle_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, 0x112, 0xf012, 0); }
II -Text center
lbName.Location = new Point((pnlAvartar.Width - lbName.Width)/2-5 , lbName.Location.Y);
III - DateTime
lbDongHo.Text = DateTime.Now.ToString("hh:mm tt"); lbDongHo.Text = DateTime.Now.ToString("hh:mm ss");
IV- Kiểm tra đầu vào có phải là chuỗi số hay không
public bool IsNumber(string pValue) { foreach (Char c in pValue) { if (!Char.IsDigit(c)) return false; } return true; }
V-
No Comment to " Code Advance "