把98的任务条隐藏掉。
ShowWindow(FindWindow('Shell_TrayWnd',nil), SW_HIDE);
程序推出别忘了将任务条显示:
ShowWindow(FindWindow('Shell_TrayWnd',nil), SW_SHOW);
ShowWindow(FindWindow('Shell_TrayWnd',nil), SW_HIDE);
程序推出别忘了将任务条显示:
ShowWindow(FindWindow('Shell_TrayWnd',nil), SW_SHOW);
解决方案 »
- Delphi很简单的问题
- delphi中用TClientDataSet读取CLOB字段时报Invalid Field Type
- delphi背景图片问题
- *** 高分请问一个比较难的问题,关于Delphi6和nvarchar的 ***
- 怎样才能获得其他应用程序中的某个文本框中的文本?
- 救命!!!我公司的服务器快死了,,,万分火急!20分全给,一点不留。
- 等待执行winexec至结束,怎么控制?
- 请教扫描取得图书,商品条形码的方法
- 怎样求得A1和A2(都是日期字段)相差的年、月、天数呢?
- 有谁前台用BCB或Delphi,后台用VFP开发过应用系统,HELP ME!
- 软件开发工程师、软件工程师、程序员有什么分别?
- mouse 左击异常?
我看到有一个电子图书界面的窗体可能做到,但我不知是其中哪条代码起到作用.我将它帖上来,帮忙看看.
unit NeoForm;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, ImgList, ToolWin, ComCtrls, MenuBar, Menus, Buttons;type
TWhichBorder=(wbTop,wbLeft,wbRight,wbBottom,wbLeftTop,wbLeftBottom,wbRightTop,
wbRightBottom,wbNone);
TzypNeoBorderIcons=Array [1..3] of Boolean;
TzypNeoForm = class(TForm)
ImageTop: TImage;
ImageLeft: TImage;
ImageLeftTop: TImage;
ImageRightTop: TImage;
ImageRight: TImage;
ImageBottom: TImage;
LabelCaption: TLabel;
ImageIcon: TImage;
PanelBkGnd: TPanel;
ImageMax: TImage;
ImageMin: TImage;
ImageNormal: TImage;
ImageClose: TImage;
ImageDeactiveLeftTop: TImage;
ImageDeactiveTop: TImage;
ImageDeactiveRightTop: TImage;
ImageActiveTop: TImage;
ImageActiveLeftTop: TImage;
ImageActiveRightTop: TImage;
ImageLeftBottom: TImage;
ImageRightBottom: TImage;
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure SetCanResize(value:Boolean);
function GetcanResize:Boolean;
procedure SetBorderIcons;
procedure ImageTopMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ImageTopMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ImageTopMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
procedure FormCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
private
{ Private declarations }
FCanResize,FisDown:Boolean;
FDetax,FDetaY:Integer;
FP,FOldP:TPoint;
FzypNeoBorderIcons:TZypNeoBorderIcons;
public
{ Public declarations }
protected
procedure WndProc(var Msg:TMessage);override;
procedure WMNCHitTest(var Msg:TWMNCHitTest);message WM_NCHITTEST;
end;var
zypNeoForm: TzypNeoForm;implementation{$R *.DFM}
const
cTopHeight=50;
cRightTopWidth=97;
cLeftWidth=10;
cRightWidth=10;
cBottomHeight=12;
cMaxWidth=800;
cMaxHeight=600;
cMinWidth=300;
cMinHeight=200;
cPenWidth=3;
cIconTop=6;
procedure TzypNeoForm.WMNCHitTest(var Msg:TWMNCHitTest);
var
pt:TPoint;
begin
if (GetCanReSize=False) or (WindowState<>wsNormal) then
begin
inherited;
exit;
end;
pt:=Point(Msg.xPos,Msg.yPos);
pt:=ScreenToClient(pt);
if (pt.x<5) and (pt.y<5) then Msg.Result:=htTopLeft
else if (pt.x>width-5) and (pt.y<5) then Msg.Result:=htTopRight
else if (pt.x>width-5) and (pt.y>height-5) then Msg.Result:=htBottomRight
else if (pt.x<5) and (pt.y>height-5) then Msg.Result:=htBottomLeft
else if (pt.x<5) then Msg.Result:=htLeft
else if (pt.y<5) then Msg.Result:=htTop
else if (pt.x>width-5) then Msg.Result:=htRight
else if (pt.y>height-5) then Msg.Result:=htBottom
else inherited;
end;procedure TzypNeoForm.SetBorderIcons;
begin
case BorderStyle of
bsToolWindow,
bsSizeToolWin,
bsDialog:
begin
FzypNeoBorderIcons[1]:=True;
FzypNeoBorderIcons[2]:=False;
FzypNeoBorderIcons[3]:=False;
ImageIcon.Visible:=False;
ImageIcon.Enabled:=False;
end;
bsNone: //虽然设为bsNone,但是仍然有Caption栏,如果连Caption栏都不想要的话,
begin //老兄,我劝你还是不要用我的这个Form了。
FzypNeoBorderIcons[1]:=False;
FzypNeoBorderIcons[2]:=False;
FzypNeoBorderIcons[3]:=False;
ImageIcon.Visible:=False;
ImageIcon.Enabled:=False;
end;
else
FzypNeoBorderIcons[1]:=True;
FzypNeoBorderIcons[2]:=True;
FzypNeoBorderIcons[3]:=True;
ImageIcon.Visible:=True;
ImageIcon.Enabled:=True;
end;
if biSystemMenu in BorderIcons then
begin
FzypNeoBorderIcons[1]:=FzypNeoBorderIcons[1] and True;
FzypNeoBorderIcons[2]:=FzypNeoBorderIcons[2] and True;
FzypNeoBorderIcons[3]:=FzypNeoBorderIcons[3] and True;
ImageIcon.Visible:=ImageIcon.Visible and True;
ImageIcon.Enabled:=ImageIcon.Enabled and True;
end
else
begin
FzypNeoBorderIcons[1]:=FzypNeoBorderIcons[1] and False;
FzypNeoBorderIcons[2]:=FzypNeoBorderIcons[2] and False;
FzypNeoBorderIcons[3]:=FzypNeoBorderIcons[3] and False;
ImageIcon.Visible:=ImageIcon.Visible and False;
ImageIcon.Enabled:=ImageIcon.Enabled and False;
end;
if biMinimize in BorderIcons then
begin
FzypNeoBorderIcons[3]:=FzypNeoBorderIcons[3] and True;
end
else
begin
FzypNeoBorderIcons[3]:=FzypNeoBorderIcons[3] and False;
end;
if biMaximize in BorderIcons then
begin
FzypNeoBorderIcons[2]:=FzypNeoBorderIcons[2] and True;
end
else
begin
FzypNeoBorderIcons[2]:=FzypNeoBorderIcons[2] and False;
end;
ImageClose.Visible:=FzypNeoBorderIcons[1];
ImageClose.Enabled:=FzypNeoBorderIcons[1];
ImageMax.Visible:=FzypNeoBorderIcons[2];
ImageMax.Enabled:=FzypNeoBorderIcons[2];
ImageMin.Visible:=FzypNeoBorderIcons[3];
ImageMin.Enabled:=FzypNeoBorderIcons[3];
end;procedure TzypNeoForm.SetCanResize(value:Boolean);
begin
if FCanResize<>value then FCanResize:=value;
end;function TzypNeoForm.GetcanResize;
begin
Result:=FCanResize;
end;procedure TzypNeoForm.WndProc(var Msg:TMessage);
begin
inherited WndProc(Msg);
if Msg.Msg=WM_ACTIVATE then
begin
case Msg.WParamLo of
WA_ACTIVE,WA_CLICKACTIVE:
begin
ImageTop.Picture:=ImageActiveTop.Picture;
ImageLeftTop.Picture:=ImageActiveLeftTop.Picture;
ImageRightTop.Picture:=ImageActiveRightTop.Picture;
end;
WA_INACTIVE:
begin
ImageLeftTop.Picture:=ImageDeactiveLeftTop.Picture;
ImageTop.Picture:=ImageDeactiveTop.Picture;
ImageRightTop.Picture:=ImageDeactiveRightTop.Picture;
end;
end;
end;
end;procedure TzypNeoForm.FormCreate(Sender: TObject);
begin
PanelBKGND.Color:=TColor($00CFCFCF);
Width:=PanelBKGND.Width+cLeftWidth+cRightWidth;
Height:=PanelBKGND.Height+cTopHeight+cBottomHeight-2;
LabelCaption.Caption:=Caption;
SetBorderIcons;
SetCanResize(False);
BorderStyle:=bsNone;
FormResize(Sender);
end;procedure TzypNeoForm.FormResize(Sender: TObject);
var
i:Integer;
begin
ImageTop.Left:=0;
ImageTop.Top:=0;
ImageTop.Width:=ClientWidth;
ImageBottom.Width:=ClientWidth;
ImageBottom.Top:=ClientHeight-cBottomHeight;
ImageLeft.Height:=ClientHeight;
ImageRight.Height:=ClientHeight;
ImageRight.Left:=ClientWidth-cRightWidth;
ImageLeftBottom.left:=0;
ImageLeftBottom.Top:=ClientHeight-cBottomHeight;
ImageRightBottom.Top:=ClientHeight-cBottomHeight;
ImageRightBottom.Left:=ClientWidth-cRightWidth;
ImageRightTop.Left:=ClientWidth-cRightTopWidth;
ImageRightTop.top:=0;
ImageLeftTop.Left:=0;
ImageLeftTop.Top:=0;
PanelBKGND.Left:=cLeftWidth;
PanelBKGND.Top:=cTopHeight;
PanelBKGND.Width:=ClientWidth-cLeftWidth-cRightWidth;
PanelBKGND.Height:=ClientHeight-cTopHeight-cBottomHeight+2;
ImageMin.top:=cIconTop;
ImageMax.top:=cIconTop;
ImageNormal.Top:=cIconTop;
ImageClose.top:=cIconTop;
i:=1;
if FzypNeoBorderIcons[1] then
begin
ImageClose.Left:=Width-3-i*17-2;
Inc(i);
end;
if FzypNeoBorderIcons[2] then
begin
ImageMax.Left:=Width-3-i*17-2;
ImageNormal.Left:=ImageMax.Left;
Inc(i);
end;
if FzypNeoBorderIcons[3] then
begin
ImageMin.Left:=Width-3-i*17-2;
end;
LabelCaption.Left:=ImageLeftTop.Left;
LabelCaption.Width:=PanelBKGND.Width;
if FzypNeoBorderIcons[2] then
if WindowState=wsMaximized then
begin
ImageNormal.Enabled:=True;
ImageNormal.Visible:=True;
ImageMax.Enabled:=False;
ImageMax.Visible:=False;
end
else
begin
ImageNormal.Enabled:=False;
ImageNormal.Visible:=False;
ImageMax.Enabled:=True;
Imagemax.Visible:=True;
end;
end;procedure TzypNeoForm.ImageTopMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FisDown:=True;
GetCursorPos(FOldP);
end;procedure TzypNeoForm.ImageTopMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if not FisDown then exit;
GetCursorPos(Fp);
FDetaX:=Fp.x-Foldp.x;
FDetaY:=FP.y-FOldP.y;
SetBounds(Left+FDetaX,Top+FDetaY,Width,Height);
GetCursorPos(FOldP);
end;procedure TzypNeoForm.ImageTopMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
FisDown:=false;
end;procedure TzypNeoForm.FormCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
begin
if NewWidth>=cMaxWidth then NewWidth:=cMaxWidth;
if NewWidth<=cMinWidth then NewWidth:=cMinWidth;
if NewHeight>=cMaxHeight then NewHeight:=cMaxHeight;
if NewHeight<=cMinHeight then NewHeight:=cMinHeight;
end;end.