Hi forum,
I have developed an application in which several text box controls are added to panel2 of a split container. Each Text box behaves as a virtual monitor. I also add a button control to panel2 in runtime, which represents a separate application running on any one of the several actual monitors connected.
I adjust the size of each textbox according to the resolution of the monitors connected. When I resize the button according to the dimensions of textbox, the size of the application also increase in the same proportion on the actual monitor desktop.
My problem is that Location of the application on actual monitor is always wrong, when I move the button control on the textbox(virtual monitor). There is always some offset value by which application location on the monitors differs from the button position on the textbox(virtual monitor).
I will be highly thankful, if anyone can guide to solve this matter.
Thanking in anticipation
NamitaS
Source code in MouseMove_ event handler is posted below:
protected virtual void MouseMoveEventHandler(object sender, MouseEventArgs e)
{
if (
!"Core.Windows.Forms.EditableControl"
.Equals(sender.GetType().ToString()) &&
_control_moving != null &&
e.Button == MouseButtons.Left
)
{
_control_moving.Left = (_control_moving.Left + e.x) - x_offset_on_client_control;
_control_moving.Top = (_control_moving.Top + e.y) - y_offset_on_client_control;
Point mypoint = new Point((_control_moving.Left * (cubeXres / hSize)), (_control_moving.Top * (cubeYres / vSize)));
g_Obj.Location = mypoint;
}