我想禁用,並設置爲灰色,或設置爲只讀,一些任務複選框,正在此圖像中檢查複選框:ReadOnly或Disabled-Grayed Task複選框?
我不是在尋找其他種類的方法,我想讓這些任務可見,但使其複選框無法檢查,就這樣,用戶可以看到將要安裝的內容以及默認情況下受限制的內容。
我的安裝腳本是這樣的:
[Tasks]
; VS Optional Features
Name: blend; Description: Blend; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: foundationclass; Description: Microsoft Foundation Classes for C++; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: lightswitch; Description: Microsoft LightSwitch; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: officedevelopertools; Description: Microsoft Office Developer Tools; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: sqldatatools; Description: Microsoft SQL Server Data Tools; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: webdevelopertools; Description: Microsoft Web Developer Tools; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: silverlightsdk; Description: SilverLight Developer Kit; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: Win8SDK; Description: Tools For Maintaining Store Apps For Windows 8; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: WindowsPhone80; Description: Windows Phone 8.0 SDK; GroupDescription: VS Optional Features:; Flags: Unchecked
; VS Hidden Features
Name: netfx4; Description: .NET FX 4; GroupDescription: VS Hidden Features:
Name: netfx45; Description: .NET FX 4.5; GroupDescription: VS Hidden Features:
Name: bliss; Description: Bliss; GroupDescription: VS Hidden Features:
Name: helpviewer; Description: Microsoft Help Viewer 2.1; GroupDescription: VS Hidden Features:
Name: portablelibrary; Description: Microsoft Portable Library Multi-Targeting Pack; GroupDescription: VS Hidden Features:
Name: report; Description: Microsoft Report Viewer Add-On for Visual Studio 2013; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: silverlight; Description: Microsoft Silverlight 5 SDK; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqldac; Description: Microsoft SQL DAC; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqldom; Description: Microsoft SQL DOM; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqllocaldb; Description: Microsoft SQL Server 2013 Express LocalDB; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqlmanagementobjects; Description: Microsoft SQL Server 2013 Management Objects; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqlclr; Description: Microsoft SQL Server 2013 System CLR Types; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqltran; Description: Microsoft SQL Server 2013 Transact-SQL; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqlce; Description: Microsoft SQL Server Compact Edition; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_compilers; Description: Microsoft Visual C++ 2013 Compilers; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_core; Description: Microsoft Visual C++ 2013 Core Libraries; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_debug; Description: Microsoft Visual C++ 2013 Debug Runtime; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_designtime; Description: Microsoft Visual C++ 2013 Designtime; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_extendedlibraries; Description: Microsoft Visual C++ 2013 Extended Libraries; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: intellitrace; Description: Microsoft Visual Studio 2013 IntelliTrace; GroupDescription: VS Hidden Features:
Name: storyboarding; Description: Microsoft Visual Studio Team Foundation Server 2013 Storyboarding; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sdk3; Description: SDK Tools 3; GroupDescription: VS Hidden Features:
Name: sdk4; Description: SDK Tools 4; GroupDescription: VS Hidden Features:
Name: analytics; Description: Visual Studio Analytics; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: dotfuscator; Description: Visual Studio Dotfuscator; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: javascript; Description: Visual Studio Extensions for Windows Library for JavaScript; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: profiler; Description: Visual Studio Profiler; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: winsdk; Description: Windows Software Development Kit; GroupDescription: VS Hidden Features:; Flags: Unchecked
這是可能做到?
我沒有找到任何可以幫助我這樣做的任務標誌,另一方面,我在StackOverflow中看到過其他問題,但與只讀複選框有關,它使用pascal腳本代碼,我是不是pascal腳本代碼,我不確定這是否是我需要做的,因爲我沒有手動創建和實例化表單中的複選框,我的意思是我沒有任何控制這些複選框+標籤,我只是在Task
部分添加任務。
UPDATE
我用的是pascal腳本代碼以下禁用所需的項目,但是當我跑我安裝我得到這個錯誤,它說,該指數是出界,爲什麼?,我正在使用正確的chekbox索引,並且我已驗證索引正在查看生成的任務頁面...我認爲問題是wpSelectTasks,它是一個集成的常量?,反正我試圖指定一個與任務頁面的pagenumber不變,我仍然得到相同的錯誤,並且當我使用'Next'按鈕(而不是'Back')更改選定頁面時發生錯誤:
// Disable Tasks
procedure CurPageChanged(CurPageID: Integer);
begin
// if we have entered the tasks selection page, disable the specified Tasks.
if CurPageID = wpSelectTasks then
WizardForm.TasksList.ItemEnabled[11] := False;
WizardForm.TasksList.ItemEnabled[12] := False;
WizardForm.TasksList.ItemEnabled[13] := False;
WizardForm.TasksList.ItemEnabled[14] := False;
WizardForm.TasksList.ItemEnabled[15] := False;
WizardForm.TasksList.ItemEnabled[30] := False;
WizardForm.TasksList.ItemEnabled[32] := False;
WizardForm.TasksList.ItemEnabled[33] := False;
end;
// Disable Tasks - END
我對UI定製更多的代碼,我不知道是否有些東西是與其他程序衝突,整個[Code]
部分是這樣的:
[Code]
// Disable Tasks
procedure CurPageChanged(CurPageID: Integer);
begin
// if we have entered the tasks selection page, disable the specified Tasks.
if CurPageID = wpSelectTasks then
WizardForm.TasksList.ItemEnabled[11] := False;
WizardForm.TasksList.ItemEnabled[12] := False;
WizardForm.TasksList.ItemEnabled[13] := False;
WizardForm.TasksList.ItemEnabled[14] := False;
WizardForm.TasksList.ItemEnabled[15] := False;
WizardForm.TasksList.ItemEnabled[30] := False;
WizardForm.TasksList.ItemEnabled[32] := False;
WizardForm.TasksList.ItemEnabled[33] := False;
end;
// Disable Tasks - END
// Installer UI Customizations
const
Custom_Height = 570;
Page_Color = $7b2b68;
Page_Color_Alternative1 = clblack;
Page_Color_Alternative2 = clwhite;
Font_Color = $fffbff;
var
DefaultTop,
DefaultLeft,
DefaultHeight,
DefaultBackTop,
DefaultNextTop,
DefaultCancelTop,
DefaultBevelTop,
DefaultOuterHeight: Integer;
procedure InitializeWizard();
begin
DefaultTop := WizardForm.Top;
DefaultLeft := WizardForm.Left;
DefaultHeight := WizardForm.Height;
DefaultBackTop := WizardForm.BackButton.Top;
DefaultNextTop := WizardForm.NextButton.Top;
DefaultCancelTop := WizardForm.CancelButton.Top;
DefaultBevelTop := WizardForm.Bevel.Top;
DefaultOuterHeight := WizardForm.OuterNotebook.Height;
// Page sizes
WizardForm.Height := Custom_Height;
WizardForm.InnerPage.Height := WizardForm.InnerPage.Height + (Custom_Height - DefaultHeight);
WizardForm.LicensePage.Height := WizardForm.LicensePage.Height + (Custom_Height - DefaultHeight);
// Control locations
WizardForm.BackButton.Top := DefaultBackTop + (Custom_Height - DefaultHeight);
WizardForm.Bevel.Top := DefaultBevelTop + (Custom_Height - DefaultHeight);
WizardForm.CancelButton.Top := DefaultCancelTop + (Custom_Height - DefaultHeight);
WizardForm.LicenseAcceptedRadio.Top := WizardForm.LicenseAcceptedRadio.Top + (Custom_Height - DefaultHeight);
WizardForm.LicenseNotAcceptedRadio.Top := WizardForm.LicenseNotAcceptedRadio.Top + (Custom_Height - DefaultHeight);
WizardForm.NextButton.Top := DefaultNextTop + (Custom_Height - DefaultHeight);
WizardForm.Top := DefaultTop - (Custom_Height - DefaultHeight) div 2;
// Control Sizes
WizardForm.InfoBeforeMemo.Height := (Custom_Height - (DefaultHeight/2));
WizardForm.InnerNotebook.Height := WizardForm.InnerNotebook.Height + (Custom_Height - DefaultHeight);
WizardForm.LicenseMemo.Height := WizardForm.LicenseMemo.Height + (Custom_Height - DefaultHeight);
WizardForm.OuterNotebook.Height := WizardForm.OuterNotebook.Height + (Custom_Height - DefaultHeight);
WizardForm.Taskslist.Height := (Custom_Height - (DefaultHeight/2));
WizardForm.WizardBitmapImage.Height := (Custom_Height - (DefaultHeight/5));
// Page colos
WizardForm.color := Page_Color_Alternative1;
WizardForm.FinishedPage.Color := Page_Color;
WizardForm.InfoBeforeMemo.Color := clGray;
WizardForm.InnerPage.Color := Page_Color;
WizardForm.LicensePage.Color := Page_Color;
WizardForm.MainPanel.Color := Page_Color;
WizardForm.SelectComponentsPage.Color := Page_Color;
WizardForm.SelectDirPage.Color := Page_Color;
WizardForm.Taskslist.Color := Page_Color;
WizardForm.WelcomePage.color := Page_Color;
// Font colors
WizardForm.Font.color := Font_Color;
//WizardForm.InfoBeforeMemo.font.Color := Font_Color;
WizardForm.Licensememo.font.Color := Font_Color;
WizardForm.MainPanel.font.Color := Font_Color;
WizardForm.PageDescriptionLabel.font.color := Font_Color;
WizardForm.PageNameLabel.font.color := Font_Color;
WizardForm.Taskslist.font.Color := Font_Color;
WizardForm.WelcomeLabel1.font.color := Font_Color;
WizardForm.WelcomeLabel2.font.color := Font_Color;
end;
// Installer UI Customizations - END
我可以找到的唯一方法(源代碼)是['this'](http://stackoverflow.com/a/25866202/960757)(在該行下)。 – TLama 2014-10-07 01:27:17
@TLama謝謝你!現在我可以禁用指定的項目,但由於此代碼而導致出現錯誤,請問您能否看到我的問題更新? – ElektroStudios 2014-10-07 03:45:45
好吧,如果塊需要一個開始/結束運營商,這種語言是奇怪的,因爲我看到其他如果塊沒有開始/結束似乎工作。 @TLama請隨時張貼答案將其標記爲已接受,再次感謝 – ElektroStudios 2014-10-07 04:23:12