|
Saira Tanwir wrote: is there any other way other than through the visible property.
They hide that information in the documentation[^]
but the property should work for all the child controls of the panel. If it doesn't then you must not have the other controls as children of the panel.
led mike
|
|
|
|
|
plz guide me on making child control on a panel.
i simply add controls by draging them from the toolbar onto the panel
|
|
|
|
|
Control visibility is hierarchical, if you hide a control (by setting Visible=false)
all its children are also hidden; other controls, that are not children of it,
will not be affected even if their coordinates are such that they overlap and seem
to "belong" to the panel.
So it all boils down to: make sure the controls you want to hide by hiding the panel,
have been added to Panel.Controls, and not directly to Form.Controls
Luc Pattyn
|
|
|
|
|
do we add controls to Panel by Panel.Controls property or is there any other method.
do tell cause i'm pretty new to C#.Net
|
|
|
|
|
to add controls to a panel, you program it like this:
Label lbl=new Label();
myPanel.Controls.Add(lbl);
if you are using Visual Studio Designer, just have a look at the code
it generates for you, and you will find such statements in a method
called "InitializeComponent" it generated for you
you are not supposed to edit this method, since that could confuse (maybe crash?) the
designer afterwards.
Adding a new control to a panel with Designer is automatic: if you click inside the panel
to indicate where and how large the new control is going to be, it is automatically added
to the panel, not to the form.
But copying with Designer, I don't know how to specify where it belongs. Just dragging
is NOT sufficient. You can get it right by trial and error, keep looking at the Property
pane, for the Location property, it is always relative to the parent, so if, while dragging
your new control suddenly has much smaller x,y values then it has been adopted by the
panel !
Luc Pattyn
|
|
|
|
|
thanks a lot buddy
u made my day
regards
Saira
|
|
|
|
|
Hi,
An application written in C#-VS2005 needs to use a class exported in a VC6Dll.
I have googled around a bit about Data Marshalling using P/Invoke. But all I could find is information on how to use the exported functions from a dll OR a struct from a dll.
I could not find any info on how to use the (exported,unmanaged) class of the dll in my C# App.
Any help or link woud be helpful.
Thanks and Regards,
Arti Gujare
|
|
|
|
|
|
Hi Led,
I did have a look at this site. For each class to be used from the dll a skeleton(StructLayout) of that class has to be defined in the project using that dll. However, the dll I am talking about is huge and consists of too many classes. I have approximately 16 exported classes which I would be using. 1) Is there a better way to do this?
These classes again have member variable as objects of other classes not exposed from the dll.
2) Could you tell me how to write the StructLayout for a class having private members as objects of other classes.
Regards,
Arti Gujare
|
|
|
|
|
I noticed a huge difference in time in zipping a folder (which contains x amount of files) and selecting the files inside and zipping the x amount of files inside the folder). Why is that?
|
|
|
|
|
1 - Is this the appropriate place to ask.
2 - Can you explain what you mean, you're not being very clear.
I have no idea what I just said. But my intentions were sincere.
Poore Design
|
|
|
|
|
I have a c# .net program...which generates pdf files. After all of them are generated I zip them.
Now, I had about 330 files a total of 112 MB. My program was taking an awful lot of time to zip these files. I decided to zip manually to see how long it takes. These 330 files are in a folder. If i right click on this folder and click send to compressed folder it is a lot faster than selecting all the files at once (i mean going inside the folder and selecting all the 300 files all together) and clicking send to compressed folder.
|
|
|
|
|
When your program zipped all those files, did it instruct the ZIP library to do that as a
single operation, or was it a for loop adding one file at a time ? For all ZIP stuff
I have seen, each ZIP operation tends to create an entirely new ZIP file in a temp directory...
Luc Pattyn
|
|
|
|
|
It may also be the fact that the GZipStream in the framework is managed and might be slowing things down slightly whereas the one in explorer is unmanaged.
Just a thought although I think the previous comment is more likely.
I have no idea what I just said. But my intentions were sincere.
Poore Design
|
|
|
|
|
I have a program (which I didn't write) which I run from a shell (which I did write).
The program I didn't write minimizes to the system tray upon startup.
In my shell I would like to create a method to restore the program from the system tray. I have the process handle, but I'm not sure what I should do with it. I suspect I have to do some fancy windows API stuff, but not sure what.
Any pointers in the right direction would be really helpful
Cheers
triff
|
|
|
|
|
this will require several PInvokes to Win32 functions; I do not know all the details, but
this I can tell you:
you need to get a handle to the main window of that process,
then send a message to that window with ShowWindow(SW_SHOWNORMAL).
Getting the main window is not straightforward,
you probably need EnumWindows() which enumerates all top-level windows,
and then some means to recognize the one you need,
either based on its title or its main thread's ID (GetWindowThreadProcessId)
Careful though, there is a Thread.ID in .NET, I am not sure it corresponds to the
Win32 thread ID.
Luc Pattyn
|
|
|
|
|
triff wrote: fancy windows API stuff
I believe you would have to use the SendMessage() API which of course requires a HWND, so you need to look into the API's for Processes and Threads to get the HWND from the Process Handle. Something like EnumThreadWindows() maybe.
led mike
|
|
|
|
|
You could get the the Process object for that process by calling Process.GetProcesses[^] and then get the window handle of the process using Process.MainWindowHandle[^] property. Once you have the window handle, you could P/Invoke ShowWindow, passing the window handle and the corresponding message (SW_SHOWNORMAL = 1) as the parameter.
|
|
|
|
|
I like that, but you can still improve it:
rather than getting a collection of processes, and searching for the right handle,
you could obtain the process ID (a simple PInvoke to GetProcessId),
then use Process.GetProcessByID().
Luc Pattyn
|
|
|
|
|
I can't make it work, here is my try:
Process[] localByName = Process.GetProcessesByName("****");
if (localByName.GetLength() > 0)
{
IntPtr hWnd = localByName[0].MainWindowHandle;
if (!hWnd.Equals(IntPtr.Zero))
{
if (IsIconic(hWnd))
{
ShowWindow(hWnd, SW_RESTORE);
}
SetForegroundWindow(hWnd);
}
}
I have also try SW_RESTORE, SW_MAXIMIZE, SW_NORMAL, all failed.
Any ideas?
every art is science
every science is art
|
|
|
|
|
Lots of ideas:
- I dont recognize your approach; the original question had the process handle available,
and my original suggestion was to get all processes and search for the one with the
matching handle; you seem to rely on process names instead.
- I dont expect a process ever is named ****
- you must realize the process name should not include the ending ".exe" (unlike what is
shown by task manager)
- finding a process by name is not very safe, there could be many, even some you dont
expect; the original question was on a process known by ID (which is unique).
- getLength() needs one int parameter, your code would not even compile
- if it runs but fails to do what you hope, it is time to add log statements showing
intermediate values (the length of the process array, the process name,
the window handle, etc.), so you have a good chance of spotting the problems
if and when they arise. Actually you should add those statements before your first run,
since the first try is bound to fail anyway.
- I expect Process.MainWindowHandle to return zero for invisible windows, so when
iconified it wont work that way.
- Search CP for MainWindowHandle or use old Win32 functions and PInvoke (as in my
original reply).
Luc Pattyn
|
|
|
|
|
woow, a very profound reply. thumb
Yes, I should use getLength(0) rather than getLength(); You are absolutely right.
In our problem, basically we want to maximize another process window, which only allowed one instance.
Maybe use GetProcessbyId() is better, but in our case, I suppose the process handle I have got is also unique.
At the end of the day, I realized the problem was the **** application, which is also implemented by someone else(not me), disabled all system message except SW_MINIMIZE.
Anyway, thanks for all replies.
every art is science
every science is art
|
|
|
|
|
Hi,
Been searching on how to connect to a microsoft access db database located on a server like http://www.blablabla.se/myFolder/database.mdb
My working connection string is something like:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database.mdb";
and it works locally.
But how do i set up the connection string to a remotehost location with login and pwd?
Daniel S
|
|
|
|
|
You can not connect to an Access database via the HTTP protocol.
If you have the database on a different server, you need direct access to the server via the file system, so that you can use a path like "\\servername\folder\database.mdb", or map the folder on the server to a local drive letter.
---
Year happy = new Year(2007);
|
|
|
|
|
Hmm,
This is what i have to connect against ftp.infografix.nu and then i have login/pwd...
could you please supply how the connectionstring would look like cause i cant seem to get it to work
|
|
|
|