怎麽用代碼實現在輸入筐内輸入RGB(Red,Green,Blue)三個分別的值就可以把顏色顯示在memo裏面!!!!在線等候!!!

解决方案 »

  1.   

    Memo1.Color := RGB(StrToInt(Edit1.Text), StrToInt(Edit1.Text), StrToInt(Edit1.Text));
    當然,需要事先對三個Edit裏的内容進行check,否則會出錯。
      

  2.   

    Memo1.Color := RGB(StrToInt(Edit1.Text), StrToInt(Edit2.Text), StrToInt(Edit3.Text));
    限制一下edit中输入的值
      

  3.   

    EDIT的输入限制值可以在Edit的ONKeyPress事件里写如下代码即可:)if not (Key in ['0'..'9',#8]) then Key := #0
    else 
    if (Length(Edit1.Text) > 0) and (Key <> #8) and (StrToInt(Edit1.Text + Key) > 255) then Key := #0;
      

  4.   

    偷个懒加个try.....except...就行了
      

  5.   

    不知道MaskEdit可以实现吗!??
      

  6.   

    if (StrToInt(Edit1.Text)>255) or (StrToInt(Edit2.Text)>255) or (StrToInt(Edit3.Text)>255) then
    begin
    showmessage('輸入的值不能超過255');
    exit;
    end;
    Memo1.Color := RGB(StrToInt(Edit1.Text), StrToInt(Edit2.Text), StrToInt(Edit3.Text));
      

  7.   

    // Memo1.Color := RGB(StrToInt(Edit1.Text), StrToInt(Edit1.Text), StrToInt(Edit1.Text));
    // 當然,需要事先對三個Edit裏的内容進行check,否則會出錯。哈哈!不好意思,純屬筆誤,應該是Edit1,Edit2,Edit3