case mystr of
  'MA1':checkbox1.Checked:=true;
  'MA2':checkbox2.Checked:=true;
  'AA1':checkbox3.Checked:=true;
  'AA2':checkbox4.Checked:=true;
  'AA3':checkbox5.Checked:=true;
  'AA4':checkbox6.Checked:=true
end;

解决方案 »

  1.   

    Case分支不能是字符.大哥你真强.
      

  2.   

    var
            mystr:string;
            ch:char;
    begin
            mystr:='MA1';
            if copy(mystr,1,1)='M' then
            begin
                    //showmessage(copy(mystr,3,1));
            end
            else if copy(myStr,1,1)='A' then
            case ord(ch=copy(mystr,3,1)) of
            49,50,51,52:showmessage(copy(mystr,3,1));
            end;
    end;
      

  3.   

    var
            mystr:string;
            substr:string;/////////////
            ch:char;
    begin
            mystr:='AA2';
            if copy(mystr,1,1)='M' then
            begin
                    //showmessage(copy(mystr,3,1));
            end
            else if copy(myStr,1,1)='A' then
            begin
                    substr:=copy(mystr,3,1);///////////////
                    ch:=substr[1];///////////////
            case ord(ch) of///////////////
            49,50,51,52:showmessage(copy(mystr,3,1));
            end;
            end;
    end;