|
Set the ContextMenu property of the textbox as follows:
<textbox object="">.ContextMenu=new ContextMenu();
Now the ContextMenu for that textbox that contains Cut,Copy,Paste will not appear(Indeed no ContextMenu for that TextBox will appear). Consequently no one could cut,copy,paste. If you have defined any Shortcuts for your TextBox for cut,copy,paste, then set the EnableShortCuts property to false too.
Regards,
Wasif Ehsan.
|
|
|
|
|
Hi,
I'm creating an application where several images are display on a 'canvas'. When the user selects an image I draw a dotted outline to show the selection. However, in C++ I would have painted with a brush that 'inverts' the colour beneath it so that the line is visible on top of any colour. Is there a similar brush, pen or effect available in .Net?
Many thanks,
Simon
|
|
|
|
|
The ControlPaint.DrawReversibleFrame method is probably what you're looking for.
Josh
|
|
|
|
|
Thanks Josh, it's useful to know about the ControlPaint class. Unfortunately I need to paint the selection rectangle onto an imagebuffer as part of a layered composition. So far I'm using "g.DrawRectangle(p, r);" with a dashed style pen. If only I could set the pen to have a 'reversible' ink.
|
|
|
|
|
|
Varun_soft11 wrote: simply how can I achieve this
I'm sorry if I sound harsh, however, with your title of Software Engineer you shouldn't have to ask this question.
If you want to address some of the potential problems with a networked solution that is different, please ask a more specific question about your proposed solution, not how to do it.
|
|
|
|
|
I have a csharp user control that displays thumbnail images.
THis control has to be added to a CDialogBar. It is such that i am developing the UI in csharp with vc++ classes at the backend.
Does anyone know to go about doing this? Is COM required to go about implementing the same.
scorpion_pgm82
|
|
|
|
|
Hi folks!
I'm a little stumped at the moment and don't know where to look, so can anyone please give me a little kick-start?
I've got a remoting application and want to find out the version of the assembly the remote type is loaded from. To make the question a little clearer:
Both the server and the client have an assembly "x.dll" containing the MBRObject-derived type that's being used with remoting, let's call it "MyServer".
The client creates an instance of the remoting object using
MyServer srv = (MyServer)Activator.CreateInstance(typeof(MyServer)); in combination with a config file to get a reference to the remote MyServer instance.
When I look at srv.GetType() I get the type information from x.dll at the client.
What I need is a way to get the type information (or rather assembly information) for x.dll at the server, because the versions of these 2 assemblies do not neccessarily match and I want to find out if there are any incompatibilities.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Can you not trace the assembly/type version on the server when its started?
|
|
|
|
|
Hi Leppie!
I guess I could, but that would require some change to the remoting server, wouldn't it?
The problem is that - initially - x.dll on the Client and on the Server are identical (or at least compatible).
Now the server remains unchanged, but the client's x.dll is updated.
The new version has a method the old version doesn't have yet.
So everything will continue working as long as the new method is not used.
As soon as I use the new method at the client, the client gets a RemotingException saying that the method could not be resolved. Of course. The local type has the method, but the remote proxy doesn't.
I want to catch exactly this case before it happens, so I need a way to find out the assembly version of x.dll at the server _without_ modifying the server itself.
Any idea?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
You could modify the client to obtain the version info about the assembly on the server, the remoting server wouldn't need to be modified at all.
Such as: FileInfo("\\RemotingServer\MyObject.dll")
Of course the obvious solution would be to not allow the the client and server assemblies to be modified seperately. Click-Once deployment is a big help in this if you can use it.
|
|
|
|
|
Hi Mark!
Thanks for the suggestion, but I'm dealing with an existing .NET 1.1 application (so no Click-Once is available and it doesn't help with the general possibility that the assemblies don't match).
To be able to get the FileInfo I'd have to have access to the server's directory, which I don't have.
Thanks anyway!
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hello everybody,
I have a problem while trying to make a monitoring server with WMI. I have arround 400 check to do on 15 servers. After 5 minutes a lot of port on my server are un TIME_WAIT state, so I get a RCP-server not avalaible I've reduce the TIME_WAIT timeout but nothing change...
Is there a way to close the WMI connection, I'm using ManagementScope... Here's a part of my code
<br />
public WMIRequest(string Username, string Password, string IP)<br />
{<br />
<br />
aConnectionOptions = new ConnectionOptions();<br />
aConnectionOptions.EnablePrivileges = true;<br />
aConnectionOptions.Username = Username;<br />
aConnectionOptions.Password = Password;<br />
this.IP = IP;<br />
}<br />
public bool Connect()<br />
{<br />
aManagementScope = new ManagementScope(@"\\"+ IP + @"\root\cimv2", aConnectionOptions);<br />
aManagementScope.Connect();<br />
return aManagementScope.IsConnected;<br />
}<br />
<br />
public string Request(string Request)<br />
{<br />
aObjectQuery = new ObjectQuery(Request);<br />
aManagementObjectSearcher = new ManagementObjectSearcher(aManagementScope, aObjectQuery);<br />
aManagementObjectCollection = aManagementObjectSearcher.Get();<br />
string Result = "";<br />
<br />
foreach(ManagementObject aManagementObject in aManagementObjectCollection ) <br />
{<br />
if(aManagementObjectCollection.Count > 1)<br />
Result += "|#*#|";<br />
<br />
foreach (System.Management.PropertyData aPropertyData in aManagementObject.Properties)<br />
{<br />
if(aManagementObject.Properties.Count > 1)<br />
Result += "|#|";<br />
Result += aPropertyData.Name + "|*|" + System.Convert.ToString(aManagementObject[aPropertyData.Name]);<br />
}<br />
}<br />
return Result;<br />
}<br />
I hope somebody has already resolved this problem...
Thank you
Nicolas.
|
|
|
|
|
Hi,
I have a similar problem.
Did you solve this?
In that case I would really appreciate your help.
/M
|
|
|
|
|
The paint event is handled upon a form is loaded:
Panel.Paint += new System.Windows.Forms.PaintEventHandler(Panel_Paint);
And I have added the panel.Invalidate() method in the treeView1_AfterSelect event. There are unwanted text for the default node. But when I select another node and get back to the default node, the unwanted text is gone.
I tried to debug it and accidentally found that the paint event is handled even without the Invalidate() method (well, it works for the first few nodes but not the rest). I'm just wondering how does the program know when to paint those text - ie. when it is triggered to paint.
It seemed to me that only the text for the default node has been painted twice. So if I can understand how the paint event is triggered, that might help to confirm whether it has been painted twice.
-- modified at 3:40 Friday 23rd June, 2006
|
|
|
|
|
Hi all!
i am using now the TreeView control on a form and i have a problem, i do not see the tree, i mean i run on the elements of my XML and the tree node is filling up but i do not see nothing, a blank white square, this is the function:
treeView1 = new TreeView();
treeView1.BeginUpdate();
XmlNodeList elemList = xmldoc.GetElementsByTagName("title");
for (int i=0; i < elemList.Count; i++)
{
TreeNode newNode = new TreeNode();
newNode.Text = elemList[i].InnerXml;
treeView1.Nodes.Add(newNode);
}
Can you please help?
|
|
|
|
|
Hii All,
I m working on a Desktop Based Application in C#.
I need to bind the data in datagrid in the following format ->
|---------------------------------------------------------------------|
| Some Text in Link Button |
| some Text in a label |
| Some Text in lable ChekBox |
|---------------------------------------------------------------------|
| Then 2 nad Row and so on.... |
| |
| |
| |
|---------------------------------------------------------------------|
Thanx
Anuj
-- modified at 1:55 Friday 23rd June, 2006
|
|
|
|
|
Hi,
i have developed an asp.net application.In that application i am getting the user information.i have 2 button,one web control[ok button] and anpother html control [reset button].While entering the user information,when i press esc button it is calling reset button and all the fields values are resetted. how can avoid this problem? i have seen this problem in many of the sities.[Example - Rediff.com while creating new user]
Any ideas?
Thankz in advance.
With Regards
[S.P.Saravanan]
|
|
|
|
|
|
Just as all seems clear, something comes along that blows way one's fundemental assumptions about life etc.
How can an object determine the type of object by which it was instanced - essentially who done the new that bought me to life.
I assumed "this" was about the current instance, one of the things that annoys me about "this" it's baggage.
I wanted to know the context in which a particular class member (a set accessor) was being used, and I thought a'ha there must be something in all that "this" baggage that will give me the name of the instancing class - but I can't find it - it seems I can get lots of info about "who" I is, but precious little about "where" I is.
I thought I'd try walking the stack, but I can't find that either, not even 42.InstancingClass works
mad:
Squarks - PhilD
|
|
|
|
|
You probably want to know about reflection. http://my.execpc.com/~gopalan/dotnet/reflection.html .
This is a pointer to the current object. It's not baggage because it is useful for all sorts of function calls referring to the object itself (among other things the compiler must have it for).
"I wanted to know the context in which a particular class member (a set accessor) was being used, and I thought a'ha there must be something in all that "this" baggage that will give me the name of the instancing class - but I can't find it - it seems I can get lots of info about "who" I is, but precious little about "where" I is."
Do you mean you want to know which class was calling this object? That's more difficult, and usually if your using reflection, it means you did something wrong anyways. Try redesigning your code to avoid it.
J
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
Totally agree, a member should not need to know its instancing class - what I have to do is to log events based on the values of the objects properties, the most sensible place to do that is in the object set accessor. In addition to logging the objects properties, I am also required to log the event context, what better way than to include the instancing class tree, the defining class tree is of little consequence in this scenario. And we'd prefer that the instancing classes not know that the objects are being monitored.
The annoying thing is that I can see all the information I want- its in the stack window.
I'll read Gopalan's article - I've been trying to avoid knowing about Reflection, not on principle, but because my brain has a limited learning capacity, on the threshold of which I currently exist.
Thanks for your response - rgds PhilD
|
|
|
|
|
Hi,
you are looking for the StackTrace[^] class. Just create a new instance and will contain all information you need.
Robert
|
|
|
|
|
Thank you robert - I knew it had to be there somewhere MS rarely let developers down
|
|
|
|
|
Why don't you have the instantiating class supply the necessary data to the instance? Unless it's methods that you're after, that if needed to be shared could be in another class and/or static.
this only provides a reference to the current instance of the class. It will only access members of that instance.
Generally speaking, a class holds necessary data, and performs necessary functions based on that data, to represent a finite piece of the problem domain. If you're class doesn't have all the data it needs, you have a design problem. It shouldn't need to look elsewhere for what it needs.
Try code model generation tools at BoneSoft.com.
|
|
|
|