|
thanks sir
|
|
|
|
|
Your welcome.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Hi everyone,
I want to create a directed graph with the use of C# and give the user a visualization of the graph. I would like the vertexes to be interactive, meaning "click able" so that I can trigger some code when this happens.
My question is the following: which libraries would you suggest using for this kind of project? I came along Quickgraph and Graphviz so far, but I could not find affirmation that Graphviz is able to support the interactivity of vertexes.
Thanks for any help in advance, it is much appreciated.
|
|
|
|
|
Im struggeling to see what you actually want in you graph, could you explain some more?
|
|
|
|
|
|
|
Thanks, graph# seems to do everything I need!
My goal is to build a graph that represents the different versions of documents and which version followed which.
I want the user to be able to click on the documents and open them up in the process.
|
|
|
|
|
Hi,
i use a mathod that create a control (for example textbox) and add it's to a pannel. The pannle is passed in a parameter of the method.
public static void CampoTxt(Panel frmPadre)
{
TextBox txt = new TextBox();
txt.Name = "name";
txt.Visible = true;
frmPadre.Controls.Add(txt);
}
I've manage the event ControlAdded of the pannel for modify the height of form when a visible control is added.
But every control I have added in the panel has the visible property set to false even if at the creation was set to true.
private void pnlf_ControlAdded(object sender, ControlEventArgs e)
{
...some code ....
}
Any ideas?? Thanks
|
|
|
|
|
Set a Break point at the beginning of the CampoTxt method, then step into the method and check the value of txt all the way through.
Frazzle the name say's it all
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
John F. Woods
|
|
|
|
|
It can be set to False if the control is hidden behind another control. Since, in your example, you don't set the position of the control at all, if you create a bunch of them, each will be sitting at 0,0 in the Panel, one on top of the other. Only the top control will have it's Visible property set to True.
|
|
|
|
|
In my code i set top and left property but i'm not indicate them in the example.
In addition, when the form is shown the controls are visible...
|
|
|
|
|
cursore84 wrote: but i'm not indicate them in the example.
How are we supposed to konw that if you post "fake" code?? Post the ACTUAL code you're using and things go much smoother.
cursore84 wrote: In addition, when the form is shown the controls are visible...
Then you're contradicting your own question. A much better explanation of EXACTLY what happens, when and under what circumstances is needed.
|
|
|
|
|
I reported some of the code to simplify the example, but unfortunately I left out some important information ....
But I think to have found the reason why at the event ControlAdded all the controls are invisible. I call the method "CampoTxt" before calling Form.Show () ... in this moment all the controls, including the form, have the property visible = false.
Is there a way to know if a control is visible or not at the execution of the event ControlAdded before the form is shown?
thanks
|
|
|
|
|
No. Everything will be Visible = False until the form is shown.
If you're relying on the state of controls to determine the state of your model your doing it backwards. The state data of your model should be kept in the model itself.
|
|
|
|
|
Windows App....
Problem is here "txt.Name" - Do not name your control "Name". I used to have the same problem, all control with "Name" as their names wont be visible at design time and their property will be change to false...
I remain joe!
|
|
|
|
|
Hello,
I am having some problems when running a C# application that I've written. It runs fairly smooth on a local
machine (test machine). However, when I am running this from a network drive, the responsiveness is slow. When
I click on a button that opens up a form, there is a considerable lag (5-10 seconds sometimes). Is there anything that I can do to speed this up on a network?
|
|
|
|
|
There is no generic method that will speed anything up. Code doesn't run faster or slower depending on where you ran it from. Code runs at the processor speed, not the network.
Now, any processing you have on data is remote locations or stored in files is where you'll run into problems with performance. Since we have no idea what you're code is doing when you "click a button that opens up a form", there is nothing anyone can tell you that is going to help.
We need more detail about EXACTLY what your code is doing when you run into this problem.
|
|
|
|
|
As Dave mentioned, you didn't give a lot of details so I'll take a stab in the dark and say that your "work" is probably being done on the UI thread rather than on a background worker or other type of thread. (If you have no idea what that means then you are definitely working on the UI thread.) That will kill UI performance if you start mixing long-running operations such as disk-based access or network-based access. Your UI will hang while it processes the work because there is only one guy in the room doing anything.
If this is the case, you will want to change your worker method(s) to use an async pattern so you can decouple the long-running work operations from the UI. That will keep things responsive... at least on the UI.
|
|
|
|
|
Hello everybody
I would like to cast a System.__ComObject to another type which is an interface. However, this interface is retrieved by reflection. I tried to create a generic cast method but it failed. I also tried to use TypeConverter class but it also failed. Even now, I try to use Marshal.CreateWrapperOfType but it seems to fail
Here is my code for moment
Assembly ctClientServerLib = Assembly.LoadFrom(string.Concat(bfcSetupFolder, "Interop.CtClientServerLib.dll"));
Type applicationClientClass = ctClientServerLib.GetType("CTCLIENTSERVERLib.CtApplicationClientClass");
Type ictSession = Type.GetTypeFromCLSID(new Guid("BCB06C70-AF26-11D3-8C89-00C04F517D7D"));
Type ictProtectedSession = ctClientServerLib.GetType("CTCLIENTSERVERLib.ICtProtectedSession");
Type ictSessionCtx = Type.GetTypeFromCLSID(new Guid("5F852A70-7E77-11D4-8CE1-00C04F517D7D"));
Type ictSessionClient = Type.GetTypeFromCLSID(new Guid("2C3444F9-ED6D-4700-B2EC-F665569FE830"));
Type ictProviderContainer = Type.GetTypeFromCLSID(new Guid("797BB105-AEDF-11D3-8C89-00C04F517D7D"));
Type ictProviderContainer = Type.GetTypeFromCLSID(new Guid("797BB105-AEDF-11D3-8C89-00C04F517D7D"));
object session;
object res;
res = applicationClientClass.InvokeMember("ConnectToServer", BindingFlags.InvokeMethod, System.Type.DefaultBinder, cacc, new object[] { "MyServer", "MyDataBase", new String[] { } });
session = applicationClientClass.InvokeMember("Logon", BindingFlags.InvokeMethod, System.Type.DefaultBinder, cacc, new object[] { "ADMIN", "" });
res = applicationClientClass.InvokeMember("Initialize", BindingFlags.InvokeMethod, System.Type.DefaultBinder, cacc, new object[] { session });
Type ictSession2 = ctClientServerLib.GetType("CTCLIENTSERVERLib.ICtSession");
Type ictSessionCtx2 = ctClientServerLib.GetType("CTCLIENTSERVERLib.ICtSessionCtx");
Type ictSessionClient2 = ctClientServerLib.GetType("CTCLIENTSERVERLib.ICtSessionClient");
Type ictProviderContainer2 = ctClientServerLib.GetType("CTCLIENTSERVERLib.ICtProviderContainer");
var session2 = Marshal.CreateWrapperOfType(session, ictSession);
var sessionClient = Marshal.CreateWrapperOfType(session2, ictSessionClient);
var sessionCtx = Marshal.CreateWrapperOfType(sessionClient, ictSessionCtx);
res = ictSessionCtx2.InvokeMember("SetSessionCtx", BindingFlags.InvokeMethod, System.Type.DefaultBinder, sessionCtx, new object[] { });
var providerContainer = Marshal.CreateWrapperOfType(sessionClient, ictProviderContainer);
object objectManagerClient = ictProviderContainer2.InvokeMember("get_Provider", BindingFlags.InvokeMethod, System.Type.DefaultBinder, sessionClient, new object[] { 1, -523387 });
.
Thanks for help
|
|
|
|
|
Why are you doing all this manually? Can't you use tlbimp to generate an interop assembly and let Microsoft handle the plumbing?
|
|
|
|
|
Hi
Because I use API of a software and it is impossible to install 2 different versions of this software on a same machine
So some methods change depending of the software version. Maybe it is impossible to make this cast so I will find a workaround
|
|
|
|
|
Casting unmanaged objects to managed objects is a daunting task even when things are working properly. And you aren't getting any help if the 3rd-party is changing method signatures between API revisions. That is a cardinal no-no for exactly this reason.
If I had to do this, I would use a mechanism similar to discovering and loading a plug-in at runtime. (And there are articles on CP on how to do that) I would create an interface library that defines a new interface that harmonizes the difference between the two API's. (calling it the harmonized interface) In my application, I would reference that library and use those interfaces in code. Then, I would use the tlbimp tool to generate an initial interop assembly or write my own interop assemblies that will wrap the calls to the specific API versions exposing an object that implements the harmonized interface. The connector libraries would then be responsible for the heavy lifting of marshaling the calls from the harmonized interface to the underlying API-specific objects. In most cases, this should be simply pass-thru type calls but where there are differences I would handle those in an API-specific way in each of these connector libraries.
At runtime, I would need code which detects the correct version of the outside API and loads the appropriate connector library instantiating my interop class(es). Since they implement the common, harmonized interface, my app code would be consistent and the specifics of the underlying API differences are handled in the correct connector library. Where needed, I would use the underlying API version I detected to call (or not call) certain methods on the harmonized interface as appropriate.
The advantage of this approach is that when the API vendor screws you again with a new version that breaks the current API, you can simply write a new connector library and everything continues to work. If new functionality is added, expand the harmonized interface, implement those new methods in ALL of the connectors, but throw exceptions in the ones where the underlying API doesn't support the new functionality.
|
|
|
|
|
It's a terrible way to go, but I do not see a better one.
Using the dynamic keyword in a common base class for some of the types of ThridParty may help reduce coding - but can lead to problems with some interfaces.
|
|
|
|
|
I am trying to develoop an application in c# using Aforge.dll but please anyone give me some idea how to make object (edge detect) through webcam so that i can find approx origina length and breadth
|
|
|
|
|