• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IFileDialog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IFileDialog的典型用法代码示例。如果您正苦于以下问题:C# IFileDialog类的具体用法?C# IFileDialog怎么用?C# IFileDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IFileDialog类属于命名空间,在下文中一共展示了IFileDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnFileOk

 public HRESULT OnFileOk(IFileDialog pfd)
 {
     if( _dialog.DoFileOk(pfd) )
         return HRESULT.S_OK;
     else
         return HRESULT.S_FALSE;
 }
开发者ID:divyang4481,项目名称:lextudio,代码行数:7,代码来源:VistaFileDialogEvents.cs


示例2: OnTypeChange

 public void OnTypeChange(IFileDialog pfd)
 {
 }
开发者ID:MotorViper,项目名称:FormGenerator,代码行数:3,代码来源:WPFFolderBrowserDialog.cs


示例3: OnSelectionChange

 public void OnSelectionChange(IFileDialog pfd)
 {
 }
开发者ID:MotorViper,项目名称:FormGenerator,代码行数:3,代码来源:WPFFolderBrowserDialog.cs


示例4: OnFolderChanging

 public HRESULT OnFolderChanging(IFileDialog pfd, IShellItem psiFolder)
 {
     return HRESULT.S_OK;
 }
开发者ID:MotorViper,项目名称:FormGenerator,代码行数:4,代码来源:WPFFolderBrowserDialog.cs


示例5: OnOverwrite

 public void OnOverwrite(IFileDialog pfd, IShellItem psi, out NativeMethods.FDE_OVERWRITE_RESPONSE pResponse)
 {
     // TODO: Implement overwrite notification support
     pResponse = NativeMethods.FDE_OVERWRITE_RESPONSE.FDEOR_ACCEPT;
 }
开发者ID:ssickles,项目名称:archive,代码行数:5,代码来源:CommonFileDialog.cs


示例6: OnSelectionChange

 public void OnSelectionChange(IFileDialog pfd)
 {
     parent.OnSelectionChanged(EventArgs.Empty);
 }
开发者ID:ssickles,项目名称:archive,代码行数:4,代码来源:CommonFileDialog.cs


示例7: OnFolderChanging

 public HRESULT OnFolderChanging(IFileDialog pfd, IShellItem psiFolder)
 {
     CommonFileDialogFolderChangeEventArgs args =
         new CommonFileDialogFolderChangeEventArgs(parent.GetFileNameFromShellItem(psiFolder));
     if (!firstFolderChanged)
         parent.OnFolderChanging(args);
     return (args.Cancel ? HRESULT.S_FALSE : HRESULT.S_OK);
 }
开发者ID:ssickles,项目名称:archive,代码行数:8,代码来源:CommonFileDialog.cs


示例8: SyncFileTypeComboToDefaultExtension

        /// <summary>
        /// Tries to set the File(s) Type Combo to match the value in 
        /// 'DefaultExtension'.  Only doing this if 'this' is a Save dialog 
        /// as it makes no sense to do this if only Opening a file.
        /// </summary>
        /// 
        /// <param name="dialog">The native/IFileDialog instance.</param>
        /// 
        private void SyncFileTypeComboToDefaultExtension(IFileDialog dialog)
        {
            if (DefaultExtension == null ||
                filters.Count <= 0)
            {
                return;
            }

            CommonFileDialogFilter filter = null;

            for (uint filtersCounter = 0; filtersCounter < filters.Count; filtersCounter++)
            {
                filter = (CommonFileDialogFilter)filters[(int)filtersCounter];

                if (filter.Extensions.Contains(DefaultExtension))
                {
                    // set the docType combo to match this 
                    // extension. property is a 1-based index.
                    dialog.SetFileTypeIndex(filtersCounter + 1);

                    // we're done, exit for
                    break;
                }
            }

        }
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:34,代码来源:CommonFileDialog.cs


示例9: OnOverwrite

 public void OnOverwrite(IFileDialog pfd, IShellItem psi, out ShellNativeMethods.FileDialogEventOverwriteResponse pResponse)
 {
     // Don't accept or reject the dialog, keep default settings
     pResponse = ShellNativeMethods.FileDialogEventOverwriteResponse.Default;
 }
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:5,代码来源:CommonFileDialog.cs


