我想用‘+’号键和‘-’ 号键实现DrawList 上的选择呢(实现 上、下键相同的功能)。我在那个事件作修改呢?或者修改那个单元的代码呢?

解决方案 »

  1.   

    if key=+ then
      key=上光标;就是这个意思/
      

  2.   

    if key=+ then
      key=上光标;就是这个意思/
      

  3.   

    onkeypress 里不可实现,因为如何也会在你的Combobox.text 上加上'+' 或'-'.
      

  4.   

    procedure TForm1.ComboBox1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
     //189 is the key of - 
    //and you can use showmessage(inttostr(key))get the + key's number
      if key = 189 then
        key :=vk_down;
    end;procedure TForm1.ComboBox1KeyPress(Sender: TObject; var Key: Char);
    begin
      if key = '-' then
        key := #0;
    end;
      

  5.   

     ??? " onkeypress 里不可实现,因为如何也会在你的Combobox.text 上加上'+' 或'-'."helodd(可爱)的说法不对。idilent(不工作会发疯吗?) 的方法是正确的。
    procedure TForm1.ComboBox1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
     //189 is the key of - 
    //and you can use showmessage(inttostr(key))get the + key's number
      if key = 189 then
        key :=vk_down;  if key = 187 then
        key :=vk_up;
      
    end;
      

  6.   

    procedure TForm1.ComboBox1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
     //189 is the key of - 
    //and you can use showmessage(inttostr(key))get the + key's number
      if key = 189 then
        key :=vk_up;  if key = 187 then
        key :=vk_down;
      
    end;