winforms

Change Border Color of NumericUpDown

浪子不回头ぞ 提交于 2021-02-15 06:51:36
问题 I am very new to C#, and have a question. I have been able to change the border colors of buttons and such by changing their FlatStyle to "Flat". With the NumericUpDown , I can't change the FlatStyle. I would like to still be able to use the up and down arrows, so just using something else to cover the edges will not work. Here is a simplified version of what I'm doing in my code: using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using

How can I add a Bing Maps Component to my C# Winforms app?

两盒软妹~` 提交于 2021-02-13 17:26:23
问题 I have downloaded, installed, and referenced the Bing Maps control in my Winforms app: ...and I added the following using to Form1.cs: using Microsoft.Maps.MapControl; ...but I still have no Bing Maps control in my Toolbox. I realize this is a WPF control, and I'm using Winforms, but my understanding is that the WPF control can be used in a Winforms app. My question is: How can I make the Bing Maps control visible in the Toolbox OR create the Bing Maps control in code? It probably doesn't

How can I add a Bing Maps Component to my C# Winforms app?

早过忘川 提交于 2021-02-13 17:24:11
问题 I have downloaded, installed, and referenced the Bing Maps control in my Winforms app: ...and I added the following using to Form1.cs: using Microsoft.Maps.MapControl; ...but I still have no Bing Maps control in my Toolbox. I realize this is a WPF control, and I'm using Winforms, but my understanding is that the WPF control can be used in a Winforms app. My question is: How can I make the Bing Maps control visible in the Toolbox OR create the Bing Maps control in code? It probably doesn't

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

Is it possible to avoid multiple button clicks on a Winform?

我的梦境 提交于 2021-02-12 11:18:42
问题 Suppose you have a button on a form that counts to 1000 in a textbox and then clears it. If I quickly click the button five times (in runtime) the Click event handler will be called 5 times and I will see the count to 1000 five times. Is it possible to disable other clicks on that button while the first click is counting? Note: Disabling the button in the first statement of the click handler and then re-enabling at the end does not work. Also, unsubscribing/subscribing to the click event (the

How to Invoke MessageBox on background thread in VB.NET?

拜拜、爱过 提交于 2021-02-11 18:15:40
问题 How do I call Invoke to run MessageBox.Show on my background thread please? When I display a MessageBox on my single background thread, it usually displays behind the main form, so to make the program usable I need to display it in front of the main form. My current code is MessageBox.Show(myMessageText, myTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) without owner. This code is not called from the form itself. but from a helper class I have built outside it. I want to add an owner

Winforms: What Determines if Docking Moves Other Controls

夙愿已清 提交于 2021-02-11 17:58:06
问题 For example, within a TabPage, I have a DataGridView that is docked "Fill". If I set the dock property of a UserControl to the the "Right" position, the DataGridView moves to the left as expected. If I replace the UserControl with a Panel or Label (also docked to the "Right" within the TabPage) the DataGridView does not make room. The Panel or Label just overlay the DataGridView. I tried stackoverflow and did some reading but did not see any rules (yet). Thanks. 回答1: Their Z-order. You can

Winforms: What Determines if Docking Moves Other Controls

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-11 17:57:20
问题 For example, within a TabPage, I have a DataGridView that is docked "Fill". If I set the dock property of a UserControl to the the "Right" position, the DataGridView moves to the left as expected. If I replace the UserControl with a Panel or Label (also docked to the "Right" within the TabPage) the DataGridView does not make room. The Panel or Label just overlay the DataGridView. I tried stackoverflow and did some reading but did not see any rules (yet). Thanks. 回答1: Their Z-order. You can

How to set cursor position at end of text while open notepad (log file)?

不打扰是莪最后的温柔 提交于 2021-02-11 17:37:45
问题 In my application, i add/append exception log in notepad and now logs are too big so to make it user friendly i decide to set cursor position at end of text of log file so when user click on "View Log" button from application s/he can show most recent log. So to avoid scrolling i want to set cursor at last. Currently i am simply using : Process.Start("notepad.exe",Path) to open log file. 回答1: Once Notepad is started, find its window. You can use user32.dll.FindWindow. Use SendMessage to send