current position:Home>Problems related to the use of C PropertyGrid
Problems related to the use of C PropertyGrid
2022-02-02 15:02:51 【CSDN Q & A】
public class Cavity { public double X { get; set; } public double Y { get; set; } public double Angle { get; set; } public override string ToString() { return X.ToString() + "," + Y.ToString() + "," + Angle.ToString(); } } public class Setting { protected ConcurrentDictionary<string, string> settingMap = new ConcurrentDictionary<string, string>(); private Cavity _cavity = new Cavity(); [TypeConverter(typeof(ExpandableObjectConverter))] public Cavity Cavity1 { get { //return _cavity; return ConvertStr2Object(settingMap["Cavity1"], ','); } set { //_cavity = value; settingMap["Cavity1"] = ConvertObject2Str(value, ','); } }}
I need to modify X、Y、Angle Corresponding execution Cavity1 Low Set, But it can't be implemented in practice , Setting Low Cavity There will also be multiple properties , such as Cavity2,Cavity3 etc. Help me see how to solve it thank you
Refer to the answer 1:
Solve the above problems , What I'm thinking is a clever way
namespace Paramsss{ [TypeConverter(typeof(ExpandableObjectConverter))] public class Cavity { public Cavity(string str) { Name = str; } [Browsable(false)] public string Name { get; set; } public double X { get { return Globals.Setting1.ConvertStr2Double(Globals.Setting1.settingMap[Name], ',',0); } set { Globals.Setting1.settingMap[Name] =Globals.Setting1.ConvertDouble2Str(value,Y,Angle,','); ToString(); } } public double Y { get { return Globals.Setting1.ConvertStr2Double(Globals.Setting1.settingMap[Name], ',', 1); } set { Globals.Setting1.settingMap[Name] = Globals.Setting1.ConvertDouble2Str(X, value, Angle, ','); ToString(); } } public double Angle { get { return Globals.Setting1.ConvertStr2Double(Globals.Setting1.settingMap[Name], ',', 2); } set { Globals.Setting1.settingMap[Name] = Globals.Setting1.ConvertDouble2Str(X, Y, value, ','); ToString(); } } public override string ToString() { return "X="+X.ToString() + ", Y=" + Y.ToString() + ", Angle=" + Angle.ToString(); } } public class Setting { private Cavity _cavity1 = new Cavity("Cavity1"); private Cavity _cavity2 = new Cavity("Cavity2"); private Cavity _cavity3 = new Cavity("Cavity3"); private Cavity _cavity4 = new Cavity("Cavity4"); private Cavity _cavity5 = new Cavity("Cavity5"); private Cavity _cavity6 = new Cavity("Cavity6"); private Cavity _cavity7 = new Cavity("Cavity7"); private Cavity _cavity8 = new Cavity("Cavity8"); public Cavity Cavity1 { get { return _cavity1; } set { _cavity1 = value; } } public Cavity Cavity2 { get { return _cavity2; } set { _cavity2 = value; } } public Cavity Cavity3 { get { return _cavity3; } set { _cavity3 = value; } } public Cavity Cavity4 { get { return _cavity4; } set { _cavity4 = value; } } public Cavity Cavity5 { get { return _cavity5; } set { _cavity5 = value; } } public Cavity Cavity6 { get { return _cavity6; } set { _cavity6 = value; } } public Cavity Cavity7 { get { return _cavity7; } set { _cavity7 = value; } } public Cavity Cavity8 { get { return _cavity8; } set { _cavity8 = value; } } public ConcurrentDictionary<string, string> settingMap = new ConcurrentDictionary<string, string>(); public double ConvertStr2Double(string str, char c, int v) { try { string[] ss = str.Split(c); return Convert.ToDouble(ss[v]); } catch { return 0; } } public string ConvertDouble2Str(double x, double y, double angle, char c) { try { return x.ToString() + c + y.ToString() + c + angle.ToString(); } catch { return ""; } } }
Refer to the answer 2:
Refer to the answer 3:
Hello , I am a little assistant who answers every question , So sorry , This time, you have to answer all your questions , The panel of technical experts timed out and did not answer for you
The number of times to answer all questions deducted from this question , Will answer with questions VIP Experience card (1 A chance to answer every question 、 Shopping malls buy physical books and enjoy 95 A discount ) It will be reissued to your account in the form of .
Because all questions must be answered VIP The experience card is only valid for 1 God , When you need it 【 Direct messages 】 Contact me , I'll reissue it for you .
Refer to the answer 4:
copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021502497337.html
The sidebar is recommended
- What are the impossible out of stack sequences when a certain in stack sequence is CADB?
- How to do this!
- Given a matrix of N x n, find the matrix after 90 degrees of rotation
- Mac Pro M1 chip 13 inch how to delete non store software?
- Is there any student to answer the single linked list in the data structure
- On the problem of incomplete display of Vue multi selection box data
- About the problem of incomplete data acquisition in Vue's select multiple selection box
- 360 fast travel assistant how to delete
- What are the experimental equipment and requirements of C language experiment report
- Why do the left and right shifts of bit operations correspond to decimal multiplication and division
guess what you like
-
C language will not be painful, seek solutions
-
Trigger implementation inserts some fields of one table into another table
-
A sine wave is known, with peak to peak value of 1V and frequency of 10kHz; Now it is necessary to obtain a sine wave with three times the frequency of the sine wave and a peak to peak value of 9V. Circuit diagram and parameter calculation process
-
I want to ask whether this SQL statement is correct and can you get data? This error is displayed
-
Using function to store and read text file test TXT
-
I have encountered several array problems in C + +. I hope the big God can solve the puzzle. It's best to have comments
-
Why does WindowBuilder keep making mistakes when running on eclipse
-
What if there are only 5 plug-ins in QGIS
-
Use the geo path map in echorts to operate, but import your own SVG and it will not be displayed
-
Panel problem of vs2022
Random recommended
- Design a mathutils Java class file
- Design of identity authentication based on Lamport scheme
- How does Simulink simulate the neutral point of permanent magnet synchronous motor (connected to the midpoint of bus capacitance)?
- Excuse me: it is known that 9 of the 300 experimental samples have been wrongly divided. What is the penalty factor C in the SVM model?
- Is there any common Python tutorial that even a fool can understand?
- The pointer of the derived class shows why the value of the pointer data member converted to the base class has changed. Please explain
- Initialization of structure variables, application
- How can the data in the red box be displayed in the black box classification according to the status?
- Position in CSS: after fixed, it will appear in the original position after entering the page, and then flash to the fixed position
- How do the from attribute and to attribute of QML propertyanimation change
- Want to know what this code means
- Design a mathutils Java class file
- KNN algorithm can not come up with the best model selection
- After deployment, the project automatically reads the files under the login machine disk
- C # click the button to display the name of the folder on the control
- visual studio
- The use of cleanstate
- I don't understand what this means!!
- Machine learning Jupiter notebook spam filtering analysis report
- Run result and error content Print (dict_data ['content '] ['out']) keyerror: 'content, how to solve it?
- Appium code failed to open mobile app
- About the problems of C language 2022 calendar event recording system! (development tool eclipse)
- Restart Ubuntu as soon as VMware starts
- The computer network is normal, but some web pages can't be opened. What should I do
- Why can't you query after adding information
- The reinstallation system has been stuck in "starting windows"
- How did my visual studio code change like this
- Alien project spacecraft collision error
- Opencv play nine palace game
- What library does spider need to add? Why doesn't Anaconda
- Why not exchange? C language pointer
- There is a problem with my SQL statement
- First establish the input data into a binary sort tree, and then find the data. Enter the keyword sequence (63, 90, 70, 55, 67, 42, 98, 83, 10, 45, 58). 1. Establish a binary sort tree according to the order of the entered keywords.
- Why is x output 13 instead of 3
- Python code, interface problems
- Python basic problems, read and write files, and solve them in a basic way
- CSDN article reading statistics algorithm logic
- Swift5 dynamically obtain the height of the navigation bar and status bar
- Why is it not displayed in graphicsview
- MATLAB image hiding problem, please help