|
Hello,
You have to do it all by yourselve, AFAIK.
I think the fastest way is to handle the MouseDown and MouseUp event of the Panel.
Save the two MousePoints, as this will discripe an rectangle, SelectionRectangle.
Then you have to iterade over all your lines and validate each of the lines.
You could use the IntersectsWith method of the Rectangle class for that.
Hope it helps!
All the best,
Martin
|
|
|
|
|
Not as simple as you might think. You have to specify your problem a bit more clearly.
What exactly is it that you want to select? The lines that you have drawn doesn't exist as lines any more, they are just differently coloured pixels on the screen, so what you have to select is something that you use to keep track of the lines. How do you keep track of the lines?
What method do you want to use for selection? Detecting mouse clicks?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello, Guffa,
Thanks a lot.
You are right by saying “The lines that you have drawn doesn't exist as lines any more, they are just differently coloured pixels on the screen”.
That is the reason I can not select it by mouse clicks. I want to find some solution to keep track the lines, just like in MS word, after you plot one line, then you want to select it and edit.
Could you please tell me the best method to realize it?
Thanks a lot again.
Chunmin
|
|
|
|
|
The normal way to do this is to represent the line as an object in it's own right. Then the line could detect the MouseClick event and respond to it however you want.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete is right, you have to represent the lines as objects in your code somehow.
If you don't already do this, then you aren't drawing the lines correctly. You need to keep track of the lines in order to properly draw them in the Paint event of the control. If you just draw the lines outside the Paint event, they are just drawn on the screen where the control happens to be, and the control is not at all aware of the lines. Whenever the controls is redrawn for any reason, the lines will disappear.
---
single minded; short sighted; long gone;
|
|
|
|
|
Your best bet is to derive a class from the panel class, so you can centralise and reuse the code. The panel would keep an array of Line objects ( you would defne this class, it would have two points ), and then your code would work out which line is selected ( this is probably the hardest part, working out if someone has clicked on an arbitrary line. It's well documented online tho, and not THAT hard ).
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
do you prefer to use Dataset or direct SqlCommand to update your DB ??
for .net 2003
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
I am using a direct SQL query to update my database.
|
|
|
|
|
do you suffer from marinating string ??
and what are the advantages of direct SQL queries
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
The update methods of dataset are quite useful when you are dealing with bulk of data. For single or a few records it doesno't matter whether you use sql or bulk update.
Stored procedure are better than sql statements with respect to faster execution as they are compiled and the sql gets compiled runtime.
|
|
|
|
|
Hi
I've to transmit live video 4m Server to multiClients and I m working in C#,using UDP and capturing video from webcam in .avi format.Some1 suggested me to use Windows Media Services Now plz tell me what steps I should follow 4 transmission of live video?
How would I stream the video.I m not getting help in this matter from net so plz help me out.
thanx
Shanzay
|
|
|
|
|
Hello,
I am having Form based application. I am creating another form on menu click of main application. I want to acess the parenter or creater of the second form within the second form.
For ex.
In Form1 Menu click
Form2 ob = new Form2()
ob.MdiParent = this
ob.show()
within Form2(Save button click) i want to access the parent
Object ob = this.Parent;
or
object ob2 = this.MdiParent
but all parents are null.
What else to be done?????
Thanks.
|
|
|
|
|
Send a reference to the first form along to the constructor of the second form, and store that reference as a variable in that form class.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello,
Use Guffa's suggestion!
Or if you want Form1 (this) really to be the parent of Form2 (ChildForm) because of the effects behind that.
Form ChildForm = new Form();
ChildForm.TopLevel = false;
this.Controls.Add(ChildForm);
ChildForm.Show();
If you than look at "this.Parent" in the ChildForm, you will have the referenz to the MainForm (Form1).
Hope it helps!
All the best,
Martin
|
|
|
|
|
hi there,
http://www.codeproject.com/cs/miscctrl/ImageComboBoxControl.asp[^]
i used this article to draw image combobox, and its working
but the problem is that in that article selected image appear too small thats why i want to increase combobox height(default is 21) to see the large selected image
any idea?
Becoming Programmer...
|
|
|
|
|
Have you tried this[^]?
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
How to display addrresses of employees in a report as it is used as sticker.
such that
Mr. Akram | Mr. Vijay
street 16, Karachi, | Dehli, India
Sindh,Pakistan |
___________________________|___________________________________________
Ms. Sumaya | Mr. Tony
Gulberg, Lahore, | London, England.
Punjab, Pakistan |
so how do get this kind of report. Any kind of suggestion will be appreciated.
|_ are used to separate the record.
-- modified at 4:14 Monday 1st October, 2007
|
|
|
|
|
Hi,
Following command is not working:
System.IO.File.Delete("C:\\ABC\\*.TXT");
Error comes: => "Illegal characters in path."
|
|
|
|
|
That won't work! It should be like this:
string[] textFiles = Directory.GetFiles("C:\\ABC\\", "*.txt", SearchOption.TopDirectoryOnly);
foreach(string file in textFiles)
{
File.Delete(file);
}
|
|
|
|
|
|
This function could not use to delete all the files.
Beside this use System.io.directory.getfiles this function will return all the filename available in the specified path. use foreach loop to get into the collection and call system.io.file.delete to delete the file into your loop for each element in the array.
you can also go for the system.io.path.getextension to check the extension that should be txt files to remove.
with regards
yogesh agarwal
|
|
|
|
|
Hello All
I want to retrive the time values stored into the database then i want to display that value into a datagrid but the problem is it will display the date also along with the time but there is no dates stored into the database.
plz help me in this issue with code.
with regards
yogesh agarwal
|
|
|
|
|
If you are not directly binding the data to the Grid, you can get the value into DateTime type and use .ToShortTimeString() method and assign to the tinme value.
If you are directly binding data to the grid, then you probably have to format the column to time format.Check if DataBound like event is available or not.
If you are providing your own SQL for data retrival use
TO_CHAR(DATE_COLUMN, 'HH:MM:SS') in sql to get the data in time format.
|
|
|
|
|
Hello Everybody,
Does anybody knows how to specify "include","library", path from command line in MSBuild.
Thanks in advance,
Regards
Abhi Lahare
|
|
|
|
|
Check out followings
You can get this by firing csc -? on .NET command prompt
- OUTPUT FILES -
/out:<file> Specify output file name (default: base name of file with main class or first file)
/target:exe Build a console executable (default) (Short form: /t:exe)
/target:winexe Build a Windows executable (Short form: /t:winexe)
/target:library Build a library (Short form: /t:library)
/target:module Build a module that can be added to another assembly (Short form: /t:module)
/delaysign[+|-] Delay-sign the assembly using only the public portion of the strong name key
/doc:<file> XML Documentation file to generate
/keyfile:<file> Specify a strong name key file
/keycontainer:<string> Specify a strong name key container
/platform:<string> Limit which platforms this code can run on: x86, Itanium, x64, or anycpu. The default is anycpu.
- INPUT FILES -
/recurse:<wildcard> Include all files in the current directory and subdirectories according to the wildcard specifications
/reference:<alias>=<file> Reference metadata from the specified assembly file using the given alias (Short form: /r)
/reference:<file list=""> Reference metadata from the specified assembly files (Short form: /r)
/addmodule:<file list=""> Link the specified modules into this assembly
- RESOURCES -
/win32res:<file> Specify a Win32 resource file (.res)
/win32icon:<file> Use this icon for the output
/resource:<resinfo> Embed the specified resource (Short form: /res)
/linkresource:<resinfo> Link the specified resource to this assembly (Short form: /linkres)
Where the resinfo format is <file>[,<string name="">[,public|private]]
- CODE GENERATION -
/debug[+|-] Emit debugging information
/debug:{full|pdbonly} Specify debugging type ('full' is default, and enables attaching a debugger to a running program)
/optimize[+|-] Enable optimizations (Short form: /o)
- ERRORS AND WARNINGS -
/warnaserror[+|-] Report all warnings as errors
/warnaserror[+|-]:<warn list=""> Report specific warnings as errors
/warn:<n> Set warning level (0-4) (Short form: /w)
/nowarn:<warn list=""> Disable specific warning messages
- LANGUAGE -
/checked[+|-] Generate overflow checks
/unsafe[+|-] Allow 'unsafe' code
/define:<symbol list=""> Define conditional compilation symbol(s) (Short form: /d)
/langversion:<string> Specify language version mode: ISO-1 or Default
- MISCELLANEOUS -
@<file> Read response file for more options
/help Display this usage message (Short form: /?)
/nologo Suppress compiler copyright message
/noconfig Do not auto include CSC.RSP file
- ADVANCED -
/baseaddress: Base address for the library to be built
/bugreport:<file> Create a 'Bug Report' file.
/codepage:<n> Specify the codepage to use when opening source files
/utf8output Output compiler messages in UTF-8 encoding
/main:<type> Specify the type that contains the entry point (ignore all other possible entry points) (Short form: /m)
/fullpaths Compiler generates fully qualified paths
/filealign:<n> Specify the alignment used for output file sections
/pdb:<file> Specify debug information file name (default: output file name with .pdb extension)
/nostdlib[+|-] Do not reference standard library (mscorlib.dll)
/lib:<file list=""> Specify additional directories to search in for references
/errorreport:<string> Specify how to handle internal compiler errors: prompt, send, queue, or none. The default is queue.
/moduleassemblyname:<string> Name of the assembly which this module will be a part of.
|
|
|
|