|
you can add reference to that dll in your project and then call it in your form
To add reference rightclick in toolbox
select add remove items click on browse button and select your dll
|
|
|
|
|
In the project's properties you can change the output type to "class library". (Assuming Visual Studio)
|
|
|
|
|
Guys I can not find a list of all the available interfaces in C#. I have done some googling and have found no shortage of tutorials on this feature. Now I would like a big list, other than IDisposable. I do not see anything in my Visual Studio Doco that lists them all out. How can I learn what they are?
thanks!
|
|
|
|
|
Well - that's a big topic. There is now so much in .NET that you might want to consider looking for the images[^].
|
|
|
|
|
but there is a thing in c# that is similar to interface in java except that it implements contracts.
The syntax is similar to a class. C# has many apparently, where can I find these listed?
|
|
|
|
|
asherhoo wrote: where can I find these listed?
This is why I sent you to the diagrams. The BCL diagrams tend to have them listed. Alternatively, you could write a program to load all of the assemblies and iterate over them and use reflection to identify the interfaces.
I can only assume that you want somebody to list the whole bloody lot out to you, as you obviously didn't go the diagrams I sent you to (hence the reason you univoted).
|
|
|
|
|
Sorry I did go there but google isnt exactly a vorpal sword.
Also your first reply was sort of vague and lead me to believe
perhaps you were referring to some more abstract use of the term
interface. Ultimately I was able to find something of value in
your link, but it required some searching.
so thanks
|
|
|
|
|
You can start here[^], but it's a moving target.
|
|
|
|
|
To reproduce, run code, open file menu, press up and down arrows to move out of menu.
Observed: Menu items are scrolled and blank items appears in end.
I need to change visibility of menu items at runtime.
How to disable such scrolling ?
Is this .NET 3.5 bug ?
Andrus.
using System.Windows.Forms;
static class Program
{
static void Main()
{
Application.Run(new Form1());
}
}
class Form1 : Form
{
public Form1()
{
var menuStrip1 = new MenuStrip();
var fileToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem });
for (int i = 0; i < 10; i++)
{
var item = new ToolStripMenuItem("Item" + i.ToString());
fileToolStripMenuItem.DropDownItems.Add(item);
if (i < 5)
item.Visible = false;
}
fileToolStripMenuItem.Text = "File";
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
}
}
Andrus
|
|
|
|
|
with Vista, Studio 2008, targetting either 2.0 or 3.5, I observe one empty menu item line
appearing either at the top or the bottom of the list. Strange indeed.
BTW: disabling the hidden items does not help things.
|
|
|
|
|
Calling Dispose() makes them invisible properly.
However I need to make them visible later, so it is not possible to use Dispose().
Andrus
|
|
|
|
|
When I need varying menus, I do one of two things:
1.
temporarily remove the items I don't need
2.
throw away all items and create all new menu items when the menu gets selected
and I know something needs a change.
BTW: just hiding items (Visible=false) is wrong anyway, what will happen to the
shortcuts (CTRL/C and the like) that got assigned to you items? Removing is OK here.
|
|
|
|
|
Just for comparison,
Same configuration, but no empty items in the menu. I've installed all possible updates so maybe there's the difference.
However, Luc had a very good point why removing items would be a better choice.
Mika
|
|
|
|
|
|
|
I have a large winforms menu system designed using Windows forms designer in MDI parent form.
Some menu items should not be visible to user who logs in.
I have also command "login as different user" in this MDI parent form which allows other user to log in without exiting main form.
For this command I need to make some other menu items visible.
How to implement Main menu visibility in this case ?
Andrus
|
|
|
|
|
Either disable the items (they remain visible, readable, but are not selectable)
or remove them temporarily, by taking them out their regular collection and keeping
them in another collection, not associated with any live menu.
|
|
|
|
|
Either disable the items (they remain visible, readable, but are not selectable)
In this case are are 50 disabled items in menu different menus. This looks ugly to user. So it is not possible.
or remove them temporarily, by taking them out their regular collection and keeping
them in another collection, not associated with any live menu.
I shoudl also member menu item position in menu tree system and placement. Where to find sample code which implements this ?
Andrus
|
|
|
|
|
I have no sample code.
You could work the other way around:
- use Designer to design the maximally populated menus;
- then programmatically remove them in globo from the main menu structure, but keeping
them around;
- and provide the appropriate subset by copying the items you want to keep into
the main menu structure again.
That way you always know what the exact population and order of the original menus was
and you can easily create any subset you want.
|
|
|
|
|
- use Designer to design the maximally populated menus;
Done.
then programmatically remove them in globo from the main menu structure, but keeping
them around
I tried in main form load
ToolStripItemCollection Copy = MainMenuStrip.Items.Clone();
but got compile error
'System.Windows.Forms.ToolStripItemCollection' does not contain a definition for 'Clone' and no extension method 'Clone' accepting a first argument of type 'System.Windows.Forms.ToolStripItemCollection' could be found (are you missing a using directive or an assembly reference?)
Andrus
|
|
|
|
|
I haven't done this with ToolStripItems yet.
There seems to be a CopyTo() that may be useful.
|
|
|
|
|
CopyTo() copies only top level menu items. Child items are not copied. So child items are destroyed i sLoad and not restored if new user logs in
How to clone whole menu tree ?
partial class MainForm : Form {
ToolStripItem[] Copy;
protected override void OnLoad(EventArgs e) {
Copy = new ToolStripItem[MainMenuStrip.Items.Count];
MainMenuStrip.Items.CopyTo(Copy, 0);
SetVisibility(MainMenuStrip.Items);
}
void NewUser_Click(object sender, EventArgs e) {
MainMenuStrip.Items.Clear();
MainMenuStrip.Items.AddRange(Copy);
Copy = new ToolStripItem[MainMenuStrip.Items.Count];
MainMenuStrip.Items.CopyTo(Copy, 0);
SetVisibility(MainMenuStrip.Items);
}
void SetVisibility(ToolStripItemCollection items)
{
foreach (ToolStripItem item in new IsolatorCollection(items))
{
if (item.Tag != null)
if ( CurrentUserShoundNotSeeThis(item.Tag))
items.Remove(item);
ToolStripDropDownItem dropItem = item as ToolStripDropDownItem;
if (dropItem != null)
SetVisibility(dropItem.DropDownItems);
}
}
Andrus
|
|
|
|
|
BTW: just hiding items (Visible=false) is wrong anyway, what will happen to the
shortcuts (CTRL/C and the like) that got assigned to you items?
I set both Visible and Enabled to false. In this case shortcuts are disabled also.
Andrus
|
|
|
|
|
first of all i would like to say that i am very new to programming and also to .net .
now i have a problem.
i have two dropdownlists:
1) dropdownlist 1- having 2 items ex: male and female
2) dropdownlist 2_ having 4 items ex: dog, cat, fish, cow.
now the problem is :
if i select male then all the four options should be visible , but if i select female then dog, cat and cow will be visible but not fish.
please send me the code both by help if items are hardcoded by itemlist and if we want to manipulate through database(sqlserver 2000).
please help me , and reply me fast.
thank you
|
|
|
|
|
As fast as I could, it might not compile tho...
HAI
CAN HAS STDIO?
I HAS A dropdown1 ITZ ARRAY
I HAS A dropdown2 ITZ ARRAY
BTW array assignments
LOL dog IN MAH dropdown2
LOL cat IN MAH dropdown2
LOL cow IN MAH dropdown2
I HAS A gender IN MAH dropdown1 ITZ YARN
GIMMEH gender
IZ gender LIEK "male"?
YARLY
BTW the male case
LOL fish IN MAH dropdown2
NOWAI
BTW the female case, no other assignment necessary
KTHX
KTHXBYE
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|