Aligning Form in Visual Studio 2005 - visual-studio-2005

I am trying to add functionality to a form in Visual Studio 2005 that extends the form to the left. However, I am unable to figure out how to change the top and left alignment of he form in the form designer. There has to be a way to change the alignment of a form in the designer, right?

If you mean that you wish to extend the form (in the designer) to the left in order to make space for new controls, I don't believe you can do it - you need to drag out the right side of the frame, then select all the other controls (just drag around them all with the selector tool) and then drag them to the right (you can also move them with right arrow key to ensure they stay at the same Y position).

Related

is there a trick to working with multiple visual studio panel objects at design time

Is there some sort of shortcut key that I am missing here for swapping panels around in the form editor of vs2010?
I have numerous panels which are swapped at runtime according to an enum "toggle" value and the only way I seem to be able to move them back and forth is to make one panel smaller than another and right click it. Half the time I end up selecting some other object in the action of trying to right my panels.
I figured there must be something i'm missing here.
there are icons on the layout toolbar for this task. I pick the panel in properties and move it around with those. Way easier than right clicking and hoping for the best.
edit: although sometimes the buttons are not enabled when you need them to be. Still right clicking a resize handle adorner dot will pop up the context menu where you can then choose to move back/forward.
I still wish there was some key combo I could press. Hitting the 4px of display area that the adorner dot occupies on my screen is sort of a dexterity test of sorts and slows me down.

MFC 10 - Is it possible to have a CFrameWnd within a CView?

I'm using MFC (yes must be MFC and no I can't interop with .Net) to create a CFrameWnd.
My goal is to create a CFrameWnd containing a CFormView which is based on a Dialog Template that resembles something like:
I have got the frame and view to display, and I have an Edit control on there. Now what I want is to have a CToolbar aligned to the top of the Edit Text control but not docked to the top frame.
Ideally I would like to have a child frame/view that I can dynamically add in place of the Statement Group. That way I could just dock the toolbar as normal.
The thing that I find odd is that I could easily achieve this if I had a splitter in there by using the CreateView function. I really don't want to have a splitter and feel there ought to be another way.
In summary, these are the question I need help with:
Q1 - How can I have a CFrameWnd within a CView (like what CSplitter::CreateView does)?
Q2 - How can I position a toolbar within a CView without docking or floating it within another frame (I'm more than willing to resize, position it manually if only I knew how)?
Now I really appreciate how easy things are in .Net.
I wouldn't recommend sticking a CFrameWnd within a CView. You'll be fighting MFC all the way, basically living in a world of ASSERTs as the internal functionality such as message routing assumes that Frames don't live in views.
Instead just use a CWnd instead of the CFrameWnd and in the 'Create' method manually create the toolbar and the edit ctrl and size and position them yourself (create a AdjustLayout method that uses CMFCToolbar::CalcFixedLayout to adjust the position of your other components).
A great example of this is in the Visual Studio sample app PropertiesViewBar.cpp:
http://msdn.microsoft.com/en-us/library/bb983983(v=vs.90).aspx
Note: You might need to override OnCmdMsg to extend the message routing to the internal controls.

Displaying Ruler in visual studio 2010

Is there any way to display ruler or scale in visual studio designer mode? Actually I want a scale that will measure the vertical and horizontal space between the components (eg label, text box) and distance of those components from the form body. The scale or ruler will help to show the components with equal horizontal and vertical space in each form.
If I correctly understood, you need to control the distance of the components in a Window(Winforms).
For this, you can create a control class, this class will check the distances between components in your window and establish rules of location for each component on run time.
For control each component you can use this:
For Each ctrl As Control In Me.Controls
If TypeName(ctrl) = "TextBox" Then
If Not ctrl.Width = 0 Then
MsgBox(ctrl.Name)
'Do Something
End If
End If
Next
This rules of location can be applied on your window "load" event
You can learn more about location of component through this links:
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.location(v=vs.110).aspx
Changing the location of a control on a windows form programatically using VB.net?
PS. You can see I use vb,net language examples but this can be easily converted to C# or other language.

Visual C# Express 2008 Form Designer AutoScroll

This may not be the kind of question one should ask on StackOverflow, but here's a frustration that I've been trying to find a work-around for.
When using the form designer, suppose the entire form does not fit in the space allotted to the form designer, and I have a control say, down near the bottom of the form.
If I try to re-size that control, or move it using the mouse, the work area will auto-scroll to the top of the work area. This essentially pulls my control to the top of the screen. It isn't possible to scroll with the scroll wheel while "holding" a control, and even ScrollLock does nothing for me.
Is there any way to just turn the auto-scrolling off? That way I can at least work on my form without guessing numbers to type into the properties window.
Can't you just turn off autoscroll for the form?
I think it's off by default.
Form.AutoScroll = False

Need Help: VS 2005 Properties Changing

I am working in Visual Studio 2005. I have multiple splitters on the screen. I have set the splitters IsFixed and I have also set fixed panel sizes. In addition to this I have locked the control. For some reason, when I switch into debug mode the splitter distance value is changing entirely on its own. These changes do not take place with any consistency, the vary in distance changed. Other components, which are also locked, are moving all on their own as well.
Anyone with similar experience? Any ideas?
The settings will stick to either mode you are in. But sometimes plugins or parts of VS does mess it up :(
I recall seeing a plugin written to save 'views', but when I tried it, it didnt work.
I couldn't tell you what is causing this. The way that the windows forms splitter works is through the Docking property. There should be no need to lock the controls. All of the controls on the form should be docked. (Including the splitter)
For example, if you want to split vertically, you have your first panel docked left. Then the splitter (Orientation set to vertical) is also docked to the left. The second panel is docked to fill. The width of the first panel (which is docked left) will determine the location of the splitter. It should not change now.
The z-order is important here for layout purposes. If you want a more detailed look of how the controls are laid on on your form, open the Document Outline. This will list the controls in a tree, and you can see where they are in the z-order.

Resources