was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

35 Visitors Online


 
...ein farbiger Rahmen um ein TForm zeichnen?
Autor: Unknown
[ Tip ausdrucken ]  

Tip Bewertung (12):  
     


{
  Erstelle ein Message Handler für die Windows Message WM_NCPAINT Message. Das
  folgende Beispiel zeichnet ein 1 Pixel breiter roter Rahmen um
  das Formular.

  Create a message handler for the Windows Message WM_NCPAINT
  message. The following example paints a 1 pixel red border around the
  frame of the form.
}

unit Unit1;

interface

uses
  
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  
TForm1 = class(TForm)
  private
    
{ Private-Deklarationen }
    
procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;
  public
    
{ Public-Deklarationen }
  
end;

var
  
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);
var
  
dc: hDc;
  Pen: hPen;
  OldPen: hPen;
  OldBrush: hBrush;
begin
  inherited
;
  dc := GetWindowDC(Handle);
  Msg.Result := 1;
  //Change the RGB value to change the color
  
Pen := CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
  OldPen := SelectObject(dc, Pen);
  OldBrush := SelectObject(dc, GetStockObject(NULL_BRUSH));
  Rectangle(dc, 0, 0, Form1.Width, Form1.Height);
  SelectObject(dc, OldBrush);
  SelectObject(dc, OldPen);
  DeleteObject(Pen);
  ReleaseDC(Handle, Canvas.Handle);
end;


end.


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners