TabPage TabControl заполняется с использованием источника XML. Как только XML-содержимое загружено на TabPage, по обеим сторонам TabPage появляются две полосы прокрутки, позволяющие пользователю прокручивать.
Однако пользователь не может прокручивать с помощью колесика мыши. Я проверил свойства элемента управления TabPage, но не могу найти никаких свойств, которые могли бы помочь в этом.
Кто-то предложил обработать событие MouseWheel
или переопределить OnMouseWheel
, но я не уверен, как это можно применить.
Суть этого проста: как активировать прокрутку колеса мыши на вкладке?
public partial class ModifyTransformerContentsView : Form
{
private readonly ITransformerConfigurationViewModel ViewModel;
public ModifyTransformerContentsView(ITransformerConfigurationViewModel viewModel)
{
InitializeComponent();
this.ViewModel = viewModel;
this.ViewModel.Notify += this.OnNotify;
this.xmlEditExampleStdfOutFile.SetFormateText(File.ReadAllText(this.ViewModel.SampleProcessingFilePath));
this.xmlEditExampleStdfOutFile.ReadOnly = true;
this.rtbXsl.SetFormateText(File.ReadAllText(this.ViewModel.TransformerFilePath));
this.rtbXsl.ReadOnly = false;
this.rtbXsl.RichTextBox.ClearUndo();
this.btnSave.Enabled = false;
this.rtbCheatSheet.Text = File.ReadAllText(this.ViewModel.CheatSheetFilePath);
}
private void OnValidateClick(object sender, System.EventArgs e)
{
this.ViewModel.SetTemporaryTransformerFileContents(this.rtbXsl.Text);
this.ViewModel.ValidateXsl(this.rtbXsl.Text,
validationSuccessful =>
{
this.btnSave.Enabled = validationSuccessful;
this.rtbExampleOutputFileContents.SetFormateText(this.ViewModel.ExampleFileOutputContents);
});
}
private void OnSaveClick(object sender, System.EventArgs e) => this.ViewModel.Save(this.rtbXsl.Text);
private void OnNotify(NotificationEventArgs obj)
{
switch (obj.NotificationType)
{
case NotificationType.Info:
MessageBox.Show(obj.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (obj.Exit)
{
this.Close();
}
break;
case NotificationType.Warning:
MessageBox.Show(obj.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
break;
case NotificationType.Error:
MessageBox.Show(obj.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (obj.Exit)
{
this.Close();
}
break;
}
}
private void ModifyTransformerContentsView_FormClosing(object sender, FormClosingEventArgs e)
=> this.ViewModel.DeleteTemporaryModifiedTransformerFile();
private void OnButtonCheatSheetSaveClick(object sender, System.EventArgs e) =>
this.ViewModel.SaveCheatSheet(rtbCheatSheet.Text);
private void ModifyTransformerContentsView_Load(object sender, System.EventArgs e)
{
}
}
Любая помощь будет оценена.