Prepare
This article will use a NuGet exposed component to implement some special control display to facilitate rapid development of the system.
You can download the installation in the NuGet Manager in Visual Studio, or you can enter the following instructions directly in the NuGet console to install:
Install-package hslcommunication
NuGet Installation Tutorial Http://www.cnblogs.com/dathlin/p/7705014.html
QQ Group of Technical Support: 592132877 (the component version update details will be released in the group in the first time)
Summary
The component contains some controls, primarily for the WinForm mechanism, because the mechanism of WPF is completely inconsistent, so here we provide a version of WPF, only the Winfrom version of the control, the development of these controls originated from my previous project accumulation, while the idle gap to reorganize the development completed.
- The first is the Winfrom own button dissatisfaction, it is too ugly, and easy to be cracked (if you have a button to verify the rights, insufficient permissions to disable, in fact, this operation is very dangerous, the user can download a gray Button Wizard from the Internet to crack the program, By turning the previously disabled hidden buttons into a clickable one, all of them re-developed a more complete button and are less ugly.
- Time display control is purely for fun development, want to make a more interesting control, by the way practiced hand, skills.
- Vertical progress bar, because Microsoft does not provide the erect progress bar, and when you need this is very troublesome, general horizontal progress bar with Microsoft, but this component of the progress bar also provides a horizontal option.
- The pie chart control, in order to conveniently display some data occupancy ratio, is developed.
To use a component's control, in addition to using NuGet to install the component, you also need to drag the component's DLL file (found in the packages of your project) to the toolbar if you are referencing local, just drag and drop it locally:
After the drag is finished, the effect is as follows:
OK, now you can drag the controls to the interface, and then you'll walk through several controls:
Button controls:
Drag directly to the main interface with the following effect:
The following properties are exposed:
Basic properties are commented, to set the displayed text, set Uitext. You can set the text color, whether the button is selected, and the size of the fillet, the basic commonly used on these items. Double-click the button to enter the Click event is also consistent with the button, and the button is not the same place in addition to the interface differences, there is no way to be cracked by the gray Elf, and the button comes with a string property: Customerinformation Easy to extend some of the custom data.
Time Control:
Drag directly to the main interface with the following effect:
The main function is to get the system's time, then display it, exposing some of the properties that allow settings:
It is mainly the color setting of the pointer, the text setting.
Progress bar control:
Drag directly to the main interface effect is as follows, showing two vertical and horizontal progress bars, as well as some color settings, related properties, casually point to understand:
The main settings are the background color, foreground color, whether the text is displayed, the border color, whether the animation is started, and so on.
Special NOTE: Max is the upper limit value, if set to 100, then value = 10 is 10%, and the other property valuechangespeed is related to the speed of the animation.
Pie chart Controls:
Drag directly to the main interface effect as follows, the reality of pie chart data is implemented here using code:
Then you can set up the data information by code:
private void Userbutton1_click (object sender, EventArgs e) {Rand Om random = new random (); hslcommunication.controls.userpiechart[] charts = new Hslcommunication.controls.userpiechart[4]; Charts[0] = UserPieChart1; CHARTS[1] = UserPieChart2; CHARTS[2] = USERPIECHART3; CHARTS[3] = USERPIECHART4; for (int j = 0; J < 4; J + +) {list<string> data = new list<string> (); list<int> ints = new list<int> (); for (int i = 0; i < random. Next (4, 8); i++) {data. ADD (random. Next (100, 999). ToString ()); INTs. ADD (random. Next (1, 5)); } Charts[j]. Setdatasource (data. ToArray (), INTs. ToArray ()); } } }
It is nothing more than generating random names and data, and using Setdatasource to implement the data itself. The effect is as follows:
The colors here are also randomly obtained, prohibiting the automatic generation of white and close white. If you need to specify your own color, you need to call the method's overloaded method, passing in another type of data, allowing the name, value, and color to be passed in.
Other controls:
Not to be continued ...
C # Time Control vertical progress bar pie Chart Show button base Control Library