Sometimes you want to create a fancy looking form from a bitmap, like WinAMP or K-Jöfol. This part isn't too hard. All you have to do is make a cool graphic, use the TImage component and set the form's border style to bsNone. Well, all's good until we want to move the form... Since there is no title bar there may be problems with this:) Well, as you should already know Delphi can get over any problem. All we have to do is manually take care of the WM_NCHITTEST Windows message.
In this example a TImage component named imgTitle will act like the windows title bar.
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, ExtCtrls, jpeg;
type
TForm1 = class(TForm)
imgTitle: TImage;
private
{ Private declarations }
public
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
{ Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest);
var P: TPoint;
begin
inherited;
P := ScreenToClient(SmallPointToPoint(Message.Pos));
with imgTitle do
if (P.X >= Left) and (P.X < Left + Width) and (P.Y >= Top) and (P.Y < Top + Height) then
Message.Result := htCaption;
end;
end.
Credit for: mailto:m3rlin@programmer.netm3rlin
When you left click and move mouse this form will move.
ขอบ่นเจ๊ ก.ในคดีหวย 30 ล้านหน่อยเหอะ...แม่มโคตรแถ.
-
ที่เจ๊ แกพูดว่า ลุงจรูญ จำหน้า แผนได้ แต่จำคนขาย หวยไม่ได้.คืออยากจะบอกเจ๊
นะครับ ว่าแผนไปบ้านลูงจรูญ ไปพูดคุย เจรจา ก็ต้องจำได้ครับ
ส่วนจำแม่ค้าขายหวยไม่ไ...
6 years ago