Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Delphi½â¾öË¢ÐÂÉÁ˸¡¢Í¼Æ¬ÎÄ×Ö͸Ã÷¡¢±¨¸æÄÚ´æй¶¡­¡­

1.·ÀֹˢÐÂʱÉÁ˸µÄÖÕ¼«½â¾ö°ì·¨
{ ·ÀֹˢÐÂʱÉÁ˸µÄÖÕ¼«½â¾ö°ì·¨(¶Ô¸¶Ë«»º³åÎÞЧʱ) }
  Perform($000B, 0, 0); //ËøÆÁÄ»  ·ÀÖ¹ÉÁ˸
  // ×öһЩ»á·¢ÉúÑÏÖØÉÁ˸µÄÊÂÇé..
  //½âËøÆÁÄ»²¢ÖØ»­
  Perform($000B, 1, 0);
  RedrawWindow(Handle, nil, 0, RDW_FRAME + RDW_INVALIDATE + RDW_ALLCHILDREN + RDW_NOINTERNALPAINT);
2.ͼƬÉÏÏÔʾ͸Ã÷ÎÄ×Ö
//ͼƬÉÏÏÔʾ͸Ã÷µÄÎÄ×Ö
//Ö±½ÓÓÃ.Canvas.Brush.Style:=bsClear;
//È»ºó.Canvas.TextOut(x,y,'ÎÄ×ÖÏÔʾ͸Ã÷');
procedure TForm1.Button1Click(Sender: TObject);
var
  bitBuf:TBitmap;
begin
  bitBuf := TBitmap.Create;
  try
    bitbuf.LoadfromFile('²âÊÔͼƬ.bmp');
    Self.Canvas.Draw(0,0,bitbuf);
    bitbuf.Transparent := True;
    bitbuf.TransparentColor := clWhite;    //ÎÄ×ÖÏÔʾ͸Ã÷
    bitbuf.Canvas.font.color := clBlue;     //ÎÄ×ÖÑÕÉ«
    bitbuf.Canvas.TextOut(10,10,'ÕâÑù¾ÍÊÇ͸Ã÷µÄ×ÖÁË£¡');
    Self.Canvas.Draw(0,0,bitbuf);
  finally
    bitBuf.Free;
  end;
end;
3.È¡µÃ±¾»úIPµØÖ·(¾«¼ò°æ)
//È¡µÃ±¾µØIPµØÖ·(¾«¼ò°æ)
//×¢£ºÊ¹Óú¯ÊýÇ°ÐèÒª WSAStartup($202, wsdata);
function GetLocalIP(): String;
var
  HostName: array[0..255] of Char;
  HostEnt: PHostEnt;
begin
  Result := '';
  if gethostname(HostName, 255) = 0 then
  begin
    HostEnt := gethostbyname(HostName);
    Result := StrPas(inet_ntoa(PInAddr(PInAddr(HostEnt^.h_addr_list)^)^));
  end;
end;
4.±¨¸æÄÚ´æй©
  // ÔÚ³ÌÐòÖм


Ïà¹ØÎĵµ£º

Smarter Records in Turbo Delphi / Delphi 2006

type
TTurboRecord = record
strict private
fNameValue : integer;
function GetName: string;
public
NamePrefix : string;
constructor Create(const initNameValue : integer) ;
property Name : string read GetName;
end;
var
Form1: TForm1;
implementation
{$R *.dfm} ......

DELPHIÏß³ÌÀý×Ó

ÓÅÐãµÄÊý¾Ý¿âÓ¦ÓÃÓ¦µ±³ä·Ö¿¼ÂÇÊý¾Ý¿â·ÃÎʵÄËÙ¶ÈÎÊÌ⡣ͨ³£¿ÉÒÔͨ¹ýÓÅ»¯Êý¾Ý¿â¡¢ÓÅ»¯ ²éѯÓï¾ä¡¢·ÖÒ³²éѯµÈ;¾¶ÊÕµ½Ã÷ÏÔµÄЧ¹û¡£¼´Ê¹ÊÇÕâÑù£¬Ò²²»¿É±ÜÃâµØ»áÔÚ²éѯʱÉÁÏÖÒ»¸ö´øÓÐ SQL·ûºÅµÄɳ©£¬¼´Êó±ê±ä³ÉÁ˲éѯµÈ´ý¡£×î¿ÉÁ¯µÄÊÇÓû§£¬Ëû£¨Ëý£©ÔÚ´ËʱֻÄÜÎÞÄεصȴý¡£Óöµ½¼±ÐÔ×ӵģ¬¸É´àÔÚ´Ëʱ³¢ÊÔ WindowsÖеÄÆäËüÓ¦ÓóÌÐ ......

Override Delphi Form's Restore Operation

{ Private declarations }
procedure WMSysCommand (var Msg: TWMSysCommand) ; message WM_SYSCOMMAND;
procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
begin
if Msg.CmdType = SC_RESTORE then
begin
ShowMessage('SC_RESTORE');
if self.WindowState = wsMaximized then
begin
......

Delphi ·Ö¸î×Ö·û´®µÄ·½·¨

ȷʵºÜÓÐÓ㬵«ÊÇÕâ¸öÔõô°Ñ¿Õ¸ñҲĬÈÏΪ·Ö¸î·ûÁËÄØ£¬Ë­ÖªµÀÔõÑù°Ñ¿Õ¸ñ²»ÈÏΪÊÇ·Ö¸î·ûµÄ£¿£¿ TStringsÊÇÒ»¸ö³éÏóÀ࣬ÔÚʵ¼Ê¿ª·¢ÖУ¬ÊdzýÁË»ù±¾ÀàÐÍÍ⣬ӦÓõÃ×î¶àµÄ¡£ ³£¹æµÄÓ÷¨´ó¼Ò¶¼ÖªµÀ£¬ÏÖÔÚÀ´ÌÖÂÛËüµÄһЩ¸ß¼¶µÄÓ÷¨¡£ ÏÈ°ÑÒªÌÖÂ۵ļ¸¸öÊôÐÔÁгöÀ´£º 1
ȷʵºÜÓÐÓ㬵«ÊÇÕâ¸öÔõô°Ñ¿Õ¸ñҲĬÈÏΪ·Ö¸î·ûÁËÄØ£¬Ë­ÖªµÀÔõÑ ......

delphi ÅжÏÍøÂçÊÇ·ñÁ¬Í¨µÄ·½·¨

uses WinInet;
procedure TForm1.Button1Click(Sender: TObject);
begin
  if InternetGetConnectedState(nil, 0) then
    ShowMessage('ÒÑÁ¬½Ó')
  else
    ShowMessage('ÒѶϿª');
end; ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