|
You are going to need to set a Global Mouse Hook. There's an excellent article here on CP, since 2004 !, by George Mamaladze on how to do this: [^].
If, by "snapshot" the clicked Control, you mean do a bitmap screen capture: yes, as Dave K. said, you are going to get into heavy use of the Win API and Platform Invoke. Search CodeProject for articles on screen capture.
I suspect (but don't have personal experience with) that once you know the Window (the app) that got the Click, that getting hold of the Control will require some clever coding.
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
|
|
|
|
|
thanks for your help my friends
I already see the code but it has some issues.
so if you find away to take snapshot of object when mouse click
do not forget me.
thanks again friends
|
|
|
|
|
For an article on capturing a specified portion of the screen - see this article clickety[^] by yours truly.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Hi there,
my question is what might fit better to storing objects.
I have a routine where i save ListViewItems and another for storing objects (selfmade class Resource) into a Dictionary.
But my collegue told me i should use a List<> because they are better.
I missed the why they are better.
So anyone can explain me why they should be better and whats the significant difference?
EDIT:
To explain more specific:
I need a container to store objects of my models that will be generated by Loops according to the data provided by my database.
e.g.:
I have a class Resource
public class Resource
{
MSSQL _dbIMS = null;
SqlGenerator _sqlGenerator = null;
private string _name = "";
private string _firstName = "";
private string _idEmployee = "";
private string _idCalendar = "";
private string _idBenDivFaeh = "";
private string _personalID = "";
private string _phoneNumber = "";
private string _costCentre = "";
private double _costsPerHour = 0.0;
private string _idDivision = "";
private bool _modified = false;
This will be generated after i loaded the values out of the database. Those objects then need to be stored somewhere so i can add them to a ListView.
Later on i will have those ListViewItems related to a advTree with projects and to another with divisions, the ListViewItems can be dragged and dropped onto the advTrees to modify the relation to a division for example.
So where to store the objects of the resource? List or Dictionary?
I hope this is a better explanation
Thanks in advance
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
modified 10-Dec-13 4:32am.
|
|
|
|
|
Explanation about Dictionaries[^]
You haven't provided much info about why you think you need to use a Dictionary - There is a reason why they exist, but there is also a reason why a List type exists.
Dictionaries are usually used to bind unrelated objects - If you need no binding to unrelated objects you better use a List.
A Dictionary may be useful if you want to pair numbers with their textual representation (1 = one, 2= two) etc. but it is going to fail on you if you need to store complex objects.
Veni, vidi, caecus
|
|
|
|
|
List and Dictionary are meant for completely different purposes. It's like saying which is best, Beethoven or a horse? You store the objects in the container that best fits your needs. So, if you need a keyed lookup of your objects for efficient retrieval, a Dictionary is a better bet than a List. If, however, all you need is somewhere to store data and you aren't that bothered about searching for it, a List is a good choice.
|
|
|
|
|
thanks for the explanations and for the great article about dictionarys.
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Just to add to Pete's answer, you might want to Google for tutorials on "data structures" (which both Lists and Dictionaries are). Each has it own uses, and you can save yourself a stack* of work using the correct one. In my experience List and Dictionary are the two I most commonly use c#, but YMMV, it's worth knowning about the others.
*intended.
|
|
|
|
|
Pete O'Hanlon wrote: List and Dictionary are meant for completely different purposes. It's like saying which is best, Beethoven or a horse? +500
/ravi
|
|
|
|
|
It's often the case that where you want a mapping between items of different Types, such as ListViewItems in a ListView, and instances of your own Classes, that a Dictionary is a very convenient way to enable rapid access from an instance of one Type to the related instance of the other Type ... without casting, or too-clever coding.
A good example would be a combination ListView and TreeView Control: by keeping a Dictionary<ListViewItem, TreeNode>, and a "symmetric" Dictionary<TreeNode, ListViewItem>, you can rapidly synchronize the selection in both TreeView and ListView without translating indexes from one to the other, casting, etc.
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
|
|
|
|
|
i wanna to show this xml in textbox (same as .xml file) (xml format) and be able to edit it and save.
note : if possible to import this xml to Datagridview:
DataSet ds = new DataSet();
StringReader rr = new StringReader("<root> <steps><step number=\"1\"><positions><position id=\"21\" /><position id=\"19\" /></positions><persons><person id=\"37\" position=\"21\"><systemfolder>4</systemfolder><controls><control fieldname=\"قسمت درخواست مرخصي\" fieldlatinname=\"request part for vacation\" fieldcontrolname=\"pnldarkhast\" editable=\"true\" visible=\"true\" /><control fieldname=\"بخش مربوط به مدير قسمت\" fieldlatinname=\"supervisor part\" fieldcontrolname=\"pnlmodir\" editable=\"false\" visible=\"false\" /><control fieldname=\"چرخه دارد\" fieldlatinname=\"is workflow\" fieldcontrolname=\"checkbox_isworkflow\" editable=\"false\" visible=\"false\" /><control fieldname=\"قسمت مربوط به کار گزيني\" fieldlatinname=\"human resource part\" fieldcontrolname=\"pnlkargozeni\" editable=\"false\" visible=\"false\" /><control fieldname=\"ساعت باقي مانده\" fieldlatinname=\"remain hours\" fieldcontrolname=\"pnlvacationhoursremain\" editable=\"false\" visible=\"true\" /></controls><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>True</attachfile></permissions></person><person id=\"28\" position=\"19\"><systemfolder>4</systemfolder><controls><control fieldname=\"قسمت درخواست مرخصي\" fieldlatinname=\"request part for vacation\" fieldcontrolname=\"pnldarkhast\" editable=\"true\" visible=\"true\" /><control fieldname=\"بخش مربوط به مدير قسمت\" fieldlatinname=\"supervisor part\" fieldcontrolname=\"pnlmodir\" editable=\"false\" visible=\"false\" /><control fieldname=\"چرخه دارد\" fieldlatinname=\"is workflow\" fieldcontrolname=\"checkbox_isworkflow\" editable=\"false\" visible=\"false\" /><control fieldname=\"قسمت مربوط به کار گزيني\" fieldlatinname=\"human resource part\" fieldcontrolname=\"pnlkargozeni\" editable=\"false\" visible=\"false\" /><control fieldname=\"ساعت باقي مانده\" fieldlatinname=\"remain hours\" fieldcontrolname=\"pnlvacationhoursremain\" editable=\"false\" visible=\"true\" /></controls><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>True</attachfile></permissions></person></persons><stepvalidation><conditionfields>37,28,28</conditionfields><conditionexpression></conditionexpression></stepvalidation></step><step number=\"2\"><positions><position id=\"23\" /></positions><persons><person id=\"53\" position=\"23\"><systemfolder>2</systemfolder><controls><control fieldname=\"قسمت درخواست مرخصي\" fieldlatinname=\"request part for vacation\" fieldcontrolname=\"pnldarkhast\" editable=\"false\" visible=\"true\" /><control fieldname=\"بخش مربوط به مدير قسمت\" fieldlatinname=\"supervisor part\" fieldcontrolname=\"pnlmodir\" editable=\"true\" visible=\"true\" /><control fieldname=\"چرخه دارد\" fieldlatinname=\"is workflow\" fieldcontrolname=\"checkbox_isworkflow\" editable=\"false\" visible=\"false\" /><control fieldname=\"قسمت مربوط به کار گزيني\" fieldlatinname=\"human resource part\" fieldcontrolname=\"pnlkargozeni\" editable=\"false\" visible=\"false\" /><control fieldname=\"ساعت باقي مانده\" fieldlatinname=\"remain hours\" fieldcontrolname=\"pnlvacationhoursremain\" editable=\"false\" visible=\"false\" /></controls><permissions><activities><start>true</start><pause>true</pause><stop>true</stop></activities><backpermission>True</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>True</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person></persons><stepvalidation><conditionfields>53</conditionfields><conditionexpression></conditionexpression></stepvalidation></step><finish number=\"0\"><positions><position id=\"7\" /><position id=\"3\" /></positions><persons><person id=\"30\" position=\"7\"><systemfolder>2</systemfolder><controls /><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person><person id=\"56\" position=\"3\"><systemfolder>2</systemfolder><controls /><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person></persons><message>Request_Denied</message></finish><enduser><systemfolder>0</systemfolder></enduser></steps> </root> ");
ds.ReadXml(rr);<br />
StringBuilder sb = new StringBuilder();<br />
ds.WriteXml(new StringWriter(sb));<br />
i get error while importing it to datagridview.<br />
Cannot add a column named 'controls': a nested table with the same name already belongs to this DataTable.<br />
<root> <steps><step number="1"><positions><position id="21" /><position id="19" /></positions><persons><person id="37" position="21"><systemfolder>4</systemfolder><controls><control fieldname="قسمت درخواست مرخصي" fieldlatinname="request part for vacation" fieldcontrolname="pnldarkhast" editable="true" visible="true" /><control fieldname="بخش مربوط به مدير قسمت" fieldlatinname="supervisor part" fieldcontrolname="pnlmodir" editable="false" visible="false" /><control fieldname="چرخه دارد" fieldlatinname="is workflow" fieldcontrolname="checkbox_isworkflow" editable="false" visible="false" /><control fieldname="قسمت مربوط به کار گزيني" fieldlatinname="human resource part" fieldcontrolname="pnlkargozeni" editable="false" visible="false" /><control fieldname="ساعت باقي مانده" fieldlatinname="remain hours" fieldcontrolname="pnlvacationhoursremain" editable="false" visible="true" /></controls><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>True</attachfile></permissions></person><person id="28" position="19"><systemfolder>4</systemfolder><controls><control fieldname="قسمت درخواست مرخصي" fieldlatinname="request part for vacation" fieldcontrolname="pnldarkhast" editable="true" visible="true" /><control fieldname="بخش مربوط به مدير قسمت" fieldlatinname="supervisor part" fieldcontrolname="pnlmodir" editable="false" visible="false" /><control fieldname="چرخه دارد" fieldlatinname="is workflow" fieldcontrolname="checkbox_isworkflow" editable="false" visible="false" /><control fieldname="قسمت مربوط به کار گزيني" fieldlatinname="human resource part" fieldcontrolname="pnlkargozeni" editable="false" visible="false" /><control fieldname="ساعت باقي مانده" fieldlatinname="remain hours" fieldcontrolname="pnlvacationhoursremain" editable="false" visible="true" /></controls><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>True</attachfile></permissions></person></persons><stepvalidation><conditionfields>37,28,28</conditionfields><conditionexpression></conditionexpression></stepvalidation></step><step number="2"><positions><position id="23" /></positions><persons><person id="53" position="23"><systemfolder>2</systemfolder><controls><control fieldname="قسمت درخواست مرخصي" fieldlatinname="request part for vacation" fieldcontrolname="pnldarkhast" editable="false" visible="true" /><control fieldname="بخش مربوط به مدير قسمت" fieldlatinname="supervisor part" fieldcontrolname="pnlmodir" editable="true" visible="true" /><control fieldname="چرخه دارد" fieldlatinname="is workflow" fieldcontrolname="checkbox_isworkflow" editable="false" visible="false" /><control fieldname="قسمت مربوط به کار گزيني" fieldlatinname="human resource part" fieldcontrolname="pnlkargozeni" editable="false" visible="false" /><control fieldname="ساعت باقي مانده" fieldlatinname="remain hours" fieldcontrolname="pnlvacationhoursremain" editable="false" visible="false" /></controls><permissions><activities><start>true</start><pause>true</pause><stop>true</stop></activities><backpermission>True</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>True</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person></persons><stepvalidation><conditionfields>53</conditionfields><conditionexpression></conditionexpression></stepvalidation></step><finish number="0"><positions><position id="7" /><position id="3" /></positions><persons><person id="30" position="7"><systemfolder>2</systemfolder><controls /><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person><person id="56" position="3"><systemfolder>2</systemfolder><controls /><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person></persons><message>Request_Denied</message></finish><enduser><systemfolder>0</systemfolder></enduser></steps> </root>
|
|
|
|
|
Please adjust the formatting and clarify your question.
Veni, vidi, caecus
|
|
|
|
|
How are you connecting your data to the datagridview?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
|
I would read the XML into the dataset and then use the dataset to display the data in the grid
i.e.
DatagridviewName.DataSource = ds.Tables[0];
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
have you used my xml??
thanks inn advanced!
|
|
|
|
|
Do you have a schema for this XML?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
<root> <steps><step number="1"><positions><position id="21" /><position id="19" /></positions><persons><person id="37" position="21"><systemfolder>4</systemfolder><controls><control fieldname="قسمت درخواست مرخصي" fieldlatinname="request part for vacation" fieldcontrolname="pnldarkhast" editable="true" visible="true" /><control fieldname="بخش مربوط به مدير قسمت" fieldlatinname="supervisor part" fieldcontrolname="pnlmodir" editable="false" visible="false" /><control fieldname="چرخه دارد" fieldlatinname="is workflow" fieldcontrolname="checkbox_isworkflow" editable="false" visible="false" /><control fieldname="قسمت مربوط به کار گزيني" fieldlatinname="human resource part" fieldcontrolname="pnlkargozeni" editable="false" visible="false" /><control fieldname="ساعت باقي مانده" fieldlatinname="remain hours" fieldcontrolname="pnlvacationhoursremain" editable="false" visible="true" /></controls><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>True</attachfile></permissions></person><person id="28" position="19"><systemfolder>4</systemfolder><controls><control fieldname="قسمت درخواست مرخصي" fieldlatinname="request part for vacation" fieldcontrolname="pnldarkhast" editable="true" visible="true" /><control fieldname="بخش مربوط به مدير قسمت" fieldlatinname="supervisor part" fieldcontrolname="pnlmodir" editable="false" visible="false" /><control fieldname="چرخه دارد" fieldlatinname="is workflow" fieldcontrolname="checkbox_isworkflow" editable="false" visible="false" /><control fieldname="قسمت مربوط به کار گزيني" fieldlatinname="human resource part" fieldcontrolname="pnlkargozeni" editable="false" visible="false" /><control fieldname="ساعت باقي مانده" fieldlatinname="remain hours" fieldcontrolname="pnlvacationhoursremain" editable="false" visible="true" /></controls><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>True</attachfile></permissions></person></persons><stepvalidation><conditionfields>37,28,28</conditionfields><conditionexpression></conditionexpression></stepvalidation></step><step number="2"><positions><position id="23" /></positions><persons><person id="53" position="23"><systemfolder>2</systemfolder><controls><control fieldname="قسمت درخواست مرخصي" fieldlatinname="request part for vacation" fieldcontrolname="pnldarkhast" editable="false" visible="true" /><control fieldname="بخش مربوط به مدير قسمت" fieldlatinname="supervisor part" fieldcontrolname="pnlmodir" editable="true" visible="true" /><control fieldname="چرخه دارد" fieldlatinname="is workflow" fieldcontrolname="checkbox_isworkflow" editable="false" visible="false" /><control fieldname="قسمت مربوط به کار گزيني" fieldlatinname="human resource part" fieldcontrolname="pnlkargozeni" editable="false" visible="false" /><control fieldname="ساعت باقي مانده" fieldlatinname="remain hours" fieldcontrolname="pnlvacationhoursremain" editable="false" visible="false" /></controls><permissions><activities><start>true</start><pause>true</pause><stop>true</stop></activities><backpermission>True</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>True</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person></persons><stepvalidation><conditionfields>53</conditionfields><conditionexpression></conditionexpression></stepvalidation></step><finish number="0"><positions><position id="7" /><position id="3" /></positions><persons><person id="30" position="7"><systemfolder>2</systemfolder><controls /><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person><person id="56" position="3"><systemfolder>2</systemfolder><controls /><permissions><activities><start>false</start><pause>false</pause><stop>false</stop></activities><backpermission>False</backpermission><selectablepersons>False</selectablepersons><selectableSender>False</selectableSender><selectableStarter>False</selectableStarter><ViewProcess>False</ViewProcess><ViewFinalTillNow>False</ViewFinalTillNow><CanSendToOthers>False</CanSendToOthers><attachfile>False</attachfile></permissions></person></persons><message>Request_Denied</message></finish><enduser><systemfolder>0</systemfolder></enduser></steps> </root>
|
|
|
|
|
That's not a schema. That's just an XML dump.
|
|
|
|
|
So how can i do that ?
i mean show in correct XML format or even in datagridview?
|
|
|
|
|
I have found a lot of answers over net but none of them worked for me.
I have,
1) Windows 7 64-bit
2) Visual Studio 2012
3) .net framework 4.5
4) libemgucv-windows-universal-cuda-2.9.0.1922-beta.exe
5) OpenCV-2.4.7.exe
Please suggest me how to resolve this.
|
|
|
|
|
Please do not repost the same question.
Veni, vidi, abiit domum
|
|
|
|
|
Edit: Moved to thread below.
Veni, vidi, caecus
|
|
|
|
|
Basically you are trying to use a 32 bit DLL compiled as a 32 bit target inside an application that's running in 64 bit. You have two choices - give your application 32 bit affinity or give it a 64 bit version of the 32 bit Dlls.
To give your app 32 bit affinity, you need to do the following steps for every project in your solution.
In Solution Explorer, right click on your project name and select Properties from the bottom of the list (or just select the project name and click Alt+Enter). You will now see the project property pages. Select the Build tab and change the Platform target from Any CPU to x86.
|
|
|
|
|
I have found a lot of answers over net but none of them worked for me.
I have,
1) Visual Studio 2012
2) .net framework 4.5
3) libemgucv-windows-universal-cuda-2.9.0.1922-beta.exe
4) OpenCV-2.4.7.exe
5) Windows 7 64-bit
Please suggest me how to resolve this.
|
|
|
|