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

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!

Related

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

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);

c# Buttons as toggles [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Hello i am new in C# and need some help
In both groupboxes have buttons they are now like toggle butons, but now can i choose only one button from all.
looking for:
clik one from Groupbox1, one from Groupbox2
clicked buttons will have green background
after press OK show messagebox with button name GB2 + " - " GB1
....................................................
Another question:
Buttons 1-6 can be added as dynamic buttons directly from SQL?
From Sql need have ID and Name
....................................................
Just some hints:
Use a RadioButton with Appearance set to Button.
Check the Remarks of the radio button to find out how to make two groups.
Subscribe to CheckedChanged event and set BackColor according to value in Checked property.
To dynamically insert buttons, take a look into designer.cs file. You can create your own buttons exactly the same way at runtime by doing the same stuff in your own method which you call whenever needed with desired parameters.
For the message box message check the state of all radio buttons and take the name from the box where Checked is true. (Advanced users would filter the Controls property for the desired type and value by using LINQ).
If you have started all of these and have a more concrete question: Ask a new question for one problem. Don't hope to ask one question containing all your questions and get a working example back.

Is this possible to create many form designs and swap between them? [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 5 years ago.
Improve this question
I've just started building up a simple game in Visual Studio using c# (It is my first low difficulty game). As I open it , it shows me a background image and 2 buttons, "Play" and "Instructions."and I want the form to get changed as I click the play button and open a new menu interface , like : " Game Difficulty / Character Appearence "(those 2 are buttons) , with a new background image. When I click one of them, another menu, etc.
Can I create multiple designs( Form1.cs[Design1/2/3]) for my from and swap between them ? If not, then how can I do something similar ?
In my opinion, the easiest way would be to make each menu a "User Control" that is the size of the main form, and then you can add a user control for whichever menu you want to show up as you go along.
For example, in the solution explorer I would create a folder and name it "Menus". Then I would create a new "User Control" in there. Copy the Width and Height of the form it will be placed on and apply that to the new control. Then you can add in all the buttons and images you like. Once you're finished, in your main form, you can add the "main-menu" control you made in the designer. For any submenus you want, create user controls for them too. Then, if you want a submenu to show up, capture a click event for the button you want and programmatically add it to the parent form using FindForm().
Pretend that DifficultyScreenControl is the screen that shows up after I click a play button located in my main-menu user control.
Inside of a menu user control
private void PlayButton_Click(object sender, EventArgs e)
{
DifficultyScreenControl DiffScr = new DifficultyScreen();
this.FindForm().Controls.Add(DiffScr);
}
Also it is a good idea to either Dispose() or remove these screens one they can't be revisited again as it can free up resources being taken up by them.
Feel free to ask me questions or comment on things to change!

Scroll bar not appearing during runtime [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I had search on scroll bar not appearing topic.
i believed my problem is the same as others but the solution but it seems none of them help.
I had a few button which i create in design stage within a panel, when some button are out of the area of the panel, the IDE does show the scrollbar which i set Autoscroll to True.
However during runtime, i cannot see any scroll bar nor can i scroll into those control that is out of the area of the panel
I tried Anchor the buttons all around and it does not help. Setting AutoScrollMinSize to a large value also does not help.
Am i missing other ways?
**Edit
Attached is a picture i snapshot during design and runtime
try Setting Panel AutoScrollMinSize
panel1.AutoScrollMinSize = new Size(0, 10); // 10 or Minimum Height you require
If the above also didnt work check the tab order and make the panel to be on the top most parent.
I feel you are making some changes in runtime. Your Design-time Screenshot and runtime screen seems to have background difference, try setting AutoScrollMinSize again after setting background

C# - Drag and Drop files in win form [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 8 years ago.
Improve this question
I'm trying to make like a container application where you can drag and drop files of any kind on the form and afterwards to be able to open it from there. I found some solutions where you can drag and drop files to a list view and you get it's path.. but is not how I want.. I want to have on my form in a panel or what ever is better like a shortcut of the file, an image or something to be able to see the file icon like is in explorer.
Have someone ever done something like this or point me to the right direction?
Set "Allow drop" property to "true" on your control and make use of Control.DragDrop event - it's exist on all controls, and it's invoked after drag'n'drop anything on anything(if "Allow drop" is true of course).
It this event-handler you can add new item to this or another control(ListView fits nicely to your needs), and for example to some "Dictionary" where you will store "Item and filename mapping".
Also you need to make handler for item click'ing - for ListView there a ItemActivate event. Inside this handler you can click execute default shell-action for this file by using Process.Start

Categories