|
ok that is clear bt how to move it and give it funstion like press delete key to delte it and enable selection on it and make it stretchable
there are lots of questions, tell me the methods and strategies , i have no idea.
Sameer Sood
|
|
|
|
|
Sounds to me like you want my rates to write it for you
First, you need to store your lines in a collection and draw them in your paint method. Then you need to write code to draw lines as you drag the mouse and add them to your collection when you lift the mouse.
If you want to select lines by drawing on them, you need to write code that works out if a pixel is close enough to a line to select it, probably first by working out if it's in the bounds of the box the line defines, then by walking the line if need be. Once you can select a line, you delete it by removing it from your collection, and calling Invalidate() ( which will redraw all the lines bar the one no longer there ). If you want to be able to click and drag it, then you basically want to draw focus points on the ends of the selected image, if you click inside one, you remove it from the collection, but make it the line being drawn, then your code to add lines will also allow you to move it.
Lots to do. In the first instance, make sure you understand the way Windows draws stuff, and crack a good GDI+ book.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
since this is not a graphic-only problem, you will have to do more than just override some controls onpaint method. you also will have to handle the "physics" of the line. If you even are not familiar with drawing, you should start reading some GDI+ tutorials - there you will learn to create basic (and more advanced) shapes and how to handle the whole drawing stuff. when you got familiar with it, you will have a basic knowledge about drawing and you also will get an idea on how to realize what you want to do.
to sum it up - there is no qnd solution for your problem i would know of - start learning to draw with gdi+
// edit: some strategies
you could do it like this:
you have a lineclass which has some properties - XStart, YStart (Maybe a point object called start? , XEnd, YEnd.
Now you will have to put add an eventlistener to the click event. when the mousebutton is clicked, you will have to check whether its near the line or not.
if it is near the line, you will have to remember the mousecursor position and add a eventlistener to the mouseup event. when this happens, you will have a difference between the old and the new cursor position.
you can take this value to modify your line object which is drawn by the onpaint method. sounds a bit complicated but it isn't that difficulty at all...
|
|
|
|
|
now that's like a professional
Tnx for the replies, i 'll learn gdi+ , bt mikone u must knw that there will be not one but many lines in my case as i am going to make a tool that will make Data flow diagrams like smartdraw, its a college assignment. i 'll try and post again if i have more such problems
tnx again
Sameer Sood
|
|
|
|
|
hi,
i have a few quesions :
1. How do i highlight a entire row?
this is what i have now:
dataGridView1.Rows[index].Cells[0].Style.BackColor = Color.Red ;
dataGridView1.Rows[index].Cells[1].Style.BackColor = Color.Red;
index is the last row, but i still have to tell what column, is there way to select all culmns?
2. how do i sort on a letter in an entire table (like a search button)
this is what i have now:
private void btn_sort_Click(object sender, EventArgs e)
{
db1DataSet.tabel1.DefaultView.RowFilter = " name LIKE '%" + txt_sort.Text + "%' ";
dataGridView2.DataSource=db1DataSet.tabel1.DefaultView;
}
name is a column, again is there a way to select all the columns?
3. How do i delete more then one row at the time. (select in a datagrid)
this is what i have now:
try
{
db1DataSet.tabel1.Rows[dataGridView1.CurrentRow.Index].Delete();
tabel1TableAdapter.Update(db1DataSet.tabel1);
db1DataSet.AcceptChanges();
this.tabel1TableAdapter.Fill(this.db1DataSet.tabel1);
Application.DoEvents();
}
catch (System.Exception ex)
{
db1DataSet.RejectChanges();
lbl_error.Text= ex.Message;
}
here i just delete the selected item, the one with the arrow nextto in the grid
if there is anyone with some idea's let me know :p
thxx
|
|
|
|
|
faladrim wrote: db1DataSet.tabel1.DefaultView.RowFilter = " name LIKE '%" + txt_sort.Text + "%' ";
Get rid of the % before txt_sort and it will sort alphabetically for you.
faladrim wrote: How do i delete more then one row at the time. (select in a datagrid)
Probably by writing the SQL to delete the right items.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi
1.Select entire row in datagrid :
<br />
private void dataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
System.Drawing.Point pt = new Point(e.X, e.Y); <br />
DataGrid.HitTestInfo hti = dataGridSearch.HitTest(pt); <br />
<br />
if (hti.Row == dataGridSearch.VisibleRowCount-1)
return ;<br />
dataGrid.Select(hti.Row);<br />
} <br />
2.
I didn't understand
clicking on datagrid's column headers can sort columns.
3.Delete multi rows :
You should add one checked (boolean) column to your dataset's table. then datagrid show it, after user checks this columns, you can find checked chekboxes and delete them all.
|
|
|
|
|
a little more about the sorting,
i only show the items that contain the text form the textbox,
maybe sorting istn the right word :p
more like a search
and thx
|
|
|
|
|
Hi,
Does any body has any idea about how to launch an invisible exe. By invisible I mean the one which is not shown in task manager or any diagnostic program.
Thanks in advance,
Regards.
|
|
|
|
|
Hiding from the taskbar is easy. Hiding from 'any diagnostic program' is probably not possible.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
only hiding from task list will also work... any idea in that regard ???
|
|
|
|
|
<br />
mainForm.ShowInTaskbar = false;<br />
That line will hide your application from the task bar.
There is no reason to hide it from the task manager.
____________________________________
There is no proof for this sentence.
|
|
|
|
|
I'd love to know a legitimate reason for why you would want to do this!
|
|
|
|
|
If you want to do some miscellaneous task than the only posibility is that you give the name of exe which would similar in name with system .exe
Also you can try one thing ,try to find out how to create a system process which cant be deleted by any user ,which will help you....
Enjoyy!!!
<marquee>nishu
|
|
|
|
|
Rootkits do that by overwriting DLL links to change the behaviour Windows system libraries which are being used by diagnostic programs.
Would you please tell us for what honest, legal, useful reason you need rootkit functionality in your application?
____________________________________
There is no proof for this sentence.
|
|
|
|
|
Well the reason is simple the exe is a locking program that locks some confidential files from user like data store files on which the whole application depends, now if the exe or the process is terminated, it will unlock the files enabling any body to alter the state of those files...
|
|
|
|
|
That what rights management is there for. Restrict the file access rights to "read only" for all users and there'll be no problems with altered files.
____________________________________
There is no proof for this sentence.
|
|
|
|
|
Its not that simple... any ways... thanks for your suggessions... just found the way...
Regards.
|
|
|
|
|
This is a bad way to protect data, for many reasons:
:: A program that is running all the time adds to the base resource load of the computer.
:: Actively protecting the data is not very secure. A passive protection is much easier to maintain, as it needs no maintainence at all.
:: Hiding an executable requires low level intrusions into the operating system. When it has been used before it has been compared to viruses and trojans.
The best place to hide anything is in plain view. The more you try to hide the data, the more interresting it gets, and it's not really hard to circumvent your protection measures. Just leave the files in the open and use a strong encryption to protect the contents of the files.
---
b { font-weight: normal; }
|
|
|
|
|
Do you really believe that he needs the hidden exe for data protection?
Even if encryption was not enough, he could run his locker-something as a service under local system authority to protect it from "evil users".
____________________________________
There is no proof for this sentence.
|
|
|
|
|
What if the user deletes or corrupts the files... you see you are partailly right... encryption is there in my case as well... but there are other test cases that are to be handled... there are certain levels of security to cope with.
|
|
|
|
|
Waqas Nasir wrote: What if the user deletes
The application that needs the files will not run anymore, so the user will soon undelete the files.
Waqas Nasir wrote: or corrupts the files
Same as above, the application will refuse to run until the files are repaired.
As they are encrypted, the user cannot replace the content with anything that makes sense. Whatever he may write into the files has to be garbage for your application. So you show a message box "currupt installation, please re-install" and the stupid user will learn very quickly not to touch the files.
BTW, why do you expect your users to try everything to destroy an application they are using?
____________________________________
There is no proof for this sentence.
|
|
|
|
|
Waqas Nasir wrote: there are certain levels of security to cope with
Such as?
|
|
|
|
|
Where I work, we use something very similar. but, the data is stored on a DVD and can't be modified. The "tool" you're talking about sits in the system tray. If it goes away for any reason, access to the encrypted data is cutoff.
You're best solution is to put the data on a seperate machine that users have no access to. Your application would talk to this data machine through either web services or custom remoting implementation, in either case, over encrypted communications channels. You also get the benefit of being able to log all accesses to the data too.
The best protection for data is to remove physical access to it...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Waqas Nasir wrote: What if the user deletes or corrupts the files...
What if the user turns off the power? How are you going to stop that?
You can't effectively protect the files from tampering using an active protection. It's easy to just hook up the hard drive as a slave drive on a different computer, then there is no program to protect the files any more.
You can use a CRC or MD5 checksum to protect the data in the files from tampering. If the checksum fails just don't use the data.
---
b { font-weight: normal; }
|
|
|
|