AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

BorderIcons

Ein Thema von orchanin · begonnen am 14. Jun 2004 · letzter Beitrag vom 14. Jun 2004
Antwort Antwort
orchanin

Registriert seit: 14. Jun 2004
14 Beiträge
 
#1

BorderIcons

  Alt 14. Jun 2004, 15:00
Hi, Leute!
Wer kann mir sagen wie ich neben ein BorderIcons ein eigenen Button erzeugen kann.
  Mit Zitat antworten Zitat
Benutzerbild von Ultimator
Ultimator

Registriert seit: 17. Feb 2004
Ort: Coburg
1.860 Beiträge
 
FreePascal / Lazarus
 
#2

Re: BorderIcons

  Alt 14. Jun 2004, 15:01
Die Jedi-Suite ist dein Freund!
Julian J. Pracht
  Mit Zitat antworten Zitat
Benutzerbild von sakura
sakura

Registriert seit: 10. Jun 2002
Ort: München
11.412 Beiträge
 
Delphi 11 Alexandria
 
#3

Re: BorderIcons

  Alt 14. Jun 2004, 15:03
Zitat von Ultimator:
Die Jedi-Suite ist dein Freund!
Spärlicher kann man es nicht schreiben, oder

Was er wohl sagen wollte, daß sich in der JVCL, einem Teil der Delphi-Jedi Sources, eine entsprechende Komponente dafür befindet. Finden tust Du die Library hier: www.delphi-jedi.org

......
Daniel W.
Ich bin nicht zurück, ich tue nur so
  Mit Zitat antworten Zitat
MrKnogge

Registriert seit: 9. Jun 2003
Ort: Pforzheim
2.458 Beiträge
 
Delphi 2007 Professional
 
#4

Re: BorderIcons

  Alt 14. Jun 2004, 15:24
ansonsten einfach mal nach "CaptionBar" suchen, ich glaub auf www.delphimania.de hab ich unter Tipps mal einen Beispielcode gesehen.

[edit]Habs gefunden:

Delphi-Quellcode:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormResize(Sender: TObject);
  private
    { Private-Deklarationen }
    CaptionBtn : TRect;
    procedure DrawCaptButton;
    procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPaint;
    procedure WMNCActivate(var Msg : TWMNCActivate); message WM_NCACTIVATE;
    procedure WMSetText(var Msg : TWMSetText); message WM_SETTEXT;
    procedure WMNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
    procedure WMNCLButtonDown(var Msg : TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

const
  htCaptionBtn = htSizeLast + 1;

implementation

{$R *.DFM}

procedure TForm1.DrawCaptButton;
var
  xFrame,
  yFrame,
  xSize,
  ySize : Integer;
  R : TRect;
begin
  //Dimensions of Sizeable Frame
  xFrame := GetSystemMetrics(SM_CXFRAME);
  yFrame := GetSystemMetrics(SM_CYFRAME);

  //Dimensions of Caption Buttons
  xSize := GetSystemMetrics(SM_CXSIZE);
  ySize := GetSystemMetrics(SM_CYSIZE);

  //Define the placement of the new caption button
  //next to the existing caption buttons
  CaptionBtn := Bounds(Width - xFrame - 4*xSize + 2,
                       yFrame + 2, xSize - 2, ySize - 4);

  //Get the handle to canvas using Form's device context
  Canvas.Handle := GetWindowDC(Self.Handle);

  Canvas.Font.Name := 'Symbol';
  Canvas.Font.Color := clBlue;
  Canvas.Font.Style := [fsBold];
  Canvas.Pen.Color := clYellow;
  Canvas.Brush.Color := clBtnFace;

  try
    DrawButtonFace(Canvas, CaptionBtn, 1, bsAutoDetect, False, False, False);
    //Define a smaller drawing rectangle within the button
    R := Bounds(Width - xFrame - 4 * xSize + 2,
                       yFrame + 3, xSize - 6, ySize - 7);
    with CaptionBtn do
      Canvas.TextRect(R, R.Left + 2, R.Top - 1, 'W');
  finally
    //Get rid of the device context and set the
    //canvas handle to default
    ReleaseDC(Self.Handle, Canvas.Handle);
    Canvas.Handle := 0;
  end;
end;

//This traps the default form painting
procedure TForm1.WMNCPaint(var Msg : TWMNCPaint);
begin
  inherited;
  DrawCaptButton;
end;

//This traps form activation
procedure TForm1.WMNCActivate(var Msg : TWMNCActivate);
begin
  inherited;
  DrawCaptButton;
end;

//This traps any text being sent to the window
procedure TForm1.WMSetText(var Msg : TWMSetText);
begin
  inherited;
  DrawCaptButton;
end;

//This traps when the form's caption bar is hit with a mouse
procedure TForm1.WMNCHitTest(var Msg : TWMNCHitTest);
begin
  inherited;
  with Msg do
    if PtInRect(CaptionBtn, Point(XPos - Left, YPos - Top)) then
      Result := htCaptionBtn;
end;

//Traps a left-click on the caption bar
procedure TForm1.WMNCLButtonDown(var Msg : TWMNCLButtonDown);
begin
  inherited;
  if (Msg.HitTest = htCaptionBtn) then
    ShowMessage('You hit the button on the caption bar');
end;

//Have to perform an NC_ACTIVATE when the form is resized
//so that the caption bar and button are redrawn. This is
//necessary because Win95/NT4+ draw all buttons relative to the
//right side of a window.
procedure TForm1.FormResize(Sender: TObject);
begin
  //Force a redraw of caption bar if form is resized
  Perform(WM_NCACTIVATE, Word(Active), 0);
end;

end.
[/edit]

[edit=Sharky]Doppelposting geslöscht. Danke für die Info von Dir. Mfg, Sharky[/edit]
Christian Bootz
Einstein ist tot, Newton ist tot,
und mir ist auch schon ganz schlecht...
  Mit Zitat antworten Zitat
Benutzerbild von Stanlay Hanks
Stanlay Hanks

Registriert seit: 1. Mär 2003
2.078 Beiträge
 
Delphi 2005 Professional
 
#5

Re: BorderIcons

  Alt 14. Jun 2004, 15:27
Hallo. Zur Ergänzung: Die Komponente heißt "JvCaptionButton" und ist auf der Komponentenpalette unter "Jv Buttons" zu finden.

Man liest sich, Stanlay
  Mit Zitat antworten Zitat
Benutzerbild von Ultimator
Ultimator

Registriert seit: 17. Feb 2004
Ort: Coburg
1.860 Beiträge
 
FreePascal / Lazarus
 
#6

Re: BorderIcons

  Alt 14. Jun 2004, 15:32
OK, ich gebs ja zu.
Aber das war so verlockend
Julian J. Pracht
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz