|
Search CodeProject for an article that shows you how to do this.
xacc.ide
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
I searched CP but couldn't find anything. Can u plz get me any document regarding this.
|
|
|
|
|
IF you cant find , neither will I, try harder, I know it's there. Try Google!
xacc.ide
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
My guess would be that you opened the csv file in excel and then saved the file which added a bunch of extra empty cells. I would suggest adding some code to your csv parsing program that checks for extra empty cells and excludes them.
Ben
|
|
|
|
|
Hi,
My problem is to create a delegate for the following callback definition (c++ syntax):
typedef void (__stdcall *UnmanagedCallback)(std::wstring& WStringObject, const wchar_t* StringData, unsigned __int32 StringLength);
I tried something like this:
public delegate void UnmanagedCallbackDelegate(ref string stringObject, string stringData, UInt32 stringLength);<br />
or:
public delegate void UnmanagedCallbackDelegate(ref string stringObject, [MarshalAs(UnmanagedType.LPWStr)]string stringData, UInt32 stringLength);
The callback fired from the dll is a _stdcall.
Someone has a clue what I do wrong?
Thanks in advance...
Uwe.
|
|
|
|
|
You can use the DllImportAttribute[^] to specify the CallingConvention[^], but I don't think .Net will marshal STL strings to a String.
You would probably have to specify those parameters as an IntPtr, then convert the code from this[^] article to C# (it's shown in the "Converting String to std::string" section).
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hello,
I need to create an application which displays live video from a capture card in a box (picturebox?) and when the operator clicks on a button, a picture is taken and saved somewhere on the server
any help is fine (vb.net/c#,java)
thx
|
|
|
|
|
There's C# samples that do this on this site.
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 )
|
|
|
|
|
I have a graph created in a zedGraph control on my form.
A separate thread handles the data collecting and preparing for graph purposes.
When I hit start I can see the zedGraph control resizing alright but i cant see the curves.
If I leave the focus of the form and then return to it(say with alt_tab or the mouse)
I can see the curves.
It operates in a manner that led me to think of a refreshing problem.
can you please advise me what to do?
thank you.
|
|
|
|
|
That implies that your graph is only redrawn when invalidated, so call Invalidate() either on the whole form or the graph control when you know the graph is ready to be displayed.
|
|
|
|
|
I tried Invalidat() and I tried refresh(), none of which does the trick.
It seems like the axis are changing correctly and only the curves themselves don't show.
Any other ideas?
|
|
|
|
|
Have you tried zedGraph1.Update()?
|
|
|
|
|
Also, if I call hide() and then show(), this also doesn't help,
only if i point to the main form(for instance) and back to my graph, I can see the change in the
curves.
|
|
|
|
|
|
yes I also did that, it didn't help.
after the graph is ready for display I called this.invalidate() on the form, it didn't help.
I called invalidate on the control, it also didn't help,
I called this.refresh(), also didn't help.
now I tried doing a showDialog() on this(my form), and in the dialog form I can see the curves.
it is not a solution acceptable, but it might imply on the reason for my problem,
and on how to fix it.
Does it help? can you think of something else I can try to do?
|
|
|
|
|
Hello,
If you are pathing the values from a different thread to the ZedGraph Control, you have to use "Invoke".
After this is done you should call:
yourzedGraphcontrol.AxisChange();
yourzedGraphcontrol.Invalidate();
All the best,
Martin
|
|
|
|
|
Hey Martin,
on what do I use Invoke()?
|
|
|
|
|
Hello,
gizmokaka wrote: on what do I use Invoke()?
The parent object of the ZedGraphControl (Form or UserControl).
Example code for Form on which the ZedGraphControl is placed:
private delegate void UpdateZedGraphDelegate(object values);
public void UpdateZedGraph(object values)
{
if(this.InvokeRequired)
{
this.Invoke(new UpdateZedGraphDelegate(UpdateZedGraph), new object[] {values});
return;
}
}
All the best,
Martin
|
|
|
|
|
Sorry for the newbe questions but I am quite novice in this type of high level programming.
I don't really understand how the code you sent me works,
can you please explain it a bit, and tell me where my new thread comes in to action?
I have my class which collects all the data for the graph into a member control,
I want that member control to be updated from another thread, how do I use the code you
presented to do so?
thank you .
|
|
|
|
|
Hello,
The thread where you collect the data for the Graph has a referenz of the "memberControl"?!
The "memberControl" holds the ZeGraph Control?!
If you now add a/the method like I gave you before, to the memberControls code,
the thread should be able to call this method.
The thread can now path the value for the graph to this method.
The "InvokeRequired" property of the Control class does a check if it's neccesary to Invoke the method.
Reason is, that you also could call the method from inside the thread, and there the invoke is not needed.
In case of "InvokeRequired" is "true" the method will be called again by the "Invoke" call, and next time "InvokeRequired" will be "false". (debug it, for easier understanding).
At the first call ("InvokeRequired" is "true") the code after the if statement is not going to be executed.
After Invoke you can use the pathed datas to set the ZedGraph properties.
Hope it helps!
All the best,
Martin
|
|
|
|
|
thank you very much.
I am reading it now and hope I will understand and utilize successfully what you have written.
thanks a lot.
|
|
|
|
|
Hello again dear Mr Martin,
First of all I want to thank you a lot for your help it was very, informative, and it helped me with
a different problem I encountered.
Still it did not solve my refresh problem. and y?
it's not happening to me because a different thread is calling the function, it happens even if everything is done in the same thread.
You see, I have me a function that creates data for the zedGraph control to show.
everything is working fine, and the underlying graph is probably OK.
the problem is that I need to move attention form the form and return, when I return
I can see the changes.
I will patch the snippet here, maybe this will help:
#region ZedGraph_Log Analysis
private void lgAnalysisZedGraphControl_Load(object sender, EventArgs e)
{
CreateGraph(lgAnalysisZedGraphControl);
SetSize();
}
private void SetSize()
{
lgAnalysisZedGraphControl.Location = new Point(10, 10);
lgAnalysisZedGraphControl.Size = new Size(lgAnalysisPanelShowGraph.Width - 10, lgAnalysisPanelShowGraph.Height - 10);
}
delegate void createCurvesHandler(ZedGraphControl zgc);
private void CreateGraph(ZedGraphControl zgc)
{
zgc.GraphPane.CurveList.Clear();
zgc.GraphPane.XAxis.Type = AxisType.Date;
Thread startCreateCureves = new Thread(delegate() { createCurves(zgc); });
startCreateCureves.Start();
}
private void createCurves(ZedGraphControl zgc)
{
if (zgc.InvokeRequired)
{
createCurvesHandler d = new createCurvesHandler(createCurves);
zgc.Invoke(d, new object[] { zgc});
}
else
{
ColorSymbolRotator rotator = new ColorSymbolRotator();
#region create curves as needed
for (int i = 0; i < lgControlsPanel.Controls.Count; i++)
{
if (lgControlsPanel.Controls[i] == angleCheckBox)
if (angleCheckBox.Checked)
{
foreach (string key in valveCheckedListBox.Items)
{
if (valveCheckedListBox.CheckedItems.Contains(key))
{
zgc.GraphPane.AddCurve(key + ": Angle", anglePointArr[HexToLong(key)], rotator.NextColor, rotator.NextSymbol);
}
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
}
#endregion
zgc.AxisChange();
}
}
|
|
|
|
|
Hello,
I have to tell you that this doesn't make any sence!
From my understanding of your first questions, I asumed you want to make a thread for collecting the datas for your Graph.
But hat I see here is that you have the datas and start a thread to fill the datas to your Graph.
And the first thing which is done in the thread is to invoke it back to the GUI thread.
For your problem with the Zed Graph (without using threads), you should conntact the ZedGraph forum I guess!
Sorry, for not really helping you out!
All the best,
Martin
|
|
|
|
|
Is there a way of calling a method but not calling the first line of the method?
I have a generic List called PlayHand. I add to this list in the method PlayGame(). When the button is clicked I want to add a Card type to this list. But after the method PlayGame() has been called and the method has completed, the generic list PlayHand clears.
Can anyone help? Im really stuck on this!
Lucy
|
|
|
|
|
Lucy_H85 wrote: Is there a way of calling a method but not calling the first line of the method?
I don't think so. What you can do is add boolean parameter to that method, and have condition on first line, something like
void MyMethod(bool shouldExecuteFirstLine)
{
if(shouldExecuteFirstLine)
{
...
}
}
Lucy_H85 wrote: I have a generic List called PlayHand. I add to this list in the method PlayGame(). When the button is clicked I want to add a Card type to this list. But after the method PlayGame() has been called and the method has completed, the generic list PlayHand clears.
Uh, I don't follow Can you show your code?
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|