This is a discussion on Pratical issues in adding controls to Windows Forms in C#.Net 2005 within the C# Programming forums, part of the Software Development category; Hi all, Here in this thread,we can discuss the practical issues in adding the controls to the windows forms ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all, Here in this thread,we can discuss the practical issues in adding the controls to the windows forms in VS 2005.
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| Sponsored Links |
| |||
| To do this, you can use use iterop to access the GetSystemMenu and AppendMenu Win32 APIs. You also need to override the form's WndProc method to catch and act on the menu message. This idea was posted in the Microsoft newsgroups by Lion Shi.
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Deeban, Well.Set your form's Text and ControlBox properties. myForm.Text = ""; myForm.ControlBox = false;
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi, In the Solution Explorer window, you'll see a file called app.ico in your project. This file contains your application icon. You can change this to a different file in the project properties screen which you see by right-clicking the project node in the Solution Explorer, and selecting Properties..
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Deeban, One way to do this is to override the form's WndProc method and check for WM_SYSCOMMAND and SC_CLOSE. Looking for WM_CLOSE in the override is not sufficient as WM_CLOSE is seen in both cases. A sample is available for download (C#, VB). public const int SC_CLOSE = 0xF060; public const int WM_SYSCOMMAND = 0x0112; //_closeClick is a bool member of the form initially set false... // It can be tested in the Closing event to see how the closing came about. protected override void WndProc(ref System.Windows.Forms.Message m) { if(m.Msg == WM_SYSCOMMAND && (int)m.WParam == SC_CLOSE) this._closeClick = true; base.WndProc(ref m); }
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Sathish, One way to do this is to make the TextBox either a public property or a public field. Then you will be able to access it through the instance of its parent form. So, if TextBox1 is a public member of FormA and myFormA is an instance of FormA, then you can use code such as [VB.NET] Dim strValue as String = myFormA.TextBox1.Text [C#] string strValue = myFormA.TextBox1.Text; anywhere myFormA is known. Here is a VB project illustrating this technique.
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Deeban, Thats a good question.Now let me tell you the answer.Make your main form the "Owner" of the form in question. Refer to Form.Owner in class reference for more information. [C#] findReplaceDialog.Owner = this; // Your main form. findReplaceDialog.TopLevel = false; [VB.Net] findReplaceDialog.Owner = Me ' Your main form. findReplaceDialog.TopLevel = False
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi , How can I display a form that is 'TopMost' for only my application, but not other applications?
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Deeban, Its ok,I have found the solution. We can do this by setting the child form's TopMost to False and setting its Owner property to the Main Form. [C#] Form1 f = new Form1(); f.TopMost = false; f.Owner = this; f.Show(); [VB.NET] dim f as New Form1() f.TopMost = False f.Owner = Me f.Show()
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Deeban The framework automatically resizes the form if the current Font size during runtime is different from the font size in design-time. It however doesn't auto size when the resolution changes. But it should be easy for you to accomplish. You could derive a custom Form, provide a "ScreenResolutionBase" property that could return the current screen resolution (Screen.PrimarScreen.Bounds will give you this). This value will get serialized in code during design time. Then during runtime in the Form's OnLoad you could check for the current screen resolution and resize the Form appropriately.
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SQL 2005 Installation issues Error (0xc0000005). | nnraja | Server Management | 2 | 10-29-2007 01:05 AM |
| Windows Forms Patterns | Mramesh | C# Programming | 0 | 09-25-2007 09:13 AM |
| Windows Forms from MFC | Sundaram | C# Programming | 5 | 09-25-2007 09:09 AM |
| Windows Forms Mouse Handling | Sundaram | C# Programming | 3 | 09-25-2007 08:51 AM |
| Practical issues when we develop code in Windows Forms in C#.Net 2005 | Sathish Kumar | C# Programming | 10 | 09-20-2007 07:17 AM |