I'd like to implement the prev/next page behaviour for a winforms app like the browser prev/next pages
any existing code samples or guidance on where to start ?
I'd assume this is something already implemented and would not like to reinvent the wheel if possible
If the sample uses scsf/cab, that would be even better
Use TabPane, Panel or any other container control. Show or hide them or use Zorder.
I did this when I wrote an Aero Wizard host. Basically the strategy was to keep a List<T> of Panels that contained each page's controls, and that page Panel would be docked to a fixed Panel in the wizard. When the back button was clicked, I just replaced the contents of the host Panel with the previous Panel from the List<T>. And as users move "forward", just add the current page Panel to the list.
Related
I've used the answer to this question to develop tabs that have a add tab and remove tab functionality: Close button for TabPages of Right To Left TabControl c#
The look here is very different compared to the default tabs look. How do I paint the custom control in the above question to make it look like the default tabs look? Images below to demonstrate what I mean.
This first image here shows the default look without having the tabcontrol being overriden by ownerdrawmode.
This second image here shows the look from the answer in the link.
How about using custom drawn controls instead of those tab headers (i guess thats how they are called) and loading user control instead of that tab page? it can be easily done: here is "tabs" (user controls) sample https://github.com/WithoutCaps/LimitlessUI/blob/master/LimitlessUI/TabsAdapter_WOC.cs
(there is project demo too )
He I am a beginner to C# and I am working on a reaction manager plug-in for some bigger project. (Yes I am a intern)
Now I just can't find a way to create a view similar to this:
My full design:
How to realize this design? I cant find any default templates in the devexpress which are suitable for this. I come from php and in php I can use html. I am a beginner to C# and I don't have any clue on how t do this. Do I have to use canvas to literally draw this? OR is there a standard template I can use for this purpose.
You have many comment boxes that contain the same layout - a label comment text, author name, date, etc. There is no control that lays things out like that, you will have to make your own custom control (Project->Add User Control). This control will be a composite control - ie made up of other controls. Probably a label for each text field (comment, author, date, etc) laid out in the right places. Maybe call it CommentBox or something.
Then in the main form you now have available CommentBox controls which you can add to the form. Create a panel to put them in so you have many CommentBox controls in the panel, one for each comment (or maybe add them at runtime).
Now in WPF it's slightly easier because there is a StackPanel control that you can simply add controls to and it automatically arranges them vertically one beneath another in a stacked list. In fact your use case is exactly fitting what a StackPanel is for.
In WinForms there is no StackPanel, but you can use a normal Panel control*. It's just you'll have to position the CommentBox controls manually one beneath another. You will also need to set the AutoScroll property to true to turn on the vertical scroll bar if the content doesn't fit the view.
*or there's apparently an alternative How can I get a StackPanel-like layout in WinForms
I am using a Panel to hold a list of controls (user-defined). The way that I add the panels, I am setting the location of the control based on the Panel.Controls.Count before I add it to the panel.
comRec.Location = new Point(comRec.Location.X, panel1.Controls.Count * 25);
panel1.Controls.Add(comRec);
Now, this works nicely and looks exactly the way that I want it to. However, once we reach the limit on the window, the AutoScroll enables (which I do want). Now, if the user were to scroll to the bottom of the Panel, this ultimately changes the location of every control in the panel. Instead of my first comRec.Location being (0,0), it is something like (0,-219). So now, when the user adds another comRec object, it creates a HUGE gap between the objects.
My question is this, what is the best way to account for the changes of the location with the scrollbar and still using my adding system. I am assuming that will have to do something with checking the value of the scrollbar and using it to determine the location.
Also, is there a BETTER way to display a list of controls? Should I be using a Panel?
Look at the FlowLayoutPanel control, it's exactly what you what.
You could add an additional panel into the hierarchy:
Outer panel (scrollable)
Inner panel (not scrollable, resize it whenever you add a control)
User Defined Control 1
User Defined Control 2
User Defined Control 3
User Defined Control 4
...
This way, your additional controls' locations would be relative to their direct parent, the non-scrolling panel.
If you add several controls, try to suspend the layout of the panel while adding the controls:
panel1.SuspendLayout();
// Add controls ...
panel1.ResumeLayout();
This helped me in a similar situation where the user could change dynamically the visibility of existing controls.
I want to have buttons that kind of act like tabs - they switch between "pages" of the application. How can I achieve this effect? I'm thinking that I could just put the controls in some kind of container and toggle the visible attribute, but is that plausible?
I am using WinForms.
The reason I don't want to use a tab control is because some of the panels already have tab controls in them..I don't want to create a nested tab hell. I just want some kind of spiffy button based navigation.
You could "attach" button functionality to Panels, then use the panels as the "tabs". You could even create a UserControl that inherently ties them together.
However, a TabControl (for Winforms) already exists that does this. http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.aspx
If you're looking for something for ASP.Net 2.0 and above, you could try the following: http://www.codeproject.com/KB/custom-controls/TabControl.aspx
I think the best option is to use this WinForms TabStrip control -- a subclass of ToolStrip where the buttons are drawn as tabs, and you simply treat them as such programmatically by switching which panel is shown in your container as tabs are selected.
I am attempting to create my own custom Autocomplete style dropdown control in c# .net2.0. For speed of development I have built my control as a UserControl but have hit on an issue of doing it this way.
When the custom drawn dropdown gets drawn I have to resize the UserControl area to be able to display the list of options.
Ideally I want to be able to mimic the drodpown list behaviour in that the list of options is drawn 'floating' and is not constrained by the UserControls height and width (nor even the parent forms boundaries). A tooltip is another example of the unconstrained 'floating' that I desire.
The only way I can think of achieving this is to create on the fly a new form with no border or title bar and display this when the popup is required.
Is there a better (but also quick) way of doing this?
TIA
You would need to use a Form or NativeWindow to allow the control to float correctly. To make a form follow the control is easy enough but it is more difficult to implement and handle all of the focusing/hiding issues especially if you need seamless tabbing/key navigation.
You can try creating a control that is based off the ToolStrip Drop Down Button control. I believe that this control has the functionality that you are looking for. I found this reference for creating controls based off the ToolStrip, you might try starting with this.
http://blogs.msdn.com/jfoscoding/attachment/1335869.ashx