{"id":126,"date":"2007-05-12T14:41:31","date_gmt":"2007-05-12T12:41:31","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/draw-in-caption-bar\/"},"modified":"2007-05-12T14:41:32","modified_gmt":"2007-05-12T12:41:32","slug":"draw-in-caption-bar","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/draw-in-caption-bar\/","title":{"rendered":"Draw in Caption bar"},"content":{"rendered":"<p><em>Konstantin Knips wrote in message<br \/>\n371B12D9.7DCB8FDB@reze-1.rz.rwth-aachen.de <\/p>\n<p>>&#8230;<br \/>\n><br \/>\n><br \/>\n>Neil White schrieb:<br \/>\n><br \/>\n>> In realplayer there is an icon that is overlapping the title bar and the<br \/>\n>> menubar. and there is another button that aint normally there. Can i do<br \/>\nthis<br \/>\n>> in Delphi 4?<br \/>\n>><br \/>\n>> this is not the most helpfull description but thanx anyone who can help<br \/>\nme.<br \/>\n><br \/>\n>  I have heard of the possibility to do that in Delphi. It was about the<br \/>\nHandle<br \/>\n>of the Whole window, not the handle of only the client region. When you got<br \/>\nthe<br \/>\n>right handle, you will be able to make low &#8211; level graphics operations also<br \/>\nin<br \/>\n>the titlebar of the Window. There is nothing more exact that I know.<br \/>\n><br \/>\n<\/em><br \/>\nYou have to handle the WM_NCPAINT message. Something like this (for custom<br \/>\ntext)<br \/>\nShould be similar for bitmaps.<br \/>\n<!--more--><br \/>\n[code lang=&#8221;delphi&#8221;]type<br \/>\n  TForm1 = class(TForm)<br \/>\n  private<br \/>\n    procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;<br \/>\npublic<br \/>\nend;<\/p>\n<p>var<br \/>\nForm1 : TForm1;<\/p>\n<p>implementation<\/p>\n<p>{$r *.dfm}<\/p>\n<p>procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);<\/p>\n<p>var<br \/>\n  ACanvas : TCanvas;<\/p>\n<p>begin<br \/>\n  inherited;<br \/>\n  ACanvas := TCanvas.Create;<br \/>\n  try<br \/>\n    ACanvas.Handle := GetWindowDC(Form1.Handle);<br \/>\n    with ACanvas do begin<br \/>\n      Brush.Color := clActiveCaption;<br \/>\n      Font.Name := &#8216;Tahoma&#8217;;<br \/>\n      Font.Size := 8;<br \/>\n      Font.Color := clred;<br \/>\n      Font.Style := [fsItalic, fsBold];<br \/>\n      TextOut(GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER),<br \/>\n              Round((GetSystemMetrics(SM_CYCAPTION) &#8211; Abs(Font.Height))\/2) +<br \/>\n1,<br \/>\n              &#8216; Some Text&#8217;<br \/>\n    end;<br \/>\n  finally<br \/>\n    ReleaseDC(Form1.Handle, ACanvas.Handle);<br \/>\n    ACanvas.Free;<br \/>\n  end;<\/p>\n<p>end;<br \/>\n[\/code]<\/p>\n<p>[tags]Delphi, Forms[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Konstantin Knips wrote in message 371B12D9.7DCB8FDB@reze-1.rz.rwth-aachen.de >&#8230; > > >Neil White schrieb: > >> In realplayer there is an icon that is overlapping&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,100],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-22","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/126"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/126\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}