quot;switchquot; de C , como uso no delphi?

Delphi

04/07/2005

[b:43a5f1056d]Bom dia Rapazes,[/b:43a5f1056d]

[b:43a5f1056d][color=blue:43a5f1056d]Estou tentando reescrever um código C++ em Delphi.
Encontrei o[/color:43a5f1056d][/b:43a5f1056d] [color=black:43a5f1056d][b:43a5f1056d]switch[/b:43a5f1056d][/color:43a5f1056d][b:43a5f1056d][color=blue:43a5f1056d], e agora nao sei o q usar no lugar dele... [/color:43a5f1056d][/b:43a5f1056d]

[color=red:43a5f1056d][b:43a5f1056d]em C[/b:43a5f1056d][/color:43a5f1056d]

    switch (alinhamento){
      case taLeftJustify:
        esq = Rect.Left + 3;
        break;
      case taRightJustify:
        esq = Rect.Right - bmp->Width - 3;
        break;
      default:
        esq = Rect.Left +
            (Rect.Width() - bmp->Width)/2;
        break;
    }


[color=red:43a5f1056d][b:43a5f1056d]em Delphi:[/b:43a5f1056d][/color:43a5f1056d]
     switch (alinhamento)
      begin
       case (alinhamento) of
        taLeftJustify : esq:= Rect.Left + 3;
        taRightJustify: esq:= Rect.Right - (bmp.Width - 3);
        default       : esq:= Rect.Left + (Rect.Width() - bmp.Width)/2;
       end;
      end;


[b:43a5f1056d][color=red:43a5f1056d]Como q eu faço?[/color:43a5f1056d][/b:43a5f1056d]


[b:43a5f1056d]Valeu...[/b:43a5f1056d]


Michelli88

Michelli88

Curtidas 0

Respostas

Cabelo

Cabelo

04/07/2005

Michelli

Se entendí bem, esse switch é para alinha corretamente a Imagem, certo..


No delphi, você tem a possíbilidade de usar as propriedade, Stretch do TImage, juntamente com a propriedade AutoSize..


GOSTEI 0
Rjun

Rjun

04/07/2005

O switch do C++ é parecido ao Case do Delphi.

case alinhamento of 
  taLeftJustify: esq = Rect.Left + 3; 
  taRightJustify: esq = Rect.Right - bmp->Width - 3; 
else  
  esq = Rect.Left + 
end;



GOSTEI 0
Michelli88

Michelli88

04/07/2005

Valeu Galera, deixei só o case!


GOSTEI 0
POSTAR