Sorry for reposting this question, but I did not get a single answer last
time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped onto a form in my
application when it is running. I allow it to be clicked and dragged to a
new location on the form. However, the user control has a check box on it,
and if the user clicks over the checkbox to drag the user control, the check
box changes state.
Is there a way that I can simulate the design mode effect of the VS IDE,
such that whilst designing a form controls do not behave in the normal way?
The same problem occurs if clicking over a dropdown list: the list drops
down and then the control can be dragged away from under it. It doesn't look
very good.
It would be nice to stop all mouse effects on the member controls of my user
control, for example, checkboxes with the popup style change their
appearance when the mouse moves over them, but I would like to suppress this
whilst my user control is in 'design mode'.
Just to clarify, although I use the term 'design mode' my application is
actually running. I am just referring to the state in which it is running,
that is I allow users to design a simple form and then turn design mode off,
whereupon the form should behave normally.
TIA
Charles 5 3661
Me.Capture = True
This will keep all of your controls from receiving any mouse messages.
You'll have to move any controls in the Forms mouse move events.
Charles Law wrote: Sorry for reposting this question, but I did not get a single answer last time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped onto a form in my application when it is running. I allow it to be clicked and dragged to a new location on the form. However, the user control has a check box on it, and if the user clicks over the checkbox to drag the user control, the check box changes state.
Is there a way that I can simulate the design mode effect of the VS IDE, such that whilst designing a form controls do not behave in the normal way? The same problem occurs if clicking over a dropdown list: the list drops down and then the control can be dragged away from under it. It doesn't look very good.
It would be nice to stop all mouse effects on the member controls of my user control, for example, checkboxes with the popup style change their appearance when the mouse moves over them, but I would like to suppress this whilst my user control is in 'design mode'.
Just to clarify, although I use the term 'design mode' my application is actually running. I am just referring to the state in which it is running, that is I allow users to design a simple form and then turn design mode off, whereupon the form should behave normally.
TIA
Charles
Hi yEaH rIgHt
Thanks for the idea. I have just tried it and it all behaves the same, but
the concept seems to be pointing the way. I will read up on it.
I put the Capture = True in the base class of my user controls so that it is
set automatically for anything that inherits from it, unless I have missed
something and I need to put it somewhere else?
Charles
"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com... Me.Capture = True
This will keep all of your controls from receiving any mouse messages. You'll have to move any controls in the Forms mouse move events.
Charles Law wrote: Sorry for reposting this question, but I did not get a single answer
last time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped onto a form in my application when it is running. I allow it to be clicked and dragged to
a new location on the form. However, the user control has a check box on
it, and if the user clicks over the checkbox to drag the user control, the
check box changes state.
Is there a way that I can simulate the design mode effect of the VS IDE, such that whilst designing a form controls do not behave in the normal
way? The same problem occurs if clicking over a dropdown list: the list drops down and then the control can be dragged away from under it. It doesn't
look very good.
It would be nice to stop all mouse effects on the member controls of my
user control, for example, checkboxes with the popup style change their appearance when the mouse moves over them, but I would like to suppress
this whilst my user control is in 'design mode'.
Just to clarify, although I use the term 'design mode' my application is actually running. I am just referring to the state in which it is
running, that is I allow users to design a simple form and then turn design mode
off, whereupon the form should behave normally.
TIA
Charles
Try this out (this will do what you want):
Option Explicit On
Option Strict On
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'UserControl1 overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.CheckBox1 = New System.Windows.Forms.CheckBox()
Me.SuspendLayout()
'
'CheckBox1
'
Me.CheckBox1.Location = New System.Drawing.Point(72, 56)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.TabIndex = 1
Me.CheckBox1.Text = "CheckBox1"
'
'UserControl1
'
Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.CheckBox1})
Me.Name = "UserControl1"
Me.Size = New System.Drawing.Size(288, 160)
Me.ResumeLayout(False)
End Sub
#End Region
Dim drag As Boolean
Private Sub UserControl1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
If drag Then
drag = False
Me.Capture = False
End If
End Sub
Private Sub UserControl1_MouseMove(ByVal sender As Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If drag Then
CheckBox1.Location = New Point(e.X, e.Y)
End If
End Sub
Private Sub CheckBox1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles CheckBox1.MouseMove
If e.Button = MouseButtons.Left Then
Me.Capture = True
drag = True
End If
End Sub
End Class
Charles Law wrote: Hi yEaH rIgHt
Thanks for the idea. I have just tried it and it all behaves the same, but the concept seems to be pointing the way. I will read up on it.
I put the Capture = True in the base class of my user controls so that it is set automatically for anything that inherits from it, unless I have missed something and I need to put it somewhere else?
Charles
"yEaH rIgHt" <no******@haha.com> wrote in message news:10*************@corp.supernews.com...
Me.Capture = True
This will keep all of your controls from receiving any mouse messages. You'll have to move any controls in the Forms mouse move events.
Charles Law wrote:
Sorry for reposting this question, but I did not get a single answer last time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped onto a form in my application when it is running. I allow it to be clicked and dragged to a new location on the form. However, the user control has a check box on it, and if the user clicks over the checkbox to drag the user control, the check box changes state.
Is there a way that I can simulate the design mode effect of the VS IDE, such that whilst designing a form controls do not behave in the normal way? The same problem occurs if clicking over a dropdown list: the list drops down and then the control can be dragged away from under it. It doesn't look very good.
It would be nice to stop all mouse effects on the member controls of my user control, for example, checkboxes with the popup style change their appearance when the mouse moves over them, but I would like to suppress this whilst my user control is in 'design mode'.
Just to clarify, although I use the term 'design mode' my application is actually running. I am just referring to the state in which it is running, that is I allow users to design a simple form and then turn design mode off, whereupon the form should behave normally.
TIA
Charles
Thanks for the example. I have tried it and it certainly prevents the mouse
click from changing the state of the checkbox.
I then changed the FlatStyle to Popup. If you try this you will see that
when you wave the mouse over the checkbox the appearance changes. This is
also an effect that I am trying to avoid. If I stop the application and open
the user control designer I do not get this effect, so it makes me think
that there is something else that the IDE is doing to achieve this. Any
ideas?
Cheers
Charles
"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com... Try this out (this will do what you want):
Option Explicit On Option Strict On
Public Class UserControl1 Inherits System.Windows.Forms.UserControl
#Region " Windows Form Designer generated code "
Public Sub New() MyBase.New()
'This call is required by the Windows Form Designer. InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'UserControl1 overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.CheckBox1 = New System.Windows.Forms.CheckBox() Me.SuspendLayout() ' 'CheckBox1 ' Me.CheckBox1.Location = New System.Drawing.Point(72, 56) Me.CheckBox1.Name = "CheckBox1" Me.CheckBox1.TabIndex = 1 Me.CheckBox1.Text = "CheckBox1" ' 'UserControl1 ' Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.CheckBox1}) Me.Name = "UserControl1" Me.Size = New System.Drawing.Size(288, 160) Me.ResumeLayout(False)
End Sub
#End Region
Dim drag As Boolean Private Sub UserControl1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp If drag Then drag = False Me.Capture = False End If End Sub
Private Sub UserControl1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove If drag Then CheckBox1.Location = New Point(e.X, e.Y) End If
End Sub
Private Sub CheckBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CheckBox1.MouseMove If e.Button = MouseButtons.Left Then Me.Capture = True drag = True End If End Sub
End Class
Charles Law wrote: Hi yEaH rIgHt
Thanks for the idea. I have just tried it and it all behaves the same,
but the concept seems to be pointing the way. I will read up on it.
I put the Capture = True in the base class of my user controls so that
it is set automatically for anything that inherits from it, unless I have
missed something and I need to put it somewhere else?
Charles
"yEaH rIgHt" <no******@haha.com> wrote in message news:10*************@corp.supernews.com...
Me.Capture = True
This will keep all of your controls from receiving any mouse messages. You'll have to move any controls in the Forms mouse move events.
Charles Law wrote:
Sorry for reposting this question, but I did not get a single answer
last
time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped onto a form in
myapplication when it is running. I allow it to be clicked and dragged to
a
new location on the form. However, the user control has a check box on
it,
and if the user clicks over the checkbox to drag the user control, the
check
box changes state.
Is there a way that I can simulate the design mode effect of the VS
IDE,such that whilst designing a form controls do not behave in the normal
way?
The same problem occurs if clicking over a dropdown list: the list
dropsdown and then the control can be dragged away from under it. It doesn't
look
very good.
It would be nice to stop all mouse effects on the member controls of my
user
control, for example, checkboxes with the popup style change their appearance when the mouse moves over them, but I would like to suppress
this
whilst my user control is in 'design mode'.
Just to clarify, although I use the term 'design mode' my application
isactually running. I am just referring to the state in which it is
running,
that is I allow users to design a simple form and then turn design mode
off,
whereupon the form should behave normally.
TIA
Charles
That's because the controls on the designer aren't running. When you run
your program they are. There's nothing you can do about it.
Charles Law wrote: Thanks for the example. I have tried it and it certainly prevents the mouse click from changing the state of the checkbox.
I then changed the FlatStyle to Popup. If you try this you will see that when you wave the mouse over the checkbox the appearance changes. This is also an effect that I am trying to avoid. If I stop the application and open the user control designer I do not get this effect, so it makes me think that there is something else that the IDE is doing to achieve this. Any ideas?
Cheers
Charles
"yEaH rIgHt" <no******@haha.com> wrote in message news:10*************@corp.supernews.com...
Try this out (this will do what you want):
Option Explicit On Option Strict On
Public Class UserControl1 Inherits System.Windows.Forms.UserControl
#Region " Windows Form Designer generated code "
Public Sub New() MyBase.New()
'This call is required by the Windows Form Designer. InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'UserControl1 overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.CheckBox1 = New System.Windows.Forms.CheckBox() Me.SuspendLayout() ' 'CheckBox1 ' Me.CheckBox1.Location = New System.Drawing.Point(72, 56) Me.CheckBox1.Name = "CheckBox1" Me.CheckBox1.TabIndex = 1 Me.CheckBox1.Text = "CheckBox1" ' 'UserControl1 ' Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.CheckBox1}) Me.Name = "UserControl1" Me.Size = New System.Drawing.Size(288, 160) Me.ResumeLayout(False)
End Sub
#End Region
Dim drag As Boolean Private Sub UserControl1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp If drag Then drag = False Me.Capture = False End If End Sub
Private Sub UserControl1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove If drag Then CheckBox1.Location = New Point(e.X, e.Y) End If
End Sub
Private Sub CheckBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CheckBox1.MouseMove If e.Button = MouseButtons.Left Then Me.Capture = True drag = True End If End Sub
End Class
Charles Law wrote:
Hi yEaH rIgHt
Thanks for the idea. I have just tried it and it all behaves the same, but the concept seems to be pointing the way. I will read up on it.
I put the Capture = True in the base class of my user controls so that it is set automatically for anything that inherits from it, unless I have missed something and I need to put it somewhere else?
Charles
"yEaH rIgHt" <no******@haha.com> wrote in message news:10*************@corp.supernews.com...
Me.Capture = True
This will keep all of your controls from receiving any mouse messages. You'll have to move any controls in the Forms mouse move events.
Charles Law wrote:
>Sorry for reposting this question, but I did not get a single answer
last
>time, and I'm sure you guys must have some thoughts on the matter. > >I have a user control which can be dragged and dropped onto a form in my application when it is running. I allow it to be clicked and dragged to
a
>new location on the form. However, the user control has a check box on
it,
>and if the user clicks over the checkbox to drag the user control, the
check
>box changes state. > >Is there a way that I can simulate the design mode effect of the VS IDE, such that whilst designing a form controls do not behave in the normal
way?
>The same problem occurs if clicking over a dropdown list: the list drops down and then the control can be dragged away from under it. It doesn't
look
>very good. > >It would be nice to stop all mouse effects on the member controls of my
user
>control, for example, checkboxes with the popup style change their >appearance when the mouse moves over them, but I would like to suppress
this
>whilst my user control is in 'design mode'. > >Just to clarify, although I use the term 'design mode' my application is actually running. I am just referring to the state in which it is
running,
>that is I allow users to design a simple form and then turn design mode
off,
>whereupon the form should behave normally. > >TIA > >Charles > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: BadOmen |
last post by:
I want my program to send a mouse click to the window at the current mouse
position, how do I do that?
Example:
I have my mouse over a button in Word and then my program is sending the
left...
|
by: red |
last post by:
mouse events when the mouse is on a "child control"
hi everyone;
my problem:
I have a userControl
in this usercontrol, I have a child control (a button)
when the mouse moves over the...
|
by: James Bond |
last post by:
Hello. My 80+ year old father has recently decided to get his first
computer. Due to his age (and I suspect lack of playing pong as a child
like I did) he lacks the manual dexterity to use a mouse...
|
by: Charles Law |
last post by:
Sorry for reposting this question, but I did not get a single answer last
time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped...
|
by: Charles Law |
last post by:
When I click a button I don't want the click event to fire. Is this
possible?
In fact, what I would really like is to be able to intercept the click
event, perform some action, and then prevent...
|
by: Charles Law |
last post by:
This is actually a follow on from yesterday's post about masking mouse
clicks in a user control.
The solution I have implemented - from Herfried - places a transparent
window over the entire...
|
by: Vincent |
last post by:
I have a bound listbox control on one of my forms that has an
associated afterupdate event. When this event is invoked, I lock the
control to prevent the user from clicking on it more than once....
|
by: nuhfeken |
last post by:
We have a C# winform that uses the MVP design pattern for the user interface. For reasons I'd rather not explain we need to simulate a right mouse click on a specific control to deactivate the...
|
by: mike |
last post by:
I have the opportunity to rescue a project that
uses a mouse to sense the relative position of a machine.
The hardware is built...just needs to be programmed.
Stop snickering!!! I didn't do it...I...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |