|
I am working on an application that implements a drag and drop interface, but when I drag the control with the mouse the control's position does not actually change until the cursor touches the form. That is, if I have a control that is 200 pixels tall by 150 pixels wide and I click the cursor and hold it at pixel 100 and 50, the control does not move until the cursor touches the form, but then the cursor is again positioned at the drag point again. This causes the control to move in jumps. I would like the cursor to remain at the drag position where the cursor was clicked and to drag from that point smoothly without the cursor needing to touch the form.
Do I need to somehow resample the control's position so that it moves using the drag point without needing to touch the form?
Here is the code
private static void _ctrlParent_DragOver(object sender, DragEventArgs e)
{
try
{
if (DragDropHandler.CanDropHere((Control)sender, e.Data))
{
Control cthis = (Control)sender;
Control cthisParent = ((Control)sender);
e.Effect = DragDropEffects.Move;
Control ctrl = DragDropHandler.GetControl(e.Data, true, true);
if (!(ctrl is IDragDropEnabled))
{
return;
}
if (cthis.Name != ctrl.Name)
{
ctrl.Parent.Controls.Remove(ctrl);
ctrl.Parent = cthis;
cthis.Controls.Add(ctrl);
ctrl.BringToFront();
}
else
{
return;
}
Point NewLocation = cthis.PointToClient(new Point(e.X, e.Y));
ctrl.Left = NewLocation.X - dragPoint.X;
ctrl.Top = NewLocation.Y - dragPoint.Y;
}
else
{
e.Effect = DragDropEffects.None;
}
}
catch (System.Exception ex)
{
MessageBox.Show("Error is " + ex.GetBaseException());
}
}
-- modified at 14:26 Monday 28th May, 2007
|
|
|
|
|
Drag-and-drop isn't used to move controls around, it's used for grabbings something (more or less) imaginary (like the representation of some files in an explorer window), and drag them to a control of some kind.
If you want to move a control around, you should just capture the mouse on MouseDown, move the control on MouseMove and release the mouse on MouseUp. (Actually, I'm not sure if that is the best way of doing it, but it will get you far closer than using drag-and-drop.)
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa:
The problem is that I need to be able to drag a control and to drop it onto another control, but in the meantime I need to be able to drag each control from the place where the mouse down click occurs. This drag point is currently retained by the Mouse Down event handler, but the control only moves when the cursor touches the form. This makes the control movement jumpy. I would instead like to be able to move the control from the drag point without the curor touching the form. Do you have any advice? Should I somehow capture the movement of the mouse in the MouseMove event handler?
New_Phoenix
|
|
|
|
|
Read my previous post again. If you don't understand it, explain what it is that you don't understand, instead of just repeating the contents of your original post.
---
single minded; short sighted; long gone;
|
|
|
|
|
i have a problem with passing a parameter to crystal report through form
using Visual Studio 2003,I have a piece of code which i had gotton from codeproject but i have couple of problems in that code
//Instantiate variables
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
//Set instances for input parameter 1 - @vDepartment
paramField.Name = "@vDepartment";
//Below variable can be set to any data present in SalseData table, Department column
paramDiscreteValue.Value = "South";
paramField.CurrentValues.Add(paramDiscreteValue); //Add the paramField to paramFields
paramFields.Add(paramField);
crystalReportViewer1.ParameterFieldInfo = paramFields;
reportDocument.Load(@"..\..\..\Reports\SalseReport.rpt");
crystalReportViewer1.ReportSource = reportDocument;
the code in Bold format is the problem.
Actully Visual Studion 2003 we don't have paramfield.Name function but paramfield.set_ParameterFieldName
and also in the case paramField.CurrentValues it is paramField.Set_CurrentValues.
when i used this function i had two error saying that these function can not be called explicitly.
help me to remove this problem.
By Lucky Hamad
|
|
|
|
|
I'm having trouble getting my head around regular expressions.
How do I find anything between < and > ?
Thank you.
|
|
|
|
|
The following regex will return the contents of anything between < and > in a named capture called "TagContents":
\<(?<TagContents>[^\>]*)\> Here's how it is constructed:
An escaped < character:
\<
An escaped "<" character - escaped to prevent it from being treated as a special expression character. This < matches the beginning of the tag.
A named capture group:
(?<name>matchexpr)
Matches the matchexpr expression and returns it in a named capture called name.
A custom character class:
[^\>]*
Custom character classes are defined by having a set of character identifiers within square brackets [ ]. The ^ character at the beginning means that the character class should match characters that are not contained within the characters listed within the brackets. So, this character class will match characters that are not ">". The asterisk at the end is a wildcard character that indicates that the character class should be matched any number of times possible, from 0 to the remaining length of the string.
An escaped > character:
\>
Matches the end of the tag.
--Justin
Microsoft MVP, C#
|
|
|
|
|
I'm sorry, I asked the wrong question. I actually need to find the entire tag, including the < and >.
|
|
|
|
|
Then just put the \< and \> inside the capture group:
<span><span>(?<TagContents></span></span><span><span>\<</span></span><span><span>[^\>]*</span></span><span><span>\></span></span><span><span>)</span></span> ...so that they will be captured along with what's between them.
--Justin
Microsoft MVP, C#
|
|
|
|
|
Hi !
Does somebody has any idea about HOW i can kill the process by itself (like Environment.Exit(0)) and
restart again ? In fact, my problem is what I can do to restart the application auto'magic'ally. Does it exist some mechanism with Windows to auto-restart an application ?
What I do is I want to restart my application with new settings and/or new setup.
Danny Gilbert, engineer
Montreal, Canada
|
|
|
|
|
Before calling Environment.Exit(0))
you could use Process.Start to create a new instance of your application.
Process.Start Method[^]
|
|
|
|
|
Application.Restart() will do the trick
|
|
|
|
|
I am using SSL to crate Https page,
But Security Report Icon shows only for short duration in Internet Explorer ,
and when page downloading complete it is disappear,
Why it is happening?....
i learner
i learner
|
|
|
|
|
Don't cross post the same Questions in different forums.
Regards,
Satips.
|
|
|
|
|
select first item (or other) of menustrip by code.
i want select (and open if it possible) one of menustrip items when user press space.
|
|
|
|
|
item.DropDown.Show()
life is study!!!
|
|
|
|
|
I’ve used the ReportViewer a couple of times and now I have one problem that the RefreshReport() function takes way too long time. Anyone might know what can be wrong…
_____________________________
...and justice for all
APe
|
|
|
|
|
I have a general question regarding ADO Parameter class. I have never used it before, but came across a solution to a problem that uses it. (I was trying to insert a blob into a Mysql/ASA DB). As far as I understand the parameter class is used for stored procedures, is this correct, or does it go further than that? And when is it good to use the parameter class?
All the solutions I could find for the problem above only used the parameter class, is there another way of inserting a blob into a DB without the parameter class, I tried a direct insert of the binary into the table, no joy.
Basically I do not know what and when to use the ADO parameter class, if someone could help out with the basics, it would highly be appreciated.
Thanks in advance.
-- modified at 9:47 Tuesday 29th May, 2007
Kind Regards
Scorn
|
|
|
|
|
hi all,
I am using an application where i have used axwebbrowser control.i have multiple tabs which opens any page given by the user.
I need to display the icon of the corresponding page opened.say for example, if the user opens a yahoo page, the yahoo icon has to be displayed.
Can anybody help me with suggestions.
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
I have to write a stored procedure that would return me some value so that i can do something on the basis of that return value:
The SP code is:
CREATE PROCEDURE sp_isvalidlogin
@UserID varchar(16),
@Password varchar(16),@i nchar(2) output
As
if exists(Select * From Authenticate
Where UserID = @UserID
And
Password = @Password)
set i=1
else
set i=0
Is this definiton alright ... ihave to return a value if this userid and password exists in the database and perform something on the basis of return value.
if returned what is the code in c# to receive that value ....
The table consists of these two fields:
userid and password.
Urgent help needed..
|
|
|
|
|
Please don't remove messages from threads, as you did with the previous thread. It messes up the forum.
--
You have forgotten the @ before the variable name when you set it:
...<br />
set @i = 1<br />
else<br />
set @i = 0
I suggest that you use a data type that is more convenient for the output value, like int . If you really want to return the number as a two character string, you have to assign string values to the variable:
...<br />
set @i = '1'<br />
else<br />
set @i = '0'
To retrieve the value in C#, you add a parameter with the direction ParameterDirection.Output , and read the value from it's Value property after calling the procedure.
---
single minded; short sighted; long gone;
|
|
|
|
|
bro.. i dont have output parameters to the procedure and still i want to return a value can i do that and how will i receive it the code of sp is given below:
create PROCEDURE sp_IsValidLogon
@UserID nvarchar(16),
@Password nvarchar(16)
As
if exists(Select * From Authenticate
Where UserID = @UserID
And
Password = @Password)
begin
return(1)
end
else
return (0)
|
|
|
|
|
You add a parameter object with the direction ParameterDirection.ReturnValue and read the value from the Value property after executing the procedure.
---
single minded; short sighted; long gone;
|
|
|
|
|
bro..can u tell me the exact code..i cannot figure it out.
|
|
|
|
|
Hi all,
Is it possible to highlight rows and respective columns of the datagrid on mouseover using javascript? If so can you give me a link or code to do that?
ayyp
|
|
|
|