|
Ah ok,
On the mouse down event, set a boolean to true. In the mouse up event, set it to false. In the Mouse move event, check the boolean and if its true then draw the rectangle.
That should do what you want.
Regards,
Rob Philpott.
|
|
|
|
|
The answers already given will work.
For some added 'cool' features Google for 'rubberbanding c#', and search MSDN for DrawReversibleFrame the page that you get has a nice example.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
This was it that i want. . .
Rubberbanding. . I was unaware of that word..
Thanx anyway dude .
|
|
|
|
|
i am trying to fetch data from database & trying it to add all the fetch records into listbox
cmd = new OleDbCommand("select bcode from Issue where btno= " + listBox1.SelectedItem.ToString() + "", cn);
cn.Open();
dr = cmd.ExecuteReader();
if (dr.Read() == true)
{
listBox2.Items.Add(dr[0].ToString());
}
dr.Close();
cn.Close();
so it only adds a single record but there are more than one records matches to btno
|
|
|
|
|
|
The problem is that you are only telling it to add one item.
Replace:
if (dr.Read() == true)
with:
while (dr.Read())
and all should work as required.
Incidentally, you should have posted this as a reply to musefan. He was waiting to help you. He's probably sitting in front of his computer crying now, because you haven't replied!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have the mouse event handler function that takes the mouse x and y coordinates and converts that integer to a string and is sent to two text boxes, one for each axis. I am trying the get the x and y coordinates of the mouse when it is on any part of a live video stream bitmap. It is for a color tracking app, ill eventually get the color ARGB values of the pixel the mouse is over and save it to the color filter value chart. I digress, all i need to know is where do i have to place my function:
protected override void OnMouseMove(MouseEventArgs mouseEv)
{
txtMouseX.Text = mouseEv.X.ToString();
txtMouseY.Text = mouseEv.Y.ToString();
}
so that i get the coordinates of the bitmap, not the application window.
modified on Friday, April 17, 2009 10:06 AM
|
|
|
|
|
If you put the Bitmap on the window, you should know its coordinates. Keep your code where it is but put a test before your existing code to see if the mouse is in the rectangle for the image. If not in the rectangle, return. Then just add offsets to your two lines for the X and Y coordinates of the image.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
The issue is that I stop receiving coordinates when the mouse enters the bitmap rectangle due to the fact that it is part of a form group. How do i get rid of the border that separates the bitmap and text boxes from the rest of the application window.
|
|
|
|
|
sebogawa wrote: due to the fact that it is part of a form group
I do not understand. What, exactly, is a form group? Do you mean that the image is on one form, and the TextBoxes are on another?
If not, then please clarify.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Ill try my best to explain. So imagine a simple form window. It has a black rectangle, thats the video feed bitmap thing, then it has two text boxes. The bitmap rectangle and the text boxes are surrounded by a border that groups then under a specific title. I got the color filtering code from the "Lego Pan and Tilt with color tracking" app posted on this site. The mouse coordinates only change value in the textboxes when the mouse is outside the group border, but still inside the main window. If u look up the Lego app u will see what i am talking about in the images posted with that article. Everthing in the picture is the same except for two text oxes under the bitmap rectangle. Thanks for healping : )
|
|
|
|
|
sebogawa wrote: thats the video feed bitmap thing
And is the 'bitmap thing' actually a control?
If it is, then in the designer, select it, in the Properties Window , switch to Events page and double click on the MouseMove event. Put your code in the handler stub created in the code view for the form, should work OK, no need for offsets etc..
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
i tried to add the items in listbox from database but it adds only one record from database
|
|
|
|
|
how did you try to do it? post some example code
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Try to use this two properties: DataValueField and DataTextField.
e.g.
<br />
myListBox.DataSouce = SOURCE_FROM_DB;<br />
myListBox.DataValueField = "VALUE_COLUMN_NAME";<br />
myListBox.DataTextField = "TEXT_COLUMN_NAME";<br />
myListBox.DataBind();<br />
|
|
|
|
|
Hi all, I have a dataset which I have designed in database designer. I have desinged a form with drag drop datasources. So there is a navigator. If I change some textboxt value etc.. at run time, When I had pressed buttons on navigator (Next, Previous, First or Last) before I saved. , Can it give a message that is
"There are some changes. Do you want to save ??"
How can I understand cahnges on dataset at runtime ??
Thanks all
S.A.A
|
|
|
|
|
Hello,
I really want to create a help page in my C# windows application and was wondering if anyone has any recommendations on best practice for this.
Cheers,
Chris
|
|
|
|
|
There are plenty of examples for this on MSDN and the Web. Search for 'creating application help .NET'.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Sorry Henry, but I tried searching on that with the quotes and still didn't find anything.
Could you specify and exact page?
Thanks
|
|
|
|
|
Try Googling 'creating help' or 'creating help files'. Without the quotes. Loads of hits. Take your pick.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
You could have just said "no". It's as helpful and more accurate.
Codemonkeys don't do it at all. Too busy coding.
|
|
|
|
|
I disagree.
Saying no, would achieve nothing. By pointing out likely phrases to Google for the OP gets a chance to find an article that they can understand. The topic was too complex to allow a simple step by step answer, or a code snippet. Equally, my own favourite article might not have suited the OP.
This way they get to choose their own.
I had originally given what I thought was a likely phrase, the OP said it was no good, even though it was very, very similar to those suggested later. The OP had neither the wit nor intelligence to modify it for themself, in order to get more relevent responses. The topic is such a common one that there are thousands of articles on how to do it, no point in re-inventing the wheel.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi all,
How can i call a private void abc(def ghi) method from a page load.
Here def is a abstract class.
Thank you
|
|
|
|
|
AndyInUK wrote: How can i call a private void abc(def ghi) method from a page load.
Here def is a abstract class.
def being an astract class isn't going to make any difference that I can see. ghi is a reference to the base class def , ghi will naturally have to be a instance of a class derived from def that isn't abstract.
The issue is where is this private method located. If it is in the same class as the Page_Load then that's fine. If it is anywhere else then it isn't fine.
|
|
|
|
|
yes it is in the same class as Page_Load. it is user control code basically.
but i am not getting the right syntax ?
i have tried calling abc(ghi). This gives me runtime error. So is something wrong with the method or i am calling it wrongly in page load
|
|
|
|