CheckBox1.Perform(BM_SETCHECK, 0, 0);
Agora rode o aplicativo e arraste o texto de Edit1 para Edit2.
var
P: Pchar;
S: String;
begin
// Autorizacao de Menu
S:='\DIRETORIO\NOME DO PROGRAMA';
GetMem(P,Length(S) + 1);
P :=StrPCopy(P,S);
WinExec(P,sw_Show);
FreeMem(P,Length(S) + 1);
end;
Para usar em aplicações MDI, coloque isto no OnCreate
do formulário...
Top := (Application.MainForm.ClientHeight div 2) - Height div 2;
Left := (Application.MainForm.ClientWidth div 2) - Width div 2;
...agora se o formulário estiver como fsNormal coloque assim.
Top := (Screen.Height div 2) - Height div 2;
Left := (Screen.Width div 2) - Width div 2;
Ps.: A propriedade Position do Form tem que estar poDefault, Ok?
desligar:
start c:\windows\rundll.exe user.exe,exitwindows;
reiniciar:
start c:\windows\rundll.exe user.exe,exitwindowsexec;
Use a funcao Format:
nZero := FORMAT('%*.*d', [tam, tam, numero]);
uses
ShellApi, Windows, ShlObj;
interface
function SelectFolder(wnd: HWND; Title: String): String;
implementation
function SelectFolder(wnd: HWND; Title: String): String;
var
lpItemID: PItemIDList;
BrowseInfo: TBrowseInfo;
DisplayName: array[0..MAX_PATH] of char;
TempPath: array[0..MAX_PATH] of char;
begin
FillChar(BrowseInfo, sizeof(TBrowseInfo), #0);
BrowseInfo.hwndOwner := wnd;
BrowseInfo.pszDisplayName := @DisplayName;
BrowseInfo.lpszTitle := PChar(Title);
BrowseInfo.ulFlags := BIF_RETURNONLYFSDIRS;
lpItemID := SHBrowseForFolder(BrowseInfo);
if lpItemId <> nil then
begin
SHGetPathFromIDList(lpItemID, TempPath);
Result := TempPath;
GlobalFreePtr(lpItemID);
end else
Result := '';
end;
DelphiBahia - 1999
http://www.delphibahia.eti.br
[email protected]
O bjetivo desta função é abreviar nomes que,
em alguns casos, não cabem em um determinado
componente na tela ou fica muito grande para
ser impresso em um relatório.
O nome José Francisco Manoel da Siva é abreviado,
por esta função, para José F. M. da Silva. Ou pode-se
abreviar nomes de estabelecimentos, tal como Casas de
Materiais de Construções Macedo ficaria abreviado para
Casas de M. de C. Macedo.
function AbreviaNome(Nome: String): String;
var
Nomes: array[1..20] of string;
i, TotalNomes: Integer;
begin
Nome := Trim(Nome);
Result := Nome;
{Insere um espaço para garantir que todas as letras sejam testadas}
Nome := Nome + #32;
{Pega a posição do primeiro espaço}
i := Pos(#32, Nome);
if i > 0 then
begin
TotalNomes := 0;
{Separa todos os nomes}
while i > 0 do
begin
Inc(TotalNomes);
Nomes[TotalNomes] := Copy(Nome, 1, i - 1);
Delete(Nome, 1, i);
i := Pos(#32, Nome);
end;
if TotalNomes > 2 then
begin
{Abreviar a partir do segundo nome, exceto o último.}
for i := 2 to TotalNomes - 1 do
begin
{Contém mais de 3 letras? (ignorar de, da, das, do, dos, etc.)}
if Length(Nomes[i]) > 3 then
{Pega apenas a primeira letra do nome e coloca um ponto após.}
Nomes[i] := Nomes[i][1] + '.';
end;
Result := '';
for i := 1 to TotalNomes do
Result := Result + Trim(Nomes[i]) + #32;
Result := Trim(Result);
end;
end;
end;
Primeiramente carregue as células do stringGrid e depois no evento
DrawCell
coloque o seguinte código:
if CONDICAO then
begin
StringGrid1.Canvas.Font.Color := clBlack;
StringGrid1.Canvas.Brush.color := clBlue;
StringGrid1.Canvas.TextRect(Rect, Rect.Left,
Rect.Top,StringGrid1.Cells[ACol, ARow]);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
region, region2 : hrgn;
begin
region := CreateRectRgn(0,0,width,height);
region2 := CreateEllipticRgn(30,30,100,100);
CombineRgn(region, region, region2, RGN_DIFF);
SetWindowRgn(handle, region, true);
Form1.FormStyle:= fsStayOnTop;
end;
var
Botao : TButton;
begin
Botao := TButton.Create(TForm);
with Botao do
begin
caption := 'Meu botao';
Parent := TForm;
height := 30;
width := 80;
left := (TForm.ClientWidth - width) div 2;
top := (TForm.ClientHeight - height) div 2;
end;
end;