Deconstructing a C# Windows Forms application - c#

I am browsing an EMGU application built using Windows Forms. The controls in the application are as follows:
I would like to simplify the application down to using fewer image boxes. But when I click on a splitcontainer control, it is selected but I can neither move it around nor even delete it.
How can I break the application down where I can understand what is going on wrt the panels and splitcontainers?
(PS: Not tagging this with EMGU as I don't believe this is an EMGU-specific question.)

I am still not certain about your issue. I give the steps I use to delete SplitContainer from a form:
Right click on the SplitContainer, and choose "Select splitContainerName".
Move its child controls out of it. If its Dock is Fill, set it as none, so you can resize it, and move its child controls to the empty space of the form.
Right click on the SplitContainer, and choose "select splitContainerName" again.
Delete the selected SplitContainer.

Related

How to Show the Form's Own Icon on a Floating Window using DockPanel and its Extender?

With the Weifen Luo DockPanel component, one can add to their .net project the ability to dock forms within other forms. The component is very well done.
Now, I see from this page at the project forum at github (where this component is now hosted), that it is possible, through the use of this dock.extender to allow the floating windows to have a normal winform look, that is, sizeable with regular Windows title bar, maximize box, minimize box, etc (see here, too). This also allows for the form's icon to show.
My problem is, and hence my question, is that the icon I assign in the form's properties will show in the designer, but one it runs in debug as a float-panel, a generic form icons appears in its place.
Now, I tried assigning the icon through code (both in the form's own code, and in the main application code too, where the form is called) rather than through properties, and that didn't work either.
So how do I get my own custom icon to show as the form's icon when the form is floated, and the extender is used? I am using the main docking panel in DockingWindow mode.
[EDIT]
I think this is a hard question! It's been 2 days and I've not gotten any answers!
This requires a change to the the FloatWindow class itself to set and update the Icon property internally as the content changes.
I have just checked the change in and it will be included in the 2.7 release of the library.
https://github.com/dockpanelsuite/dockpanelsuite/issues/35

Default windows forms resizing behavior

If I have created a forms app and not specified anything out of the ordinary (just used Visual Studio's designer to drag and drop controls), what behavior should I expect when resizing the window? Does it differ based on what controls I used? Is there detailed documentation of this someplace I can reference?
(I hate asking something so vague and contrived, but I don't have access to Visual Studio and the developers who do aren't being helpful. As far as I know they're using C# and not using any sort of layout panel.)
It sounds to me like you need to know about anchoring and docking the various components, how they hold together, and how they behave when resizing the form. Please see this link for a guide on how to do this effectively, and how some of the various options work.
Controls on a WinForm application do not resize by default. Look at using the Anchor property on controls. For example. If you want a button to widen when you widen a form go to the Anchor property on the button and anchor the left and right sides. This will widen the button as the form widens.
You can think of the anchor as the parts that get "pulled" when a form moves.
See this post:
Auto size the controls in winform

C#: How can I move my controls on a win form in windows application freely?

C#: How can I move my controls on a win form in windows application freely?
I do NOT want IDE control the position of my controls for me.
Thank you
Visual Studio tries to help you align your controls by "snapping" them to an alignment line (e.g. left of another control, right of another control, a short distance from another control or the form edge etc.), so this might be what you experience as not being able to move your controls freely?
If this is the case, you can fine-tune the position by using the arrows on your keyboard. Move the control approximately where you want it with your mouse, and then use the keyboard for the final adjustment.
Do you mean at runtime dragging the controls around?
If so: you have to check when the mouse is clicked, find the control, and move it around on drag as long as the button is clicked.
it seems u r looking for similar implementation as in visual studio forms designer. system.design assembly defines DesignSurface that can certainly do what u need. check this out.
http://www.codeproject.com/KB/cs/DesignSurfaceExtended.aspx

How to automatically resize a Windows Mobile application when the keyboard appears?

I'm looking into Windows Mobile development but there is one thing which I haven't quite figured out yet. In all applications already installed on the device (Internet Explorer, configuration windows, etc) whenever the on-screen (soft?) keyboard appears, the user interface automatically resizes so the keyboard doesn't cover or obscure the user interface (and if necessary it adds scroll bars).
However when I simply add a text box to my Windows Mobile form, somewhere near the bottom, and test it, it's not automatically resized. The keyboard covers the text box and I can no longer see what I am typing.
Is there a way to automatically do this, or should I do this myself using an InputPanel control and listening for its event?
This is all with .NET (the compact framework, I believe), C# and Windows Mobile Professional 6.1, by the way.
Use the InputPanel component. It contains a EnabledChanged event.
Simply handle the event and resize/hide/show your controls. :)
Example code can be found at the MSDN.
You will have to set the Anchor property for the control respectively. The form will be resized automatically because it is full-screen, but unless you tell your control to be anchored to the bottom, it will not move but be "outside" the form.
Example: You have a "fill client area" ListView and two buttons below that ListView. To make the ListView adjust its size and move the buttons according to the new height, set the ListView's anchor property to "Top, Left, Bottom, Right" and the buttons` anchor property to "Bottom, Left" and "Bottom, Right". That way you also account for screen rotation in that the controls resize/move correctly.
You'd have to listen to the InputPanel events only in case you want to entirely restructure your layout when the SIP is shown/hidden.

C#: Move Controls From Form to tabPage in VS Form Designer

I decided to change a utility I'm working on to use a tabpage. When I tried to drag various controls from the form to a tab page on top of the form, it made copies of the control, giving it a different name. It's easy enough to just remake the form on top of the tab or just edit the source code in the designer to have everything be added to the tab instead (and this is what I did, which worked), but it seems like there would probably be a better way to do this via the gui.
The correct tool for this is the Document Outline (CTRL+W, U). Simply drag your set of controls in the outline so that they are under the tab page. Voila.
The document outline dramatically simplifies these types of operations, especially when you are dealing with complex layouts.
Have you tried cut and paste. That usually works for me.
Your control key is stuck. Do not press control key when dragging controls.
I drag controls from form control to tab page controls all the time no problem. Answer #1 is totally correct.
You can use the Document Outline window and move the controls to the tab page one by one by dragging tree nodes.
The hardest problem is retaining control locations on the tab page.

Categories

Resources