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.±¨¸æÄÚ´æй©
// ÔÚ³ÌÐòÖм
Ïà¹ØÎĵµ£º
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}
......
ÓÅÐãµÄÊý¾Ý¿âÓ¦ÓÃÓ¦µ±³ä·Ö¿¼ÂÇÊý¾Ý¿â·ÃÎʵÄËÙ¶ÈÎÊÌ⡣ͨ³£¿ÉÒÔͨ¹ýÓÅ»¯Êý¾Ý¿â¡¢ÓÅ»¯ ²éѯÓï¾ä¡¢·ÖÒ³²éѯµÈ;¾¶ÊÕµ½Ã÷ÏÔµÄЧ¹û¡£¼´Ê¹ÊÇÕâÑù£¬Ò²²»¿É±ÜÃâµØ»áÔÚ²éѯʱÉÁÏÖÒ»¸ö´øÓÐ SQL·ûºÅµÄɳ©£¬¼´Êó±ê±ä³ÉÁ˲éѯµÈ´ý¡£×î¿ÉÁ¯µÄÊÇÓû§£¬Ëû£¨Ëý£©ÔÚ´ËʱֻÄÜÎÞÄεصȴý¡£Óöµ½¼±ÐÔ×ӵģ¬¸É´àÔÚ´Ëʱ³¢ÊÔ WindowsÖеÄÆäËüÓ¦ÓóÌÐ ......
{ 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
......
ȷʵºÜÓÐÓ㬵«ÊÇÕâ¸öÔõô°Ñ¿Õ¸ñҲĬÈÏΪ·Ö¸î·ûÁËÄØ£¬ËÖªµÀÔõÑù°Ñ¿Õ¸ñ²»ÈÏΪÊÇ·Ö¸î·ûµÄ£¿£¿ TStringsÊÇÒ»¸ö³éÏóÀ࣬ÔÚʵ¼Ê¿ª·¢ÖУ¬ÊdzýÁË»ù±¾ÀàÐÍÍ⣬ӦÓõÃ×î¶àµÄ¡£ ³£¹æµÄÓ÷¨´ó¼Ò¶¼ÖªµÀ£¬ÏÖÔÚÀ´ÌÖÂÛËüµÄһЩ¸ß¼¶µÄÓ÷¨¡£ ÏÈ°ÑÒªÌÖÂ۵ļ¸¸öÊôÐÔÁгöÀ´£º 1
ȷʵºÜÓÐÓ㬵«ÊÇÕâ¸öÔõô°Ñ¿Õ¸ñҲĬÈÏΪ·Ö¸î·ûÁËÄØ£¬ËÖªµÀÔõÑ ......
uses WinInet;
procedure TForm1.Button1Click(Sender: TObject);
begin
if InternetGetConnectedState(nil, 0) then
ShowMessage('ÒÑÁ¬½Ó')
else
ShowMessage('ÒѶϿª');
end; ......