示例10: OnShareViolation

 public void OnShareViolation(
     IFileDialog pfd,
     IShellItem psi,
     out ShellNativeMethods.FileDialogEventShareViolationResponse pResponse)
 {
     // Do nothing: we will ignore share violations, 
     // and don't register
     // for them, so this method should never be called.
     pResponse = ShellNativeMethods.FileDialogEventShareViolationResponse.Accept;
 }
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:10,代码来源:CommonFileDialog.cs


示例11: OnFolderChanging

            public HResult OnFolderChanging(IFileDialog pfd, IShellItem psiFolder)
            {
                CommonFileDialogFolderChangeEventArgs args = new CommonFileDialogFolderChangeEventArgs(
                    CommonFileDialog.GetFileNameFromShellItem(psiFolder));

                if (!firstFolderChanged) { parent.OnFolderChanging(args); }

                return (args.Cancel ? HResult.False : HResult.Ok);
            }
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:9,代码来源:CommonFileDialog.cs


示例12: OnFileOk

            public HResult OnFileOk(IFileDialog pfd)
            {
                CancelEventArgs args = new CancelEventArgs();
                parent.OnFileOk(args);

                if (!args.Cancel)
                {
                    // Make sure all custom properties are sync'ed
                    if (parent.Controls != null)
                    {
                        foreach (CommonFileDialogControl control in parent.Controls)
                        {
                            CommonFileDialogTextBox textBox;
                            CommonFileDialogGroupBox groupBox; ;

                            if ((textBox = control as CommonFileDialogTextBox) != null)
                            {
                                textBox.SyncValue();
                                textBox.Closed = true;
                            }
                            // Also check subcontrols
                            else if ((groupBox = control as CommonFileDialogGroupBox) != null)
                            {
                                foreach (CommonFileDialogControl subcontrol in groupBox.Items)
                                {
                                    CommonFileDialogTextBox textbox = subcontrol as CommonFileDialogTextBox;
                                    if (textbox != null)
                                    {
                                        textbox.SyncValue();
                                        textbox.Closed = true;
                                    }
                                }
                            }
                        }
                    }
                }

                return (args.Cancel ? HResult.False : HResult.Ok);
            }
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:39,代码来源:CommonFileDialog.cs


示例13: GetCustomizedFileDialog

 /// <summary>
 /// Get the IFileDialogCustomize interface, preparing to add controls.
 /// </summary>
 private void GetCustomizedFileDialog()
 {
     if (customize == null)
     {
         if (nativeDialog == null)
         {
             InitializeNativeFileDialog();
             nativeDialog = GetNativeFileDialog();
         }
         customize = (IFileDialogCustomize)nativeDialog;
     }
 }
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:15,代码来源:CommonFileDialog.cs


示例14: GetResult

 private void GetResult(IFileDialog dialog)
 {
     IShellItem item;
     dialog.GetResult(out item);
     item.GetDisplayName(NativeMethods.SIGDN.SIGDN_FILESYSPATH, out _selectedPath);
 }
开发者ID:divyang4481,项目名称:lextudio,代码行数:6,代码来源:clsFolderBrowserDialog.cs


示例15: IsOptionSet

        private bool IsOptionSet(IFileDialog dialog, NativeMethods.FOS flag)
        {
            NativeMethods.FOS currentFlags = GetCurrentOptionFlags(dialog);

            return (currentFlags & flag) == flag;
        }
开发者ID:ssickles,项目名称:archive,代码行数:6,代码来源:CommonFileDialog.cs


示例16: GetCurrentOptionFlags

 internal NativeMethods.FOS GetCurrentOptionFlags(IFileDialog dialog)
 {
     NativeMethods.FOS currentFlags;
     dialog.GetOptions(out currentFlags);
     return currentFlags;
 }
开发者ID:ssickles,项目名称:archive,代码行数:6,代码来源:CommonFileDialog.cs


示例17: OnFolderChange

 public void OnFolderChange(IFileDialog pfd)
 {
     if (firstFolderChanged)
     {
         firstFolderChanged = false;
         parent.OnOpening(EventArgs.Empty);
     }
     else
         parent.OnFolderChanged(EventArgs.Empty);
 }
