Delphi 语句块《LceMeaning》

//输入事件中将字母设置为大写
  if Key in ['a'..'z'] then
    begin
      Key := UpperCase(key)[1];
    end;

 

//DBGrid排序方法
procedure TForm1.DBGridEh1TitleBtnClick(Sender: TObject; ACol: Integer;
  Column: TColumnEh);
begin
  if (pos('▲', Column.Title.Caption)=0) and (pos('▼', Column.Title.Caption)=0)  then  //说明前面没有排过序
    begin
       qryQuery.Sort := Column.FieldName+ ' ASC';   //asc一定要大写
       Column.Title.Caption := column.Title.Caption + '▼' ;
    end
  else
    if (pos('▲', Column.Title.Caption)=0) then //说明目前是降序
      begin
        qryQuery.Sort := Column.FieldName+' ASC';    // ↑占用了1个位
        Column.Title.Caption := copy(Column.Title.Caption,1,length(Column.Title.Caption)-1) + '▲';
      end
    else
      if (pos('▼', Column.Title.Caption)=0) then  //说明目前是升序
        begin
         qryQuery.Sort := Column.FieldName+' DESC';
         Column.Title.Caption := copy(Column.Title.Caption,1,length(Column.Title.Caption)-1) + '▼';
        end;
{  if Column.Title.SortMarker = smdowneh then
  begin
    qryQuery.Sort:=Column.FieldName + ' DESC';
  end
  else
  begin
    qryQuery.Sort:=Column.FieldName +' ASC';
  end;   }
end;

  

posted @ 2015-09-16 11:42  冰意 LceMeaning  阅读(318)  评论(0编辑  收藏  举报