openfiledialog

How to prevent GetOpenFileName from changing the current directory while the dialog is shown?

为君一笑 提交于 2021-02-20 04:26:06
问题 GetOpenFileName (for questionable reasons) changes the current directory of an application while the dialog is shown. This can be reset on dialog closure by specifying OFN_NOCHANGEDIR as dialog initialization flag: OFN_NOCHANGEDIR Restores the current directory to its original value if the user changed the directory while searching for files. Setting this flag, however, doesn't prevent the function from changing the current directory while the explorer dialog is shown . This is an issue in

OpenFileDialog Multiselect problem

心不动则不痛 提交于 2021-02-19 01:17:30
问题 I have standart OpenFileDialog var openFileDialog = new OpenFileDialog { DefaultExt = "mpo", Filter = "Image file |*.mpo", Multiselect = true, RestoreDirectory = true, }; and when i try to use it to open several photos on " fujifilm finepix real 3d w1 " photo camera it fires message box " Cannot open multiple items from this location. Try selecting a single item instead. " Opening only 1 file is ok. When i try to select photos from hard drive or other removable device everything is ok. Anyone

How to draw multiple rectangles with mouse on an image?

点点圈 提交于 2021-02-13 05:46:15
问题 I am trying to build a WinForm application that will load an image file from an openfiledialog and load it into either a panel or picturebox. I want to be able to draw multiple rectangles with the left mouse button and have them stay on the image. I have been successful in getting a single rectangle at a time on the actual form but not on an image inside a panel/picturebox. Does anyone know of a resource that would help me understand how to achieve this? This is the code that allows me to

How to draw multiple rectangles with mouse on an image?

人走茶凉 提交于 2021-02-13 05:42:35
问题 I am trying to build a WinForm application that will load an image file from an openfiledialog and load it into either a panel or picturebox. I want to be able to draw multiple rectangles with the left mouse button and have them stay on the image. I have been successful in getting a single rectangle at a time on the actual form but not on an image inside a panel/picturebox. Does anyone know of a resource that would help me understand how to achieve this? This is the code that allows me to

OpenFileDialog causes WPF app to crash

狂风中的少年 提交于 2021-01-28 06:19:52
问题 In my WPF Application I used OpenFileDialog to select an image and load it to app, this works fine as expected. But if I run same app from a flash drive, image loades after that UI freezes, any clicks on UI makes app to crash. I have admin manifest to app also. 回答1: I couldn't find a good explanation but I solved this problem setting the InitialDirectory with a valid local path (e.g., Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) 回答2: I've seen something similar to this

How can I get TK buttons, generated by a for loop, to pass input to their command? (Python)

岁酱吖の 提交于 2021-01-28 05:36:40
问题 I have a program which dynamically generates a GUI. I don't know how many buttons I will have, if any at all. The specific problem is something like this: for varname in self.filetextboxes: if self.varDict[varname]=='': self.varDict[varname] = (StringVar(),) self.varDict[varname][0].set('') fileButton = Button(self, text=" ", command = lambda:self.varDict[varname][0].set(tkFileDialog.askopenfilename()), image=self.filephoto) ftb = Entry(self, textvariable = self.varDict[varname][0],width=40

ValueError: Invalid file path or buffer object type: <class 'tkinter.StringVar'>

被刻印的时光 ゝ 提交于 2020-12-12 04:53:03
问题 Here is a simplified version of some code that I have. In the first frame, the user selects a csv file using 'tk.filedialog' and it is meant to be plotted on the same frame on the canvas. There is also a second frame that is capable of plotting the graph in case it is easier to do it across a different frame. Running this version of the code results in the error: "ValueError: Invalid file path or buffer object type: ". I am not sure how to get this code to work without this problem occurring,

C# WPF property grid file browser

醉酒当歌 提交于 2020-08-08 05:18:30
问题 I have a property grid connected with public class properties. As I have seen in many solutions by adding an EditorAttribute I should be able to use a file browser: public class properties { public properties() { PartProgramConfigurationFilename = "Unknow"; } [Category("File")] // BELOW CUSTOM EDITOR [EditorAttribute(typeof(System.Windows.Forms.FileDialog), typeof(System.Drawing.Design.UITypeEditor))] [Description("Description"), DisplayName("PP configuration filename")] public string

File Dialog error access VBA

送分小仙女□ 提交于 2020-06-17 12:51:40
问题 I am trying to have the file dialog box pop up so the user can select a file path to export a file in VBA but for some reason it throws this error on the following line of code. Error: Method 'FileDialog' of object '_Application' failed Code: longResult = Application.FileDialog(msoFileDialogFolderPicker).Show All Code: If choice = 6 Then Dim intResult As Long Dim strPath As String 'the dialog is displayed to the user longResult = Application.FileDialog(msoFileDialogFolderPicker).Show 'checks