开发者ID:ssickles,项目名称:archive,代码行数:10,代码来源:CommonFileDialog.cs


示例18: OnTypeChange

 public void OnTypeChange(IFileDialog pfd)
 {
     parent.OnFileTypeChanged(EventArgs.Empty);
 }
开发者ID:ssickles,项目名称:archive,代码行数:4,代码来源:CommonFileDialog.cs


示例19: OnFileOk

 public HRESULT OnFileOk(IFileDialog pfd)
 {
     CancelEventArgs args = new CancelEventArgs();
     return (args.Cancel ? HRESULT.S_FALSE : HRESULT.S_OK);
 }
开发者ID:MotorViper,项目名称:FormGenerator,代码行数:5,代码来源:WPFFolderBrowserDialog.cs


示例20: ApplyNativeSettings

        private void ApplyNativeSettings(IFileDialog dialog)
        {
            Debug.Assert(dialog != null, "No dialog instance to configure");

            if (parentWindow == IntPtr.Zero)
            {
                if (System.Windows.Application.Current != null && System.Windows.Application.Current.MainWindow != null)
                {
                    parentWindow = (new WindowInteropHelper(System.Windows.Application.Current.MainWindow)).Handle;
                }
                else if (System.Windows.Forms.Application.OpenForms.Count > 0)
                {
                    parentWindow = System.Windows.Forms.Application.OpenForms[0].Handle;
                }
            }

            Guid guid = new Guid(ShellIIDGuid.IShellItem2);

            // Apply option bitflags.
            dialog.SetOptions(CalculateNativeDialogOptionFlags());

            // Other property sets.
            if (title != null) { dialog.SetTitle(title); }

            if (initialDirectoryShellContainer != null)
            {
                dialog.SetFolder(((ShellObject)initialDirectoryShellContainer).NativeShellItem);
            }

            if (defaultDirectoryShellContainer != null)
            {
                dialog.SetDefaultFolder(((ShellObject)defaultDirectoryShellContainer).NativeShellItem);
            }

            if (!string.IsNullOrEmpty(initialDirectory))
            {
                // Create a native shellitem from our path
                IShellItem2 initialDirectoryShellItem;
                ShellNativeMethods.SHCreateItemFromParsingName(initialDirectory, IntPtr.Zero, ref guid, out initialDirectoryShellItem);

                // If we get a real shell item back, 
                // then use that as the initial folder - otherwise,
                // we'll allow the dialog to revert to the default folder. 
                // (OR should we fail loudly?)
                if (initialDirectoryShellItem != null)
                    dialog.SetFolder(initialDirectoryShellItem);
            }

            if (!string.IsNullOrEmpty(defaultDirectory))
            {
                // Create a native shellitem from our path
                IShellItem2 defaultDirectoryShellItem;
                ShellNativeMethods.SHCreateItemFromParsingName(defaultDirectory, IntPtr.Zero, ref guid, out defaultDirectoryShellItem);

                // If we get a real shell item back, 
                // then use that as the initial folder - otherwise,
                // we'll allow the dialog to revert to the default folder. 
                // (OR should we fail loudly?)
                if (defaultDirectoryShellItem != null)
                {
                    dialog.SetDefaultFolder(defaultDirectoryShellItem);
                }
            }

            // Apply file type filters, if available.
            if (filters.Count > 0 && !filterSet)
            {
                dialog.SetFileTypes(
                    (uint)filters.Count,
                    filters.GetAllFilterSpecs());

                filterSet = true;

                SyncFileTypeComboToDefaultExtension(dialog);
            }

            if (cookieIdentifier != Guid.Empty)
            {
                dialog.SetClientGuid(ref cookieIdentifier);
            }

            // Set the default extension
            if (!string.IsNullOrEmpty(DefaultExtension))
            {
                dialog.SetDefaultExtension(DefaultExtension);
            }

            // Set the default filename
            dialog.SetFileName(DefaultFileName);
        }
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:90,代码来源:CommonFileDialog.cs



注:本文中的IFileDialog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IFileDialogCustomize类代码示例发布时间:2022-05-24
下一篇:
C# IFileAbstraction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap