|
Why did you ask twice ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
I have a project where I have a lot of panels on my form. It gets to be a hassel moving them front/back to edit them. Is there a way to encase the panel in a class, so I can just make it visible or invisible from class calls and not have to have it cluttering up my form during normal editing.
For example, I have a color picker panel which includes a listbox of all the color names and a picture box that I use to display the color and its name (using graphics). I can see where I could use this in several projects and don't want to have to recreate it everytime.
Gary Strunk
|
|
|
|
|
Hi,
you could create a class as in public class MyPanel : Panel {...} by creatind a code file; such Control would, after one build, be available for use by Visual Designer through the Toolbox, without residing in a separate DLL file.
or you could create a UserControl in a separate DLL file, as in public class MyPanel : UserControl {...} ; that way you can include the same DLL in other projects, and you can set its properties through Visual Designer when including it in say another Form.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi
you create a Usercontrol & insert all the panel u need. So that U can use it anywhere without recreating it.
|
|
|
|
|
I have part of my app which enumerates all video camera devices present and presents them in a drop down list. I have two Logitech web cams which have the same name, but when I click on the drop down button, only one of the cameras are listed. How do I make it so that both are displayed? If possible, how can I add a number or ideally a port number to differentiate the two instances of the web cams?
This is my code:
<pre>
public MainForm()
{
InitializeComponent();
// collect cameras list
try
{
// enumerate video devices
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (videoDevices.Count == 0)
throw new ApplicationException();
// add all devices to combo
foreach (FilterInfo device in videoDevices)
{
camerasComboLeft.Items.Add(device.Name);
camerasComboRight.Items.Add(device.Name);
}
camerasComboLeft.SelectedIndex = 0;
camerasComboRight.SelectedIndex = 0;
}
catch (ApplicationException)
{
camerasComboLeft.Items.Add("You ain't got no LEFT CAMERA son!");
camerasComboRight.Items.Add("You ain't got no RIGHT CAMERA son!");
videoDevices = null;
}
EnableConnectionControls(false);
}
.... rest of the app
</pre>
|
|
|
|
|
I guess you need to check if the name is already in the list, and if so, append a number to the name. In that instance, I am assuming you need to add the FilterInfo to the combo box, and set the DisplayMember to be the Name property, otherwise, how do you tell which is which, if not by name ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
|
What you could do is check the documentation and watch for some OpenFileDialog Properties; I bet some of them even have "Directory" in their name.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
Collin Jasnoch wrote: What documentation?
You are using OpenFileDialog and having some trouble with it, hence read its documentation. It is all in there, Google if you don't know where to find it, then read the page and learn.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
Yeah, you confused me there. If you are not using OpenFileDialog, then read up on the documentation of the code you are using or contact its provider. Chances are they intended to mimick OpenFileDialog though.
When a relative path (or just a file name) is specified, .NET (and Windows) will rely on the "Current Directory" which by default starts out to be the folder holding your EXE file; however there are many ways to change it on the go (and even at app start), so it is not a recommended way of doing things.
Better set things explicitly; also have a look at the "special folders", see Environment.GetFolderPath()
with SpecialFolder.ApplicationData and CommonApplicationData (you should use a folder hierarchy in there, based on your company name and/or product name).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
Collin Jasnoch wrote: Bitmap bmp = new Bitmap(img); will not work if img is an absolute path.
Then something is wrong with your path. Did you confuse forward and backward slashes? are you referring to a case-sensitive file system (as in UNIX/Linux)? Did you forget a slash between path and name? Did you make a mistake in escaping a backslash?
Don't go the CD way if you don't have to, fix the real problem instead.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi, I need to change the BIOS configuration from c#, to enable or disable a Network Adapter.
Thanks
|
|
|
|
|
I have seen lots of articles/blogs on reading BIOS settings. I'm not sure that writing them is possible, could be, but I'm not sure.
In any event, would that be the right place for Network Adapter configuration?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks, but I need to write the BIOS to enable LAN.
|
|
|
|
|
After your first post, I did a little googling, and found this article[^]. It seems that you can treat the CMOS like ports 70 and 71, I assume one for reading and one for writing, though I could well be wrong on that.
Hope that it at least gives you some clues on how to proceed.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I don't know if this will help you, but take a look at this[^]. Click the first link to download the code.
It's got to be better than messing with the BIOS, one slip and you've got a doorstop.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks, but this code works if the network is enabled in the BIOS and doesn't work on Windows Vista. I need on Vista and XP.
|
|
|
|
|
Is there a way for a custom control on a form to tell if it's being called in design mode.
I tried using the DesignMode member in the constructor, but if the control is on a form in the designer DesignMode has a value of false.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
TopLevelControl.DesignMode?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
TopLevelControl doesn't have a DesignMode property.
Google's turned up a few fugly hacks, but there doesn't seem to be any supported way to check this from within the constructor itself.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Sorry, I didn't realize DesignMode is protected, not public.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|