|
Hi,
we all know how to dock or anchor controls so that they resize themselves accordingly when a form is resized. It works fine till we have rows of controls on left and right size of the form. But what if have three columns (Columns as in visual sense. I'm not talking about any column control containing other controls) of controls? For example a form having a bunch of controls in the left side, a bunch in the middle and a bunch in the right. There may be a few more bunches in the middle. Now while resizing the form, I want the controls to resize accordingly as well as change their positions to make space for the previous bunch of controls that are resizing.
I mean, while the user increases the form size horizontally, the controls of the second bunch should resize and at the same time they should move right because the controls of the first bunch are increasing horizontally too. When the user decreases the form size horizontally the same thing should occur in the reverse order.
I can manage it somehow using nested splitcontainers but that's too cumbersome. I would like to know if there's some better way to achieve it, like setting some property etc.?
Please help. Please feel free to ask if my post isn't comprehensible. Regards.
|
|
|
|
|
|
I worked with TableLayOutPanel till late last night. Though it's time consuming but it resolved my issue. Thanks a lot.
|
|
|
|
|
Great if you got it to work. I've used the same for a control that needed very specialized resizing requirements.
|
|
|
|
|
Hi!
I've to set a Mouse Over(Hovering) image to a button in Windows Forms C++. How to do this?
|
|
|
|
|
Try posting in the Managed C++ forum, and you may get a better chance of an answer.
I must get a clever new signature for 2011.
|
|
|
|
|
Are there any alternatives to using a listview in new versions of .Net? I like listviews but the versions of .Net I use (2005 & 2008) require coding to be put in to sort the listview. It would be nice to be able to use a control that has sorting already built in.
Thank you,
Chad
|
|
|
|
|
A DataGridView has default sorting; so does a ListBox. And obviously you can disable or override it.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I agree. DataGridView can do so much more. Many of the examples on line are VB or C#, but it doesnt take much to turn the C# to C++/CLI if needs be.
Ger
|
|
|
|
|
A DataGridView is always heavier (in terms of resources) when compared to a list view (due to the number of features it offers). So use a ListView unless you absolutely have to use a grid view.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
|
I'm writing a program to encrypt and decrypt file on the fly, i used filter driver but miss read and write when the application use "mapviewoffile". i don't know how solve this , please help me.
|
|
|
|
|
First, what does this have to do with Windows Forms?
Second, you do realize that NTFS already has the encryption engine built into it, right?
As for your problem, it sounds as though you're putting your encryption driver above NTFS instead of below it (close to the disk). You should be encrypting/decrypting disk sectors as written/read instead of trying to encrypt file streams of various types.
|
|
|
|
|
Hi
I've a problem creating a window form application. Can i modify the connectionstring(in app.config) at runtime ??
There is a Form with a textbox in wich user may type the "connection string" and this new "connectionstring" should be written in the app.config file.
Thanks in advance
sorry for the bad english
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Yes you can. Something like
appSettingSection->Settings[key]->Value = newValue;
Ger
|
|
|
|
|
hi Ger
how to save the changes??
thanks for the answer
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Your config class will have a 'save' event that you can use. See Chapter 9 of Pro Visual C++/CLI and the .NET 3.5 Platform by Stephen Harper from Apress. I find it an excellent resource
Ger
|
|
|
|
|
Hi All,
I have projectinstaller class for my windows service in C#.Net, my windows service is hosting a WCF service in it. When I run the instalutil command on the command prompt.
Its throwing the below exception, what could be the reason for this. I am unable to start the service at all. Can any body please help me in this? Any sort of link or any help
would be greatly appreciated.
An exception occurred during the Rollback phase of the CalculatorWindowsServiceAppl.ProjectInstaller installer.
System.ArgumentException: The savedState dictionary does not contain the expected values and might have been corrupted.
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will
continue. However, the machine might not fully revert to its initial state after the rollback is complete.
protected override void OnBeforeInstall(IDictionary savedState)
{
serviceInstaller1.ServiceName = "CalculatorWindowsService";
base.OnBeforeInstall(savedState);
String username = GetContextParameter("username");
String password = GetContextParameter("password");
String account = GetContextParameter("account");
if (!String.IsNullOrEmpty(username))
serviceProcessInstaller1.Username = username;
if (!String.IsNullOrEmpty(password))
serviceProcessInstaller1.Password = password;
serviceProcessInstaller1.Context.LogMessage("Any Thing");
}
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
modified on Friday, January 21, 2011 5:31 PM
|
|
|
|
|
Please refer this[^]. Hope it helps.
|
|
|
|
|
Hi
I want to create a c# program and i have a question:
How can I end a process that running in CPU?
Thanks.
|
|
|
|
|
Get it's Process instance from Process.GetProcessByName (or whatever your need requires) and call its CloseMainWindow method, or (more risky) its Kill method.
Process class docs[^]
|
|
|
|
|
just to kill the process.
BOOL TerminateProcess(
HANDLE hProcess,
UINT uExitCode);
when a process that running in CPU,i don't think we can end it.You just need to use the TerminateProcess function,then the system will end it.
|
|
|
|
|
hi
i am using vs.net 2005 C# to load a excel file into a window form webbrowser control in a window form, however i notice that when i navigate the excel into the webbroser the excel.exe application is actually hidden in the background, which i am fine with, but when i try to open another excel file it always loads into the already opened but hidden application, which means while the webbrowser is displaying excel file A, i cant open another excel file B .
is there any way to work around this?
|
|
|
|
|
Hi Guys,
I am having an issue with the Windows User Contol communication. I am creating a winform application. I have a tree view in the page (UC1). I am populating data to that from DB. on the leaf node select, i have to call an even in a Grid (User Control2) which will populate the data depending on the selection of the treenode text. Here the Tree & Grid are usercontrols. I have tried to use events for doing the same. But there are issue, If any one can help me, i will be thankful to them
Hi Guys,
Thanks for your response. This is what i am trying to do.
GridUser Control.cs
public partial class LogGridViewUserControl : UserControl
{
public delegate void Data_Bind(object sender, LogGridEventArgs e);
public event Data_Bind dataBindHandler;
public LogGridViewUserControl()
{
InitializeComponent();
}
public void OnDataBind(Object sender, LogGridEventArgs e)
{
if (dataBindHandler != null)
{
string str = CallBusiness(e.Connection);
}
}
}
public class LogGridEventArgs
{
public string Connection { get; set; }
public LogGridEventArgs(string connection)
{
Connection = connection;
}
}
TreeUserControl.cs
public partial class TestTreeControl : UserControl
{
public TestTreeControl()
{
InitializeComponent();
// BuilTree()
}
private void trvTest_NodeSelect(object sender, TreeViewEventArgs e)
{
if (e.Node.Nodes.Count == 0)
{
I need to call the OnDataBind event in the Grid to populate the data in the Grid
}
}
}
In the main form, i will add the both user controls. How do i call the OnDataBind evnthandler of the GridView when a node selection is changed in the treeview. I am not an expert in the Winform development/ not so good with delegates. If any one can chip in, it will be of great help to me.
Thanks
Tutu
|
|
|
|
|
I'm not quite sure what you want but I think you may have it the wrong way around. Try creating a NodeSelected event in the TestTreeControl control and then fire the event where you need to call the OnDataBind method.
Then in the main form subscribe to that event (see pseudo code below)
MyTestTree.NodeSelected += new NodeSelectedDelegateHandler(MyTestTree_NodeSelected);
void MyTestTree_NodeSelected(object source, LogGridEventArgs e)
{
MyLogGridViewUserControl.OnDataBind(source, e);
}
Also your LogGridEventArgs class should inherit from EventArgs
Cheers
Architecture is extensible, code is minimal.
|
|
|
|