控件style你知我知.

类别:Delphi 点击:0 评论:0 推荐:

一般控件我可以通过给于我们的属性设置,但我们不可能满足这些属性
比如我们要edit1.text只能是数字,虽然我可以在edit.change监控,但
其控件style已提供相应的style,下面是代码----还有一些style自己
试一下。
var
  defstyle: dWord;
begin
  defstyle := GetWindowLong(Edit1.Handle, GWL_STYLE);
  SetWindowLong(Edit1.Handle, GWL_STYLE, defstyle or ES_NUMBER)
end;
--------------------------------------------------------

{ Edit Control Styles }
  {$EXTERNALSYM ES_LEFT}
  ES_LEFT = 0;
  {$EXTERNALSYM ES_CENTER}
  ES_CENTER = 1;
  {$EXTERNALSYM ES_RIGHT}
  ES_RIGHT = 2;
  {$EXTERNALSYM ES_MULTILINE}
  ES_MULTILINE = 4;
  {$EXTERNALSYM ES_UPPERCASE}
  ES_UPPERCASE = 8;
  {$EXTERNALSYM ES_LOWERCASE}
  ES_LOWERCASE = $10;
  {$EXTERNALSYM ES_PASSWORD}
  ES_PASSWORD = $20;
  {$EXTERNALSYM ES_AUTOVSCROLL}
  ES_AUTOVSCROLL = $40;
  {$EXTERNALSYM ES_AUTOHSCROLL}
  ES_AUTOHSCROLL = $80;
  {$EXTERNALSYM ES_NOHIDESEL}
  ES_NOHIDESEL = $100;
  {$EXTERNALSYM ES_OEMCONVERT}
  ES_OEMCONVERT = $400;
  {$EXTERNALSYM ES_READONLY}
  ES_READONLY = $800;
  {$EXTERNALSYM ES_WANTRETURN}
  ES_WANTRETURN = $1000;
  {$EXTERNALSYM ES_NUMBER}
  ES_NUMBER = $2000;
