易截截图软件、单文件、免安装、纯绿色、仅160KB

delphi 动态控制窗口置顶且界面不闪

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE)
else
SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE);
end;//使用Self.FormStyle := fsStayOnTop;会使界面闪烁一下

为什么使用FormStyle会出现界面闪烁呢?跟踪了一下代码,我觉得TWinControl.UpdateShowing有很大嫌疑……
关于SetWindowPos的使用可从 delphi 提供的帮助得知。
The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen.
BOOL SetWindowPos(
    HWND hWnd, // handle of window
    HWND hWndInsertAfter, // placement-order handle
    int X, // horizontal position
    int Y, // vertical position
    int cx, // width
    int cy, // height
    UINT uFlags  // window-positioning flags
   );
HWND_NOTOPMOST Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOPMOST Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
SWP_NOMOVE Retains the current position (ignores the X and Y parameters).
SWP_NOSIZE Retains the current size (ignores the cx and cy parameters).


相关文档:

Delphi 设计模式:《HeadFirst设计模式》Delphi7代码

1.被装饰者
{《HeadFirst设计模式》之装饰模式 }
{ 本单元中的类为被装饰者 }
{ 编译工具: Delphi7.0 }
{ E-Mail : xshlife@163.com }

unit uComponent;

interface

type
TBeverage = class(TObject) //抽象饮料类
protected
FDescription: String;
public
......

Delphi 设计模式:《HeadFirst设计模式》Delphi7代码

1. 复杂的子系统
unit uSubObject;

interface

type

{ TAmplifier与TTuner,TCDPlayer,TDVDPlayer相互依赖。 }
{ 在TTuner等的简单实现时用不到对TAmplifier的引用, }
{ 但现实生活中就应该让TAmplifier提供服务,所以这里保留了。 }
{ TProjector对T ......

delphi中canvas画布的运用

 在DELPHI为编程者提供了一个灵活的绘图场所,即本文所述的   
CANVAS类,在DELPHI中的很多控件都具有此属性,使编程者可以   
在这些的控件的表面随心所欲的绘图,这对完善用户界面或者制   
作一些屏幕特技都有着非凡的作用,下面举例说明几种特殊屏幕  &n ......

用PLSQL自动生成数据库表的Delphi对象

 DECLARE
  TYPE TY_QUECUR IS REF CURSOR;
  CUR_COLUMNS  TY_QUECUR;
  SQLCMD  VARCHAR(500);
  TABNAME VARCHAR(20);
  COLNAME VARCHAR(50);
  COLTYPE VARCHAR(20);
  COLCOMMENT VARCHAR2(50);
  COLLENGTH INTEGER;
  COLPRECISION INTEGER; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号