LoadPreviewEventArgsCustomPreviewHandler Property |
Namespace: Jam.Shell
class CustomPreviewHandler : IShellPreviewHandler { private TextBox m_TextBox; public bool Load(ShellFilePreview parent, string p_Path, ItemIdList p_AbsolutePidl) { m_TextBox = new TextBox(); m_TextBox.Dock = DockStyle.Fill; m_TextBox.Parent = parent; m_TextBox.WordWrap = false; m_TextBox.ScrollBars = ScrollBars.Both; m_TextBox.Multiline = true; m_TextBox.Text = System.IO.File.ReadAllText(p_Path); parent.Controls.Add(m_TextBox); return true; } public void Show() { } public void Unload() { m_TextBox.Dispose(); } public void Resize() { //nothing to do. } } private void shellFilePreview1_LoadPreview(object sender, LoadPreviewEventArgs e) { string file = e.Path; if (String.IsNullOrEmpty(file)) { return; } if (".cs".Equals(System.IO.Path.GetExtension(file), StringComparison.OrdinalIgnoreCase)) { e.CustomPreviewHandler = new CustomPreviewHandler(); } else if (e.PreviewHandlerGuid == null) { //add actions to take if no registered PreviewHandler is available. } }