delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback



Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi








Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (1)


Form Roll Up and Down...Component available for this articleFormat this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi 7.x (or higher)
Category:
VCL-General
Skill Level:
Scoring:
Last Update:
12/01/2008
Search Keys:
delphi delphi3000 article borland vcl code-snippet example how to make your form roll up and down
Times Scored:
1
Visits:
1829
Uploader: Frank de Hell
Company:
Reference: http://www.superliegebeest.nl/delphi.php#7
Component Download: http://www.superliegebeest.nl/d7/frud.zip
 
Question/Problem/Abstract:
This form, when clicked on the titlebar rolls itself up and when clicked again rolls itself down. Just example code on how to create this yourself, do not rely on third party components if you dont have to!
Answer:



This shows how easy it can be, to add neat effects to your forms, without having to buy any code from anyone! This form, when clicked on the titlebar rolls itself up and when clicked again rolls itself down.

------------------------------------------------------------------
Project1.dpr
------------------------------------------------------------------
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.Title := 'FRollUpDown';
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
------------------------------------------------------------------


------------------------------------------------------------------
Unit1.dfm
------------------------------------------------------------------
object Form1: TForm1
  Left = 200
  Top = 196
  BorderIcons = []
  BorderStyle = bsDialog
  Caption = 'Form1'
  ClientHeight = 243
  ClientWidth = 623
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnClick = FormClick
  PixelsPerInch = 96
  TextHeight = 13
  object lbl1: TLabel
    Left = 200
    Top = 88
    Width = 249
    Height = 26
    Caption =
      'Click anywhere on the form to close'#13#10'Right click on the titlebar' +
      ' to fold and unfold'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMaroon
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
end
------------------------------------------------------------------


------------------------------------------------------------------
Unit1.pas
------------------------------------------------------------------
unit Unit1;

interface

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

type
   TForm1 = class(TForm)
    lbl1: TLabel;
    procedure FormClick(Sender: TObject);
   private
    fOldClientHeight: Integer;
    procedure WMNCRButtonDown(var Msg: TWMNCRButtonDown) ; message WM_NCRBUTTONDOWN;
   public
   end;

var
   Form1: TForm1;

implementation
{$R *.dfm}

procedure TForm1.WMNCRButtonDown(var Msg: TWMNCRButtonDown) ;
var
   h : integer;
begin
   if (Msg.HitTest = HTCAPTION) then
   begin
     if (ClientHeight = 0) then
     begin
       for h := 0 to fOldClientHeight do ClientHeight := h;
       Application.ProcessMessages;
     end
     else
     begin
       fOldClientHeight := ClientHeight;
       for h := fOldClientHeight downto 0 do ClientHeight := h;
       Application.ProcessMessages;
     end;
   end;
end;


procedure TForm1.FormClick(Sender: TObject);
begin
Close;
end;

end.
------------------------------------------------------------------  





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Admins help needed
    Nullified van Bommel (Jul 28 2010 3:18PM)

This is my own article, i created it years ago, but forgot the password, and now i do not get any reply anymore, while my previous domain had been shutdown, use the new url please

Please admin reply to my emails so i can update the articles

http://www.delphi7.nl/sourcecode/forms/form_roll_up_and_down.php



Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
D. Souchard
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)