winforms

information from exe file

拜拜、爱过 提交于 2021-02-08 07:51:34
问题 I have an exe file simpleservice.exe in the physical path F:\SAMPLEPRODUCT\Bin ,, i need to fetch version number of that exe file,,Can you give the code required to fetch the version number 回答1: I'd use the following to do this: Assembly.LoadFrom("...").GetName().Version.ToString(); or I'd use the FileVersionInfo class. Take your pick: FileVersionInfo.GetVersionInfo("..."); 回答2: You can use FileVersionInfo.GetVersionInfo for this Eg: public void GetFileVersion() { // Get the file version for

Scrolling two listboxes ( Windows Form ) at same time

夙愿已清 提交于 2021-02-08 07:04:49
问题 Basically I have two list boxes syncListView1 and syncListView2 on the Form ( windows form application ) Im trying to make their scrollbar sync I have googled some and i found this class but it does not seem to work : class SyncListBox : System.Windows.Forms.ListBox { [Category("Action")] private const int WM_HSCROLL = 0x114; private const int WM_VSCROLL = 0x115; public event ScrollEventHandler OnHorizontalScroll; public event ScrollEventHandler OnVerticalScroll; private const int SB_LINEUP =

c# Image and text on a button, centered in the button?

本秂侑毒 提交于 2021-02-08 06:46:38
问题 I have a button on a C# Windows Form form, and want to show an image and some text, side by side, and centered on the button. I tried aligning the image to the left and the text to the right, and I'm getting this (the periods are spaces): |[IMAGE}.................Text| But I want this: |........[IMAGE] Text........| My code looks like this: btnChangeStatus.Text = "Change status to SUPPRESSED"; btnChangeStatus.TextAlign = ContentAlignment.MiddleRight; btnChangeStatus.Image=Image.FromFile(@"J:

Self Delete Folder with scripts powershell

非 Y 不嫁゛ 提交于 2021-02-08 06:38:13
问题 I have been trying to have powershell or batch scripts delete a folder that contains all my scripts when I am finished. Originally I tried Remove-Item -Path "C:\Tool" -Recurse -Force which worked no problem if run as a script for a location outside of C:\Tool . It would complain the files were in use when run from a script within. After some research I found &cmd.exe /c rd /s /q "C:\Tool" which worked much better, but even though I closed the GUI, the command wouldn't delete the img files

Self Delete Folder with scripts powershell

我的梦境 提交于 2021-02-08 06:36:44
问题 I have been trying to have powershell or batch scripts delete a folder that contains all my scripts when I am finished. Originally I tried Remove-Item -Path "C:\Tool" -Recurse -Force which worked no problem if run as a script for a location outside of C:\Tool . It would complain the files were in use when run from a script within. After some research I found &cmd.exe /c rd /s /q "C:\Tool" which worked much better, but even though I closed the GUI, the command wouldn't delete the img files

How ConfigureAwait(false) Prevent Ui Deadlocks

对着背影说爱祢 提交于 2021-02-08 06:31:12
问题 I Know that this question has been asked endlessly, but still. I think i am missing somthing. When we want updating UI( WinForm UI for the sake of argument ) in asynchronously manner. But we cannot using the async /await keyword and we have to use the ConfigureAwait(false). As i understand it "Tells" the task that it can resume itself on any available thread instead of waiting to to the main thread. Its preventing the deadlock by free the UI for not waiting for the long process to be

How to add External .exe to my C# project?

倖福魔咒の 提交于 2021-02-08 06:27:35
问题 Can I add external .exe to my C# project so that i don't need any path to access it as outside app? I want to embed it as my project resource? Thanks in advance 回答1: You can add file by right-clicking on the project, or drag-n-drop works. You can add your exe in your solution and set its Build Action: Content and Copy to output Directory: Copy always . The installer should automatically include the file. Hope this helps 来源: https://stackoverflow.com/questions/51326810/how-to-add-external-exe

Mouse not working with Monogame in Winforms

十年热恋 提交于 2021-02-08 06:11:09
问题 I've embedded Monogame into a Windows Form using this code: private IntPtr drawSurface; private Control gameForm; public MapEditor(MainWindow window) { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.drawSurface = window.pcbViewport.Handle; graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings); Mouse.WindowHandle = drawSurface; gameForm = Control.FromHandle(this.Window.Handle); gameForm

Mouse not working with Monogame in Winforms

血红的双手。 提交于 2021-02-08 06:10:46
问题 I've embedded Monogame into a Windows Form using this code: private IntPtr drawSurface; private Control gameForm; public MapEditor(MainWindow window) { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.drawSurface = window.pcbViewport.Handle; graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings); Mouse.WindowHandle = drawSurface; gameForm = Control.FromHandle(this.Window.Handle); gameForm

Print the entire area of the control with C#

徘徊边缘 提交于 2021-02-08 05:48:17
问题 This is not a duplicat question- the diffenece beetween my question an the others one is my Controler contail a scroller, so they are more informations can't be printed. I have a C# application that contains a main form name MainForms . This MainForms has a control mainDisplay . I want to print the entire information what we found on the mainDisplay to the printer. The problem is the information on the the control is too big, and I have to scroll to see all information. Someone have any