⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u_subjectcondition.pas

📁 一个简单的学籍管理软件
💻 PAS
字号:
unit U_SubjectCondition;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, Spin;

type
  TFm_SubjectCondition = class(TForm)
    Bevel1: TBevel;
    Btn_Ok: TButton;
    Btn_Cancel: TButton;
    RdBtn_All: TRadioButton;
    RdBtn_Order: TRadioButton;
    RdBtn_Score: TRadioButton;
    Label1: TLabel;
    SpEdit_Order: TSpinEdit;
    Label2: TLabel;
    SpEdit_Score: TSpinEdit;
    Label3: TLabel;
    procedure RdBtn_OrderClick(Sender: TObject);
    procedure RdBtn_AllKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
  public
  end;

function Show_SubjectCondition(var pCondCode, pConditions: integer; CondLimited: integer): Boolean;

implementation

uses DBTables, U_GlobalVar, U_DM, U_GlobalProc;
{$R *.DFM}

function Show_SubjectCondition(var pCondCode, pConditions: integer; CondLimited: integer): Boolean;
var
  Fm_SubjectCondition: TFm_SubjectCondition;
begin
  // pCondCode  0 -- 没有条件  1 -- 前 X 名  2 -- XX 分以上
  // pConditions  条件

  Result := False;
  Fm_SubjectCondition := TFm_SubjectCondition.Create(Application);
  with Fm_SubjectCondition do
  try
    case pCondCode of
      0: RdBtn_All.Checked := True;
      1:
      begin
        RdBtn_Order.Checked := True;
        SpEdit_Order.Value := pConditions;
      end;
      2:
      begin
        RdBtn_Score.Checked := True;
        SpEdit_Score.Value := pConditions;
      end;
    end;
    RdBtn_OrderClick(nil);
    SpEdit_Order.MaxValue := CondLimited;
    if ShowModal = mrOk then
    begin
      if RdBtn_All.Checked then
      begin
        pCondCode := 0;
        pConditions := 0;
      end else if RdBtn_Order.Checked then
      begin
        pCondCode := 1;
        pConditions := SpEdit_Order.Value;
      end else
      begin
        pCondCode := 2;
        pConditions := SpEdit_Score.Value;
      end;
      Result := True;
    end;
  finally
    Free;
  end;
end;

procedure TFm_SubjectCondition.RdBtn_OrderClick(Sender: TObject);
begin
  SpEdit_Order.Enabled := RdBtn_Order.Checked;
  Label1.Enabled := RdBtn_Order.Checked;
  Label2.Enabled := RdBtn_Order.Checked;

  SpEdit_Score.Enabled := RdBtn_Score.Checked;
  Label3.Enabled := RdBtn_Score.Checked;
end;

procedure TFm_SubjectCondition.RdBtn_AllKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin  //
  if Key = VK_RETURN then
  begin
    if Shift = [] then
      SelectNext(ActiveControl, True, True)
    else if Shift = [ssShift] then
      SelectNext(ActiveControl, False, True);
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -