|
I know this is a very basic question but could someone please tell me how to create for example a dialog box for getting user settings ect for my application, or even an about dialog box. Is it as simple as right clicking in the explorer and adding another windows form? If so how do I get my program to display it?
Thanks in advance,
Paddy.
|
|
|
|
|
Paddy wrote:
Is it as simple as right clicking in the explorer and adding another windows form?
Yes.
Paddy wrote:
If so how do I get my program to display it?
YourFrm frm = new YourFrm();
frm.ShowDialog();
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
You pretty much have it. It only requires adding another WinForm to your project. In the code you (assuming the name of the new WinForm class is 'Form2') simply something like:
Form2 dlg = new Form2();
dlg.ShowDialog();
when you want to display the form. If can also use "dlg.Show()" if you wish a modeless window.
Rocky Moore
|
|
|
|
|
Thanks for the help that solves that problem for me.
One more question, whats the difference between a windows form and an inherited windows form?
Thanks,
Paddy.
|
|
|
|
|
Paddy wrote:
One more question, whats the difference between a windows form and an inherited windows form?
An inherited Winform is a cool little beast that allows you to inherit the WinForm from a WinForm that you create in another library (DLL) or you own project (if you compiler before you inherit). You can define one form as your base form with controls, then you inherit that form. It will build a form that looks just like the base form. You can add items to the form, you just cannot modify any of the items on the base form. But you can, at any time, modify the base form and those modifications will bubble up to all inherited forms.. Cool!
This is good for a Wizard type window where you have a certian layout. Another use is to simulate a skinning window by creating the base winform with different graphics or colors then dropping in the any of the modified base class DLLs thus changing the appearance of all inherited WinForms that inherit from that base WinForm.
There are many uses Inherited Forms!
Rocky Moore
|
|
|
|
|
Is it possible to open/create a Microsoft Word document in a C# application and to display the document INSIDE the C# application window?
In other words, I want to attach the MS Word window to my WinForm object. Is there a way to treat a Word document like a .NET control?
Thanks!
Johannes
|
|
|
|
|
Prsumably through COM interop, assuming that Word is installed on the target PC.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Don't know if this is what your looking for exactly but it might help!
http://www.csharpcorner.com/Code/2002/Mar/WordFromDotNet.asp
Paddy.
|
|
|
|
|
Hi
Does anyone know how to set margins on edit controls (textbox, combobox, etc) in C# by using managed code?
I used to do it by sending EM_SETMARGINS message in VB6, but I was wondering if there was a way natively supported by .NET.
Thanks,
Mo Inam
|
|
|
|
|
This is a ***BUG***, create a simple C# Windows based form. Drop a treeview on the form, add a MouseUp event handler for the TreeView. Add Console.WriteLine("MouseUp Fired");
Start the application, press and hold Left mouse button inside of the treeview, note the MouseUp event is fired even though the mouse button hasn't been released?
Work arounds anybody?
Normski. - Professional Windows Programmer
|
|
|
|
|
Hello Norm
I just reproduced the bug
Sucks!!!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Norm Almond wrote:
Work arounds anybody?
Normskyyyy
We both have been such fools. We were both trying it on an empty treeview.
Add some nodes. If you click on a node, the mouse down event is fired. And when you release the mouse, the mouse up event is fired.
But even on a tree view with nodes, if you click on a non-node area then the earlier behaviour occurs where the mouse-down event is immediately followed by the mouse-up event.
Maybe what they do is to see if we have clicked on a node. If not they also send a mouse-up message
regards
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish this behaviour is not the same when using the raw API to crack WM / NM /LVM type messages. Surely the behaviour should be the same as in .NET as it is in MFC/C/C++.
Keep getting signed out from hotmail
|
|
|
|
|
I've been playing around with the dynamic sizing, positioning, and MDI
settings, but still can't achieve my goal and I'm sure someone else out
there has done this... Here's my scenario:
I have a frmMainContainer that acts as the primary controller for my
application. It consists of a header 200px tall and 100% of the width of
the form (used for control & branding) and the remainder of the area below
is where my other forms will appear (I'll call it MultiUseArea for this
conversation). I have a few other forms (frmChild1, frmChild2,
frmChild3)... these will be loaded from the frmMainContainer form... they
also will not have the min/max/close/titlebar/border features of a typical
form.
Now, what I want to do is click basically click a button in frmMainContainer
that will load one of the child forms into the MultiUseArea... here's the
trick... I want to size the child form to take up 100% of the MultiUseArea.
Here's what I'm struggling with: when I load the application
frmMainContainer, there are no scrollbars. When I load one of the child
forms, scroll bars pop up in frmMainContainer although it looks like if the
scroll bars weren't present, it would fit perfectly.
I've tried dynamically sizing the children using the ClientRectangle
property of the frmMainContainer, I've tried disabling the AutoScroll, and
making the child forms MDI children of the frmMainContainer among other
things... I just can't figure it out. Any ideas?
----
Just in case I'm confusing anyone in my description... I'm thinking something like Quicken interface or the one shown here: http://www.bcentral.com/image/ss_sbm1_640.gif In my desired solution, the "invoice entry" form would not have the title bar or control boxes (min/max/close).
Andrew Connell
IM on MSN
andrew@aconnell.com
|
|
|
|
|
Got it...
<begin code>
Form2 frmForm2 = new Form2();
frmForm2.TopLevel = false; //<<< KEY CODE
frmForm2.Parent = this; //<<< KEY CODE
//position 200px down from top because top 200px are my app header
System.Drawing.Point thePoint = new System.Drawing.Point(0, this.ClientRectangle.Y+200);
frmForm2.Location = thePoint;
//size child form to fill up 100% of the parent form EXCEPT for the upper [form width]x200
System.Drawing.Size theSize = new System.Drawing.Size(this.ClientRectangle.Width, this.ClientRectangle.Height-200);
frmForm2.Size = theSize;
frmForm2.Show();
<end code>
Andrew Connell
IM on MSN
andrew@aconnell.com
|
|
|
|
|
Here's the structure in C:
typedef struct _SYSTEM_INFO {
union {
DWORD dwOemId;
struct {
WORD wProcessorArchitecture;
WORD wReserved;
};
};
DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress;
LPVOID lpMaximumApplicationAddress;
DWORD_PTR dwActiveProcessorMask;
DWORD dwNumberOfProcessors;
DWORD dwProcessorType;
DWORD dwAllocationGranularity;
WORD wProcessorLevel;
WORD wProcessorRevision;
} SYSTEM_INFO;
Although I read the tutorial in the MSDN, I could not figure out how to do this...
Could you please give me a hand?
Thank you in advance for your effords!
|
|
|
|
|
I could be wrong, but it looks as if you are trying to access system information about the computer, you just want to do this in C#, am I right? If so there is an article on the WMI (Windows Management Interface) that will show you how to do this. I know this isn't the exact answer to your question, but it should hopefully help. Interrogating Systems with WMI
HTH
Nick Parker
|
|
|
|
|
Thank you for your reply,
You're right in gussing I want to access system information. I want to get the number of CPU on the machine, can I do that using WMI?
|
|
|
|
|
Hello,
I have a problem, i work with web pages, i want to fill labels in one webForm from the information of TextBox in another webForm , how can I do it?
thanks, sharon.
|
|
|
|
|
sharon wrote:
I have a problem, i work with web pages, i want to fill labels in one webForm from the information of TextBox in another webForm , how can I do it?
Usually you would store the data in a session variable if you are not calling the second form from the first and there would possibly be other pages interacted with between them. You could pass the values directly if you did call the second form from the first.
Rocky Moore
|
|
|
|
|
I'm doing a dead-simple text binding:
this._ctlTitle.DataBindings.Add( "Text", this._movie, "Title2" );
This populates the control just fine. But when I change the text in the control, the binding doesn't seem to care. If I get the binding from the DataBindings collection and look at it in the debugger, the private field, "modified", is false. If I set it to true in the debugger and call the PropertyManager method EndCurrentEdit, I see the new value persisted to the data source.
So how do I get that modified field set to true?
|
|
|
|
|
Hey all,
I'm working with the DirectX 9 library, specifically the Managed DirectX part. I'm trying to avoid using their GraphicsForm class as the main render target and such, but I am having a problem with making my Windows Form tell me when it is idle. So here's my question:
How can I have a System.Windows.Forms.Form object call a function when it is idle? The GraphicsForm class has a nice message handler for doing that, but I need to do it using the regular forms. Any way to do it would be much appreciated. Thanks!
Andy Luedke
|
|
|
|
|
Use the Application.Idle event.
It looks like you're a beta tester for DX9 (since I don't see it listed any where for download); MS should have a private forum setup for you to use for asking questions relating to it.
James
Simplicity Rules!
|
|
|
|
|
Just like the MFC source code
I'm amumu, and you?
|
|
|
|
|
Yes, you need to use Anakrino
You can download in here
htpp://www.saurik.com
|
|
|
|