----------------------------------------------
  { Window Styles }
  {$EXTERNALSYM WS_OVERLAPPED}
  WS_OVERLAPPED = 0;
  {$EXTERNALSYM WS_POPUP}
  WS_POPUP = DWORD($80000000);
  {$EXTERNALSYM WS_CHILD}
  WS_CHILD = $40000000;
  {$EXTERNALSYM WS_MINIMIZE}
  WS_MINIMIZE = $20000000;
  {$EXTERNALSYM WS_VISIBLE}
  WS_VISIBLE = $10000000;
  {$EXTERNALSYM WS_DISABLED}
  WS_DISABLED = $8000000;
  {$EXTERNALSYM WS_CLIPSIBLINGS}
  WS_CLIPSIBLINGS = $4000000;
  {$EXTERNALSYM WS_CLIPCHILDREN}
  WS_CLIPCHILDREN = $2000000;
  {$EXTERNALSYM WS_MAXIMIZE}
  WS_MAXIMIZE = $1000000;
  {$EXTERNALSYM WS_CAPTION}
  WS_CAPTION = $C00000;      { WS_BORDER or WS_DLGFRAME  }
  {$EXTERNALSYM WS_BORDER}
  WS_BORDER = $800000;
  {$EXTERNALSYM WS_DLGFRAME}
  WS_DLGFRAME = $400000;
  {$EXTERNALSYM WS_VSCROLL}
  WS_VSCROLL = $200000;
  {$EXTERNALSYM WS_HSCROLL}
  WS_HSCROLL = $100000;
  {$EXTERNALSYM WS_SYSMENU}
  WS_SYSMENU = $80000;
  {$EXTERNALSYM WS_THICKFRAME}
  WS_THICKFRAME = $40000;
  {$EXTERNALSYM WS_GROUP}
  WS_GROUP = $20000;
  {$EXTERNALSYM WS_TABSTOP}
  WS_TABSTOP = $10000;

  {$EXTERNALSYM WS_MINIMIZEBOX}
  WS_MINIMIZEBOX = $20000;
  {$EXTERNALSYM WS_MAXIMIZEBOX}
  WS_MAXIMIZEBOX = $10000;

  {$EXTERNALSYM WS_TILED}
  WS_TILED = WS_OVERLAPPED;
  {$EXTERNALSYM WS_ICONIC}
  WS_ICONIC = WS_MINIMIZE;
  {$EXTERNALSYM WS_SIZEBOX}
  WS_SIZEBOX = WS_THICKFRAME;

  { Common Window Styles }
  {$EXTERNALSYM WS_OVERLAPPEDWINDOW}
  WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or
    WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX);
  {$EXTERNALSYM WS_TILEDWINDOW}
  WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW;
  {$EXTERNALSYM WS_POPUPWINDOW}
  WS_POPUPWINDOW = (WS_POPUP or WS_BORDER or WS_SYSMENU);
  {$EXTERNALSYM WS_CHILDWINDOW}
  WS_CHILDWINDOW = (WS_CHILD);

  { Extended Window Styles }
  {$EXTERNALSYM WS_EX_DLGMODALFRAME}
  WS_EX_DLGMODALFRAME = 1;
  {$EXTERNALSYM WS_EX_NOPARENTNOTIFY}
  WS_EX_NOPARENTNOTIFY = 4;
  {$EXTERNALSYM WS_EX_TOPMOST}
  WS_EX_TOPMOST = 8;
  {$EXTERNALSYM WS_EX_ACCEPTFILES}
  WS_EX_ACCEPTFILES = $10;
  {$EXTERNALSYM WS_EX_TRANSPARENT}
  WS_EX_TRANSPARENT = $20;
  {$EXTERNALSYM WS_EX_MDICHILD}
  WS_EX_MDICHILD = $40;
  {$EXTERNALSYM WS_EX_TOOLWINDOW}
  WS_EX_TOOLWINDOW = $80;
  {$EXTERNALSYM WS_EX_WINDOWEDGE}
  WS_EX_WINDOWEDGE = $100;
  {$EXTERNALSYM WS_EX_CLIENTEDGE}
  WS_EX_CLIENTEDGE = $200;
  {$EXTERNALSYM WS_EX_CONTEXTHELP}
  WS_EX_CONTEXTHELP = $400;

  {$EXTERNALSYM WS_EX_RIGHT}
  WS_EX_RIGHT = $1000;
  {$EXTERNALSYM WS_EX_LEFT}
  WS_EX_LEFT = 0;
  {$EXTERNALSYM WS_EX_RTLREADING}
  WS_EX_RTLREADING = $2000;
  {$EXTERNALSYM WS_EX_LTRREADING}
  WS_EX_LTRREADING = 0;
  {$EXTERNALSYM WS_EX_LEFTSCROLLBAR}
  WS_EX_LEFTSCROLLBAR = $4000;
  {$EXTERNALSYM WS_EX_RIGHTSCROLLBAR}
  WS_EX_RIGHTSCROLLBAR = 0;

  {$EXTERNALSYM WS_EX_CONTROLPARENT}
  WS_EX_CONTROLPARENT = $10000;
  {$EXTERNALSYM WS_EX_STATICEDGE}
  WS_EX_STATICEDGE = $20000;
  {$EXTERNALSYM WS_EX_APPWINDOW}
  WS_EX_APPWINDOW = $40000;
  {$EXTERNALSYM WS_EX_OVERLAPPEDWINDOW}
  WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE);
  {$EXTERNALSYM WS_EX_PALETTEWINDOW}
  WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST);

  {$EXTERNALSYM WS_EX_LAYERED}
  WS_EX_LAYERED = $00080000;
  {$EXTERNALSYM WS_EX_NOINHERITLAYOUT}
  WS_EX_NOINHERITLAYOUT = $00100000; // Disable inheritence of mirroring by children
  {$EXTERNALSYM WS_EX_LAYOUTRTL}
  WS_EX_LAYOUTRTL = $00400000; // Right to left mirroring
  {$EXTERNALSYM WS_EX_COMPOSITED}
  WS_EX_COMPOSITED = $02000000;
  {$EXTERNALSYM WS_EX_NOACTIVATE}
  WS_EX_NOACTIVATE = $08000000;

本文地址:http://com.8s8s.com/it/it4657.htm