PAGUE 6 MESES
LEVE 12 MESES
GARANTIR DESCONTO

Fórum Erro em função para alinhar labelEdit a diretia: #441935

05/05/2013

0

erro: [DCC Error] U_LIB.PAS(2279): E2003 Undeclared identifier: 'GetDeviceContext'


função:

function AlinhaEdit(Edt: TLabeledEdit): TLabeledEdit;
var
n: Integer;
c: TCanvas;
h: HWND;

begin

c := TCanvas.Create;
c.Handle := GetDeviceContext(h);
c.Font := Edt.Font;
n := round((Edt.Width - c.TextWidth(Edt.Text) - 8) / c.TextWidth( ' '));
Edt.Text := stringofchar(' ', n) + Edt.Text;
Result := Edt;

end;
Joao Silva

Joao Silva

Responder

Posts

05/05/2013

Joao Silva

Eu usava a função normalmente no delphi 6 mas quando tentei usa-la no xe2 deu esse erro. como resolver?
erro: [dcc error] u_lib.pas(2279): e2003 undeclared identifier: 'getdevicecontext'


função:

function alinhaedit(edt: tlabelededit): tlabelededit;
var
n: integer;
c: tcanvas;
h: hwnd;

begin

c := tcanvas.create;
c.handle := getdevicecontext(h);
c.font := edt.font;
n := round((edt.width - c.textwidth(edt.text) - 8) / c.textwidth( ' '));
edt.text := stringofchar(' ', n) + edt.text;
result := edt;

end;
Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar