CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of delphi
unit Delegates;
 
interface
 
uses
  Generics.Collections;
 
{ IDelegate<T>  }
 
type
by sysrpl   December 29, 2010 @ 8:40am
Tags: Delphi
127 Views
no comments
 
// cria uma string com n caracteres
function IncStr( Str: String; Qtd: Integer ): String;
var v_Str: String;
begin
  v_Str := Str;
  While Length( SysUtils.Trim( Str ) ) < Qtd do
    Str := v_Str+ SysUtils.Trim(Str);
  // Retorno da Funcao.
  Result := Str;
end;
by Thiago Pedro   October 18, 2010 @ 6:56pm
191 Views
no comments
 
var
  list: TStringList;
begin
  list := TStringList;
  try
    list.Add( 'Testando' );
    ListBox1.Items.Assign( list );
  finally
    list.free;
  end;
by Thiago Pedro   September 02, 2010 @ 4:05pm
233 Views
no comments
 
function DelStr(S, busca : String): String;
var
  n : Integer;
Begin
  For n := Length(S) downto 1 do
  Begin
    If copy(S, n, 1) = busca Then
      delete(S, n, 1);
  end;
  Result := S;
by Thiago Pedro   August 31, 2010 @ 5:27pm
230 Views
no comments
 
Como faço para listar os tipos enumerados de força mais fácil e dinâmica num ComboBox?
 
Essa foi a pergunta de uma grande amigo meu hoje. Confesso que não tinha muita idéia de como fazer. Imagine a situação:
 
type
TMeuTipo = (Tipo1, Tipo2, Tipo3, Tipo4, Tipo5);
 
Como fazer isso aparecer em um ComboBox?
Bem, podemos transformar isso em Strings e então adicioná-lo ao Combo, mais ou menos assim:
by Adriano Santos   August 27, 2010 @ 12:02pm
320 Views
no comments
 
//procedure para aguardar um determinado tempo - não trava o programa como o sleep
procedure Delay(MSec: Cardinal);
var
  Start: Cardinal;
begin
  Start := GetTickCount;
  repeat
    Application.ProcessMessages;
  until (GetTickCount - Start) >= MSec;
end;
by Thiago Pedro   August 27, 2010 @ 8:07am
330 Views
1 comments
 
Instalando o IndyTiburon ( Windows 7 - Delphi 2010 Version 14.0.3615.26342 )
 
conceda permissão para "Todos" nas pastas da IndyTiburon.
 
menu tools >> options
  delphi options >> library win32
  library path = C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib\IndyTiburon\Lib\System
  library path =C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib\IndyTiburon\Lib\Core
  library path=C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib\IndyTiburon\Lib\Protocols
342 Views
no comments
 
C++
首先在程序的uses段中添加对ShellApi的引用,另外还要在“创建”按钮的响应过程中添加下列代码:
 
procedure TForm1.btnCreateClick(Sender: TObject);
begin
 CreateDirectory(PChar(ExtractFilePath(ParamStr(0))+’Test’),nil);
end; 
 
程序运行初期就会执行CreateDirectory(PChar(ExtractFilePath(ParamStr(0))+’Test’),nil)语句,在程序实例所在的目录中创建一个子目录test。
 
在程序运行过程中,单击“删除”按钮就可以将新创建的test子目录删除,响应代码如下:
by Yuzhen Situ   October 26, 2009 @ 8:54pm
Tags: delphi
205 Views
no comments
 
C++
unit UnitCutPic;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;
 
type
  TFrmCutPic = class(TForm)
by Yuzhen Situ   October 25, 2009 @ 4:28am
Tags: Delphi
220 Views
no comments
 
C++
uses mshtml;
 
var    htmldoc: IHTMLDocument2;
         MaxScrollWidth, MaxScrollHeight: Integer;
 
htmldoc := web.Document as IHTMLDocument2;
MaxScrollHeight := htmldoc.body.getAttribute('ScrollHeight', 0); //获得滚动条最大高度
MaxScrollWidth := htmldoc.body.getAttribute('ScrollWidth', 0);//获得滚动条最大宽度
Web.OleObject.Document.ParentWindow.ScrollBy(MaxScrollWidth, MaxScrollHeight ); //滚动到最右最下
by Yuzhen Situ   October 25, 2009 @ 4:26am
Tags: Delphi
355 Views
no comments
 
Delphi中canvas(画布)的运用。 
 
在DELPHI为编程者提供了一个灵活的绘图场所,即本文所述的    
CANVAS类,在DELPHI中的很多控件都具有此属性,使编程者可以    
在这些的控件的表面随心所欲的绘图,这对完善用户界面或者制    
作一些屏幕特技都有着非凡的作用,下面举例说明几种特殊屏幕    
效果的形成过程。    
   
一、CANVAS必备基本知识:    
   
by Yuzhen Situ   October 25, 2009 @ 4:22am
Tags: Delphi, canvas
496 Views
no comments
 
var   d:THandle;   
  begin   
      d:=getdc(panel1.Handle);   
    
      bitblt(image2.Canvas.Handle,0,0,panel1.Width,panel1.Height,d,0,0,srccopy);   
    
      ReleaseDC(panel1.Handle,d);   
by Yuzhen Situ   October 25, 2009 @ 4:15am
262 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate