WndProc
WM_NCPAINT
private void Main_OnNcPaint(ref Message m) { paintTitleBar = m; IntPtr hdc = GetWindowDC(m.HWnd); Graphics g = Graphics.FromHdc(hdc); RectangleF titleBarRectF = g.VisibleClipBounds; int formWidth = (int)titleBarRectF.Width; int CaptionHeight = Bounds.Height - ClientRectangle.Height; Size CloseButtonSize = SystemInformation.CaptionButtonSize; int X = formWidth - (CloseButtonSize.Width * 4) - 200; int Y = 4; int width = 200; int height = CaptionHeight - 10; string dateText; dateText = DateTime.Now.ToString("dd MMM yyyy hh:mm:ss tt"); RectangleF timeDisplayRectF = new RectangleF(X, Y, width, height); g.FillRectangle(new SolidBrush(Color.Black), timeDisplayRectF); Font font = new Font(Font.FontFamily, Font.Size + 2, FontStyle.Bold); g.DrawString(dateText, font, new SolidBrush(Color.White), timeDisplayRectF); g.Dispose(); ReleaseDC(m.HWnd, hdc); m.Result = IntPtr.Zero; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)