How to re-add a tab after removing it in c# [duplicate] - c#

This question already has answers here:
Hiding and Showing TabPages in tabControl
(21 answers)
Closed 3 years ago.
Maybe i am going the wrong way with this but for an application i make use of 2 TabControls.
The left one contains a menu the right one a bit of a preview page of how things wil be. The right tab menu i have the tab page selection hidden(Only able to hide them all not an individual) so they can't manually switch, depending on the left tab the right tab switches with it accordingly.
But here is the issue i am having, the left tab should only display certain tabs depending on account type. So is there a way to hide certain tabs?
If i remove them i can't get them back, so hiding would be preferential, or if possible perhaps move them to the right tabcontrol where they can't be manually selected?And move them back if the user changed?

I don't think I understand your question 100% but maybe do something like this to store a copy of your TabPage.
var tempTabControl = new TabControl();
tempTabControl.TabPages.Add(TC_NAME);
mainTabControl.TabPages.Remove(TC_NAME);

Related

Control to select from a list and change order of selected items [duplicate]

This question already has answers here:
Select multiple files on a C# winform
(3 answers)
Closed 7 years ago.
I want to use a control I've seen many times before, but I don't know what it's called, so I don't know how to look for it. The control would have two listboxes. The box on the left would list available items. The box on the right would list selected items. Buttons between the two lists would allow the user to move all items from the available list to the selected list, to move one item from available to selected, to remove one item from the selected list and return it to the available list, and to remove all items from the selected list. There would be two other buttons, typically located on the right side of the selected list, that would allow the user to move one of the selected items up or down in the list of selected items. Where can I find that control?
The question referenced as a duplicate to this is not a duplicate.
The referenced question asks how to do this. I know perfectly well how to develop this control, and it won't take that long for me to do. It will definitely be worth the time it would take to do it. But because many, many programs have this type of functionality, I figured that somebody somewhere had written this control already, and uploaded it someplace for the rest of us to use so we don't have to spend half a day writing our own. The point of my question, and the reason that it is not a duplicate, is that I am not asking how to develop this control. I am asking if anybody here can point me to such a control that has already been developed.
There is no common control like this. You have to develop it yourself.
There is no standard Windows control that I am familiar with that offers this functionality out-of-the-box, however it would be pretty straightforward to implement your own UserControl which contains these components:
Two ListBox controls, one anchored top-left-bottom, the other top-right-bottom.
Two Button controls in between with left and right arrows, anchored top only
Button controls underneath the lists to move items up and down.

Circular Progress Button WPF/C# Custom Control [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to make a button in my WPF windows application that is primarily a circular button. I have found plenty of tutorials online using numerous different methods such as templates and styling so that part I can figure out.
The catch is that I want the custom control (which is what I think I want because from my understanding just styles alone wont let me modify core functions of the button and user controls are more groups of already done controls) because I want something that is part button and part progress bar. I want it to be a circular button with a gray strip around the perimeter of the button a few pixels thick that when I press and hold the button I can start a circular blue strip around that gray perimeter and when the blue reaches the top after one revolution some event may be triggered in the code.
I have been trying to find stuff online but it seems like there is a lot of disjointed and confusing tutorials on how to make custom WPF controls. Some are for expression blend which doesn't totally match the blend that installs with visual studio community 2015 so I am just thoroughly confused and was hoping someone could point me in the right direction. Thanks in advance!
You can easy customize regular button or toggle button:
Open project in VS
Right click on xaml in solution explorer you want to edit
Click on "Design in Blend"
Select Assets tab
Find "Button" in controls and drag it to page
Right click on the button on page
Edit template -> Edit a copy -> OK
Objects and timeline tab -> right click on border -> Change layout type -> Canvas
Remove backgroun from the canvas in properties tab
Drag elipsis from Assets->Shapes
Adjust elipsis size
Goto States tab -> Selected "Pressed"
Change color of the ellipsis in pressed state
... to be continue.
You don't necessarily need a custom control. You can have a UserControl with a circular button, and overlay a circular Path over the edge of the button. Set that Path object's visibility to false initially, and when you detect a left click down event on your button, make that circular path visible and start a rotate transform animation on it. You should be able to expand on this to stop the animation when you want to; your description doesn't fully describe what ways you want it to stop.
Hope this helps!

How do i collapse panels so that the panels below it take their space? [duplicate]

This question already has answers here:
winforms accordion [closed]
(3 answers)
Closed 7 years ago.
im not the strongest visual studio v# developer so please bear with me.
I am trying to have multiple panels on a page, one below the other, with what will amount to a line of text in each one.
Sometimes, I do not want to show some of these panels. When I don't want to show a panel, I want the panels below it to 'move up' and take its spot... essentially, when panels aren't visible, I don't want a ton of blank space filling their location.
How the heck can I do this? ive tried a bunch of things but im at a loss..
thanks in advance :)
You can use this https://visualstudiogallery.msdn.microsoft.com/40B89FC7-80FA-4E95-B707-506084F51D6B
Or that se System.Windows.Forms.SplitContainer
inside the SplitContainer panel you can use a FlowLayoutPanel or a custom toolbox

How can I get the coordinates of a click on the screen [duplicate]

This question already has answers here:
Getting Position of mouse cursor when clicked out side the form's boundary
(5 answers)
Closed 8 years ago.
i'm trying to automate some actions with a c# bot. The program should work in this way:
a. the user add actions to a list of actions that the bot will use after the setup.
b. for example the user add the "auto-click" action.
c. then the program hide his window to let the user click and get the coordinates.
Now, I know how to hide the program window but I don't know how to manage how to get the coordinates of the screen when the user clicks. do anybody know how to achieve this?
Edit: my question is a bit different from the one posted below, i'm not trying to detect mouse clicks in the main form...
you might be looking for this
How to get mouse pointer position using javascript for internet explorer?
One of the answer conrtains cross browser solution not just IE.

Best way to insert control into tab order? [duplicate]

This question already has answers here:
Setting the TabIndex property of many form controls in Visual Studio?
(4 answers)
Closed 9 years ago.
If there is an existing tab order on a large set of controls on a form, what is the easiest way to insert a control in the middle of that tab order without having to re-number the tab order of all the controls after the one inserted?
Visual Studio has a tool for that. It allows you to click the taborder you want - by selecting the control in the order you want:
the blue boxes(with white numbers) are the current taborder, and white boxes are the new taborder.
This might be helpful to you.
(new TabOrderManager(this)).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
Follow this link>
http://www.codeproject.com/Articles/8406/Automatic-Runtime-Tab-Order-Management-for-Windows

Categories