|
Can anyone tell me how to create a Visible Control and add it to a C# form?
|
|
|
|
|
Do you mean adding controls in run time or design time?
Can you explain more question?
|
|
|
|
|
I need to draw line(arrow) between 2 controls in a panel,
this line outside from and income to control Bounds,when move that
control by mouse the line follow the control
--------
this line can be over the control
|
|
|
|
|
You draw lines in your paint method handler. You can get the position of the controls from the controls themselves and then draw your line, using DrawLine on the Graphics object passed into the paint event.
Moving your controls via the mouse is another issue.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
how can i copile C# projects (with VS 2005) for netFrameWork 1.1 ...
i intstalled Vs2005 and so netframework2 installed .. so every projects for netfr..2 .. and dont work with only netFrame..1.1
??
(sorry for my bad English )
|
|
|
|
|
There's no easy way as far as I know, this did come up a few days ago in one of CP's forums but I can't remember which (I think it was this one).
I seem to remember that there is a build of MSBuild (no pun intended) that targets .NET 1.x and since the VS2005 solution files (or project files) are glorified MSBuild files then you can build the solution with MSBuild targetting .NET 1.x.
But unless you write some form of macro or add-in I don't think that there's a way to accomplish this from within VS2005 but you can do it outside the environment.
Ed
|
|
|
|
|
oo this bad for me.. thank ou Ed .. and any other solution for this.. i will wait..
-- modified at 17:17 Tuesday 11th April, 2006
|
|
|
|
|
Why do you need to run stuff under 1.x if you have 2.x?
Ed
|
|
|
|
|
yippie i found .. thanks Ed.. but this is lon long way.. no other way , so i will try this.
(i tagged with code so any adv. link bla bla)
http://weblogs.asp.net/israelio/archive/2005/06/08/410811.aspx
-->> this boy reads this info from msdn blogs [until now i will search from there,, this is better way.. and offcourse i will write what i learned ]
you ask: Why do you need to run stuff under 1.x if you have 2.x?
i will show my projects to my friends,teasher and others.. we are using 2003 in school and the computers dont have netfr..2.x and i have no permission to install vs 2005 ..
thats why i need this..
thanks
-- modified at 17:28 Tuesday 11th April, 2006
|
|
|
|
|
If you're using the full copy of VS2005 and not the express versions then you could write a macro which calls MSBuild to build it targetting .NET 1.x, then map a keyboard shortcut to this macro so that at a keypress you can build the .NET 1.x version.
Of course you need to make sure you don't use any of the new classes available in .NET 2.0.
Ed
|
|
|
|
|
I think this might be possible, but because of the difference in the compilers between 1.1 and 2.0 and the framework it may prove to be a challenge.
One method to get around this, is to compile the project using the 2.0 compiler and forcing the compiled 2.0 assembly to run using 1.1 when 2.0 is absent. To do this, add this section to your App.config file:
<configuration>
<startup>
<supportedRuntime version="v1.1.4322"/>
<supportedRuntime version="v1.0.3705"/>
<supportedRuntime version="v2.0.50727" />
</startup>
</configuration>
Regards, Graham
|
|
|
|
|
microsoft developers says interesting words [this is stupid i think:a pruduct cant running at older versions. ]
their soutions are long long ...
Have you seen my MSBuild Toolkit yet?all links are bad in m!cro$oft blogs.
-- modified at 2:31 Wednesday 12th April, 2006
|
|
|
|
|
|
Hi everybody
I am developing an aplication to conect with a Microsoft Access database. I need to know wich drivers i need to install in a PC with Windows ME, to make this software functional, because i install yet the .net framework, but when the application tries to connect to the database, it throw an exception.
|
|
|
|
|
Try hunting for Jet 4 (Jet is the name of the Access driver) on the MSDN website. I can't remember which version it's currently at sorry...
Ed
|
|
|
|
|
I have a case where several objects may trigger an event that is handled in one place. I use the sender object type to determine whether I should perform some task on the object. However, how can I catch the condition where an object inherits from the type of object I am interested in? I'd like to include that object as well.
Here is an example of what I am doing:
<br />
if (sender.GetType() == typeof(CMyClass) )<br />
{<br />
}<br />
If something is derived from CMyClass, I'd like it to go through the "Do Something" code. How can I check for it?
|
|
|
|
|
Just test if you can cast it to the other class/interface:
if (sender as CMyClass != null)
{
}
|
|
|
|
|
Ah, thanks! That is what I wanted.
In case anyone else is interested, another way to handle this issue (or get around it) is by associating your base class with an interface. All inherited classes are also of the same interface so I was able to do something like this:
if (sender is ISomeInterface)
{
}
|
|
|
|
|
Use the is keyword:
if (sender is CMyClass) {<br />
}
---
b { font-weight: normal; }
|
|
|
|
|
Ah! This is what I want. Thanks.
|
|
|
|
|
Apologies for the rather vague thread title, it is difficult to summarise this question.
I would like to make sure I havent broken any cardinal sins with the following implementation of a delegate. Essentially I have the following classes:
class MyClass
{
public delegate void MyDelegate(string s)
private object delegateObj;
public MyClass(MyDelegate md)
{
this.delegateObj = md
}
public void DoSomething1(string s)
{
(this.delegateObj as MyDelegate).DynamicInvoke(new object[] { s });
}
}
class Worker
{
public void DoSomethingA()
{
MyClass.MyDelegate delegateObj = new MyClass.MyDelegate(MyFunction);
MyClass mc = new MyClass(delegateObj)
mc.DoSomething1("hello");
}
public void MyFunction(string s)
{
Console.WriteLine(s);
}
}
The reason for this is that I dont want to have to pass the a reference to the delegate every time I call the DoSomething1 method.
public void DoSomething1(string s, MyDelegate md)
{
md(s)
}
I couldnt find a way to store an instance of MyDelegate directly so in came the object and as cast and DynamicInvoke . While this seems to work fine, but as I am fairly inexperienced with delegates it just seems a little flakey to me.
An alternative would be this:
public void DoSomething1(string s)
{
(this.delegateObj as MyDelegate)(s)
}
Although I have a feeling that under the hood this is exactly the same
|
|
|
|
|
With the following declaration you can avoid the casting:
private MyDelegate delegateObj;
Also I would recommend your alternative to invoke the delegate because it is typesafe (you could put any kind of objects into the DynamicInvoke call - the compiler won't complain).
|
|
|
|
|
Hello, all. I'm writing a little app that lives in the system tray. I'd like to display a different context menu for the NotifyIcon control based on whether the user clicks the left or right mouse button. However, I can only get the context menu to display on a right-click, which is the NotifyIcon control's normal behavior. From doing a bit of reading on the internet, I've seen that the NotifyIcon control is not really a control but a component, though I'm not sure of the differences.
Anyone have an idea on how I could make this work? The less hack, the better... but I suppose I can't be too picky since I can't get it to work now anyway. Any help would be most appreciated. Thanks.
|
|
|
|
|
Have you tried catching the click event of your notify icon and calling the Show method of your context menu inside the event handler.?
www.troschuetz.de
|
|
|
|
|
Yep. Unfortunately, that produced some odd results. The context menu ends up showing at the top-left corner of the screen (0,0) instead of around the system tray where the mouse was clicked. Setting the top and left properties didn't seem to make a difference, it still stayed in the same position at the top-left of the screen. Any other thoughts would be appreciated.
|
|
|
|