This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
C# - Make a borderless form movable?
Drag borderless windows form by mouse
Ok, I have made a form with a control in it. The form is borderless. The control inside the form is called navigationPanel1. I want to be able to click and drag on the control to move the form. How do i do that?
You have to subscribe for the mouse-down, mouse-up and mouse-move events. In the mouse-move you set the location of your form to the new location (this u have to calculate). the code in mouse-move only should be executet if the mouse-button is down (save this state)
Related
This question already has answers here:
Determining when a WPF window is being moved
(3 answers)
Closed 7 years ago.
In need to get whether or not my WPF application's Window is currently in the process of being dragged or re-sized. I need to prevent a specific action from happening if this is the case.
I need to check if the window is currently in any situation where the mouse is being held down on the the part of the window that can preposition it.
I am assuming there is probably some information somewhere on the
Application.Current.MainWindow
property. Or maybe there is a few events that I need to keep track of to have this information.
Any ideas how I would do this? Thanks in advance.
Subscribe to the LocationChanged event.
Set the ResizeBegin and ResizeEnd event. They should both fire when the application is being moved, and disable your feature when Begin is called and until End finishes.
EDIT: Just realized this is WPF, in which case check this article: Determining when a WPF window is being moved
This question already has an answer here:
Winforms Button Right-Click visual feedback (Show button in pushed state)
(1 answer)
Closed 5 years ago.
I need to change the button background image when the button is pushed down. Can't figure it out. I've already done a button higlight effect. I'm working in Winforms.
Use MouseDown and MouseUp events to change the background image of the button. it should not be harder then the highlight effect.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I add transparency to a c# form while keeping controls visible?
I am working with C# form with panel1.
I have set Opacity=30% for Form1, But I reflect on panel1.
Any help me to by code to set Opacity 30% only on the form, not in panel1?
You cannot do that. The form's opacity is applied to the whole form, and it's children. Sorry - not possible with out-of-the-box C# functionality.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Detect change of resolution c# WinForms
I have an application written in C# where my window is docked to the edge of the screen.
I need to know where I can find the event if the resolution has changed so I can call the Dock method so I can repaint my window.
On the form object I can only see the SystemColorsChanged event.
You're looking for the SystemEvents.DisplaySettingsChanged event.
This question already has answers here:
Is there a way to make a UserControl unfocussable?
(6 answers)
Closed 8 years ago.
I want to be able to click on my user control and not have it steal focus from any other control. I know when you click on a label it doesn't steal focus. How can this be done?
Try disabling your control's ControlStyles.Selectable flag.