Backup/MyFriends/Win32/CommonDialog.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
 * Displays the common Open and SaveAs dialogs using the Vista-style dialogs.
 * This is accomplished by pinvoking GetOpenFileName and GetSaveFileName and 
 * not specifying a hook. The .NET Microsoft.Win32 OpenFileDialog and 
 * SaveFileDialog classes display the old-style instead of the new Vista-style 
 * dialogs.
 * 
 * If a hook is required, see the Vista Bridge sample at 
 * http://msdn2.microsoft.com/en-us/library/ms756482.aspx that contains 
 * managed wrappers for a number of new Windows Vista APIs, including 
 * IFileDialog, IFileOpenDialog and IFileSaveDialog.
*/

using System;
using System.Windows;
using System.Windows.Interop;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace MyFriends
{
    /// <summary>
    /// One item in the common dialog filter.
    /// </summary>
    public class FilterEntry
    {
        private string display;
        private string extention;

        public string Display
        {
            get { return display; }
        }

        public string Extention
        {
            get { return extention; }
        }

        public FilterEntry(string display, string extension)
        {
            this.display = display;
            this.extention = extension;
        }
    }

    /// <summary>
    /// 使用可视化样式显示打开文件对话框和保存文件对话框
    /// </summary>
    class CommonDialog
    {
        #region fields

        // Structure used when displaying Open and SaveAs dialogs.
        private OpenFileName ofn = new OpenFileName();

        // List of filters to display in the dialog.
        private List<FilterEntry> filter = new List<FilterEntry>();

后面还有 148 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。