场景
我有一个相当复杂的表单,用于数据输入或查看,不允许编辑,这取决于状态变量(表单上的颜色和标题会根据状态而变化)。它包含许多包含数据输入类型组件的面板。当处于查看(非编辑)状态时,这些面板被设置为禁用,因此防止它们包含的任何组件被更改。
一个面板包含四个 TRadioButtons 和一个带有滚动条的备忘录框。由于备忘录中的文本量很大,我仍然希望能够在查看模式下滚动备忘录框以便阅读所有内容。但是,我不希望更改备忘录文本或单选按钮。
我试过的
我没有禁用整个面板,而是将其保持启用状态,只是将备忘录框设为只读。这允许根据需要滚动但不能编辑备忘录。
但是,当面板启用时,这意味着单选按钮也已启用并且可以更改。
如果我将每个单选按钮的启用属性设置为 false,我可以防止它们根据需要进行更改,但这也会改变它们的外观并使它们变灰。
问题
如何防止用户更改此面板上的单选按钮,同时保持其外观不变,就好像它们已启用一样,即它们不会变灰?
最小的可重现示例
procedure TFrmMember.ShowMemberForm(MemberDisplayMode: TMemberDisplayType);
begin
case FormDisplayMode of
<other stuff in a big case statement depending upon MemberDisplayMode>
ShowNoEdit: begin
SetFormDisplay(ShowNoEdit); //set colours and titles etc
DisableAllControls; //disable all panels on the form
//now enable scrolling of the comment memo content but don't allow edits
PanelComment.Enabled := True; //enable the panel containing the memo and 4 radiobuttons
MemoComment.ReadOnly := True; //don't allow editing of the memo
//now disable the radio buttons -THIS CHANGES APPEARANCE ??
RadioButtonCircEmail.Enabled := False;
RadioButtonCircPost.Enabled := False;
RadioButtonCircBoth.Enabled := False;
RadioButtonCircNone.Enabled := False;
<other stuff>
end;
<other stuff in a big case statement depending upon MemberDisplayMode>
end; //case
end; //procedure ShowMemberForm