This question already has answers here:
Custom button captions in .NET messagebox?
(8 answers)
Closed 9 years ago.
I've a winform application, and we are trying to make it ergonomic as possible, so we respect a lot microsoft guidelines.
We have some "Deletion confirmation" to implement, and according the guidelines and what I found accross the web, the more adequate buttons would be:
Delete and Cancel
But since we use the MessageBoxButtons to specify which buttons we have to display, I can't see how we can do this except implementing ourself a confirmation dialog.
I don't find very logical that microsoft encourage in one side the use of "action" text on button, and the other side doesn't give us the tools to be compliant, so I think I'm missing something?
Please note that I don't need more results possibility than currently, My Delete option would be the same as Ok for me, I just want to have differents texts.
So: Is there a way to specify easily buttons we want to show different text here?
There is no easy way other than creating your own implementation using form and show it as dialog?
We did the same some time back because of localization specialities in our project.
Related
This question already has answers here:
How to create an Explorer-like folder browser control?
(3 answers)
Closed 5 years ago.
Not sure if this is off topic or not, if it is i will gladly delete.
I am converting one of my companies utility programs to C#.NET in winforms it is written in vb6, DEFINITELY NOT .NET as it is 15 years old. and in the UI it has a tool which looks like this
it acts like a folder browser put stays on the UI unlike a folder browser dialog which is a popup. is there a .NET tool which does the same thing or do i have to use a folder browser dialog. ideally i would like to keep it on the screen because i think it looks better to keep it on the screen rather than a separate box. if anyone knows if this is actually a tool in C#.NET winforms or not that would be great
Yes these controls are no longer avaiable in .net, you can create one yourself relatively easily, here is a MSDN link describing what you want
https://msdn.microsoft.com/en-us/library/ms171645(v=vs.110).aspx
This question already has answers here:
Hiding and Showing TabPages in tabControl
(21 answers)
Closed 6 years ago.
I'm programming a windows application program, using winforms c#
I have a tab control that contains so many pages I need to hide some of these tabs from non-admin users,
for example
if user is an admin no pages will be hided, else page number 1 and 2 will be hided and other pages will be shown,
I don't want to remove pages, just hide because in the program I made you can sign out without closing the program and sign in again as an admin
Please have a look at this thread.
As amazedsaint said:
Visiblity property has not been implemented on the Tabpages, and there is no Insert method also.
You need to manually insert and remove tab pages.
Here is a work around for the same.
http://www.dotnetspider.com/resources/18344-Hiding-Showing-Tabpages-Tabcontrol.aspx
No way to hide it ,you will have to remove pages an re add them for admin user
tabControl.TabPages.Remove(tabPage);
tabControl.TabPages.Add(tabPage);
As seen here you can however disable/enable tabs. While this won't make then invisible, you can restrict access. That should get you going in a workable direction.
I'd personally also put all the restricted tabs at the end, but that's just a point of personal taste.
This question already has answers here:
How do I find out which control has focus in .NET Windows Forms?
(7 answers)
Closed 6 years ago.
I'm having trouble figuring out how to get c# to get the focused element within a window. I've a window of another program with two text boxes, a dropdown, and two buttons. I need to be able to open this program, pull it to the front, and fill in the two text boxes and select from the dropdown programatically.
I can pull the window forward with SetForegroundWindow and fill things out and navigate about with SendKeys, but since I don't always know which box the cursor will start in, I need to be able to determine where it is once I've pulled it to the front to fill them in properly.
Any ideas?
Going off of memory and pseudocode here.
Inside of a form, you should be able to use this.ActiveControl to get that information, which should provide you with a wealth of other information, such as the name of the control, type, etc.
This question already has answers here:
A textbox/richtextbox that has syntax highlighting? [C#] [closed]
(8 answers)
Closed 7 years ago.
In my winform application I allow the user to write/read some c# code (simple text in a RichTextBox, I would like to add the functionality to highlight the syntax like VS or notepad++ does, nothing advanced like intellisense and so on, just the text colour change would do.
I've been looking around but I couldn't find anything, do you know if there's a ready to use library or something that I can use?
I found FastColoredTextBox component which seems to be exactly what I need, answering in here in case someone else needs it.
This question already has answers here:
Window vs Page vs UserControl for WPF navigation?
(5 answers)
Closed 8 years ago.
I wondered if someone could help me. I'm new to WPF and am currently writing a desktop application, but I cannot seem to get my head around what to use when redirecting someone to a new section of the application.
My options appear to be
Window
Page
UserControl
but I don't understand what the difference between them is, and when I should use each one.
Could someone explain the differences for me, and give an example of what situations/applications you may use each one for?
I'm not sure there is a right answer here, but let me try and guide you. The Window class was created to allow you to have a true window. So, if you need to open a dialog, put it in a Window. Generally you will have at least one Window to house the main form.
A Page was built to be used with the NavigationWindow class. This allows you to build Page classes that are marked up like everything else, but just navigate to them under the covers. This is good if you have a single-paged application where the users just go back and forth between pages (i.e. a wizard).
A UserControl is a way to house reusable markup. These can be housed inside of any ContentControl. These can be swapped out of a "content pane" for example on the main window, like Outlook.
Using that, I hope it helps guide you in the right direction on when to use which. They each have their own uses and are not necessarily exclusive.