Detailed description of the invention
It should be noted that in the case of not conflicting, the embodiment in the application and the feature in embodiment can phases
Combination mutually.Describe the present invention below with reference to the accompanying drawings and in conjunction with the embodiments in detail.
In order to make those skilled in the art be better understood from the present invention program, below in conjunction with in the embodiment of the present invention
Accompanying drawing, to being clearly and completely described in the embodiment of the present invention, it is clear that described embodiment is only this
The embodiment of an invention part rather than whole embodiments.Based on the embodiment in the present invention, common in this area
Technical staff does not make the every other embodiment obtained under creative work premise, all should belong to the present invention's
Protection domain.
It should be noted that term " first " in description and claims of this specification and above-mentioned accompanying drawing,
" second " etc. are for distinguishing similar object, without being used for describing specific order or precedence.Should manage
Solve the data so used can exchange in the appropriate case, in order to embodiments of the invention described herein can be to remove
Order beyond those that here illustrate or describe is implemented.Additionally, term " includes " and " having " and he
Any deformation, it is intended that cover non-exclusive comprising.
According to embodiments of the invention, it is provided that the display of a kind of HScrollBar for DataGrid control processes dress
Putting, this is used for the display processing unit of HScrollBar of DataGrid control for showing that HScrollBar is to check
Having the information of row, wherein it is desired to explanation, the display of this HScrollBar being used for DataGrid control processes dress
Put and do not had no data to have by current data Net Lattice Controls to be affected when showing HScrollBar.
Fig. 1 is the display processing unit of the HScrollBar for DataGrid control according to a first embodiment of the present invention
Schematic diagram.
As it is shown in figure 1, this device includes: the first acquiring unit 10, second acquisition unit 20 and display unit 30.
First acquiring unit 10 is for obtaining the null in DataGrid control.In embodiments of the present invention, data network
Lattice control can be the DataGrid control in WPF, and this DataGrid control exists in advance when data are empty
The null set, and the whether visible attribute of the row pattern of this null is preset as invisible, so, when in this null
During middle loading data, the data being loaded do not appear in the relevant position of DataGrid control.It addition, DataGrid control
In part, data are that sky refers to do not have data in DataGrid control.It should be noted that in embodiments of the present invention, empty
Row includes a container, and the overall width of container is the overall width of null.The overall width of null can be with data grids
In control, the col width summation of all row is consistent, or the overall width of null can be more than all row in DataGrid control
Col width summation, or the overall width of null can be less than the col width summation of all row in DataGrid control.
Second acquisition unit 20 is for when the data of DataGrid control are empty, obtaining data grids control by null
The col width summation of all row in part.Specifically, in embodiment of the present invention, second acquisition unit 20 can pass through
The overall width of null obtains the col width summation of all row in DataGrid control, it should be noted that second acquisition unit
The 20 DataGrid control col width summations that can get the overall width equal to null, second acquisition unit 20 can also
Getting the DataGrid control col width summation of the overall width more than null, second acquisition unit 20 can also get
Less than the DataGrid control col width summation of the overall width of null, wherein, when the col width of each row is equal, all row
Col width summation equal to the product of col width and the columns of single row;When the col width of each row is unequal, the row of all row
Wide summation is equal to the cumulative sum of the col width of each row.
Display unit 30 shows HScrollBar for the col width summation according to row all in DataGrid control.At this
In inventive embodiments, specifically, when in the DataGrid control that second acquisition unit 20 obtains the col width of all row total
With time equal with the overall width of null, then display unit 30 can show that HScrollBar is to search DataGrid control just
All column informations in part;When in the DataGrid control that second acquisition unit 20 obtains, the col width summation of all row is more than
When the overall width of null is equal, then display unit 30 can show that HScrollBar is to search part in DataGrid control
Column information or display unit 30 can not show HScrollBar;When the DataGrid control that second acquisition unit 20 obtains
When in part, the col width summation of all row is less than the overall width of null, then display unit 30 can not only show HScrollBar
To search all column informations in DataGrid control, moreover it is possible to display is not belonging to other parts of column information.
By the present invention, use the null that the first acquiring unit 10 obtains in DataGrid control;Second acquisition unit
20 when the data of DataGrid control are empty, obtain the col width of all row in DataGrid control by null total
With;And display unit 30 shows HScrollBar according to the col width summation of row all in DataGrid control, solve
In correlation technique when no data, DataGrid control cannot show that horizontal scroll bar is to check asking of current all row
Topic, and then reached not directly displayed HScrollBar to check institute in DataGrid control by limiting with presence or absence of data
There is the effect of row.
Fig. 2 is the display processing unit of the HScrollBar for DataGrid control according to a second embodiment of the present invention
Schematic diagram.
As in figure 2 it is shown, this embodiment can be as the preferred embodiment of embodiment illustrated in fig. 1, the use of this embodiment
Display processing unit in the HScrollBar of DataGrid control include first embodiment the first acquiring unit 10,
Second acquisition unit 20 and display unit 30, wherein, second acquisition unit 20 include the first acquisition module 201,
Two acquisition modules 202, binding module 203 and the 3rd acquisition module 204.
First acquiring unit 10 is identical with first embodiment with the effect of display unit 30, does not repeats them here.
First acquisition module 201 is for obtaining the current data content in DataGrid control.It should be noted that
In the embodiment of the present invention, if the row in DataGrid control is as a class, then each row of row are exactly in such
One object, and the corresponding field in such of each row, so, current data content is data grids control
The data content of the every a line in part.
Second acquisition module 202 is for obtaining the parent data content of current data content.It should be noted that at this
In inventive embodiments, if DataGrid control is as a class, then the every a line in DataGrid control is exactly such
In an object, and the corresponding field in such of every a line, so, parent data content is data network
The data content at lattice control place, the second acquisition module 202 may be used for obtaining the DataGrid control place at row place
Data content, row here can be null.
Binding module 203 for being tied to the self-defining row of parent data content of current data content by the width of container
Width attribute, i.e. binding module 20 may be used for the width of container being tied to the DataGrid control at row place certainly
The line width attribute of definition, wherein, container is the container of null, and the row pattern of null corresponding to container is visible
Whether attribute is preset as invisible, and so, when loading data in this embodiment, the data being loaded do not appear in
The relevant position of DataGrid control, line width attribute includes the overall width of row set in advance, and this line width attribute is used
In obtaining the col width summation of all row in DataGrid control, so, binding module 203 may be used for the width of null
Degree is tied on the DataGrid control self-defining line width attribute at null place.
It should be noted that in embodiments of the present invention, can only be obtained by the first acquisition module 201 or second
Module 202 obtains self-defining line width attribute, and without using the first acquisition module 201 and second to obtain mould simultaneously
Block 202 is to obtain self-defining line width attribute.
3rd acquisition module 204 is for obtaining the col width summation of all row in DataGrid control by line width attribute.?
In the embodiment of the present invention, the overall width of the row in line width attribute is equal to the col width summation of all row in DataGrid control.
By the embodiment of the present invention, use binding module 203 that the overall width of null is tied to the col width in line width attribute
Summation, it is achieved that the purpose that the col width summation of the overall width of null row all with DataGrid control is equal, reaches
Just display HScrollBar is to check the effect of all column informations.
Fig. 3 is the display processing unit of the HScrollBar for DataGrid control according to a third embodiment of the present invention
Schematic diagram.
As it is shown on figure 3, this embodiment can be as the preferred embodiment of embodiment illustrated in fig. 2, the use of this embodiment
Display processing unit in the HScrollBar of DataGrid control include the second embodiment the first acquiring unit 10,
Second acquisition unit 20 and display unit 30, wherein, second acquisition unit 20 is except including the first acquisition module
201, outside the second acquisition module 202, binding module 203 and the 3rd acquisition module 204, computing module is also included
205 and assignment module 206, computing module 205 and assignment module 206 be used for obtaining the self-defining row of DataGrid control
Width attribute.
First acquiring unit 10 and display unit 30 and first acquisition module the 201, second acquisition module 202, binding
Module 203 is identical with first embodiment with the effect of the 3rd acquisition module 204, does not repeats them here.
Computing module 205 is for calculating total col width on the data content of DataGrid control.Specifically, when each
When the col width of row is equal, total col width is equal to the col width of single row and the product of columns;When the col width of each row is unequal
Time, total col width is equal to the cumulative sum of the col width of each row.
Assignment module 206 for being assigned to self-defining line width attribute by total col width, i.e. assignment module 206 can be used
In calculated for computing module 205 total col width being assigned to the preset value of line width in DataGrid control, wherein,
The preset value of line width is line width attribute.
Fig. 4 is the display processing unit of the HScrollBar for DataGrid control according to a fourth embodiment of the present invention
Schematic diagram.
As shown in Figure 4, this embodiment can be as the preferred embodiment of embodiment illustrated in fig. 1, the use of this embodiment
In the display processing unit of HScrollBar of DataGrid control except including the first acquiring unit of first embodiment
10, outside second acquisition unit 20 and display unit 30, loading unit 40 is also included.
The effect of the first acquiring unit 10, second acquisition unit 20 and display unit 30 and the phase in first embodiment
With, do not repeat them here.
Loading unit 40 is before showing HScrollBar in the col width summation according to row all in DataGrid control
Data source is loaded for DataGrid control.Data source refers to provide container or the original media of certain required data,
That is, data source is the source of data, can be found the database at data place by data source.In the embodiment of the present invention
In, loading unit 40 may be used for DataGrid control and is loaded with the data source of data and the data source of no data.
Fig. 5 is the display processing unit of the HScrollBar for DataGrid control according to a fifth embodiment of the present invention
Schematic diagram.
As it is shown in figure 5, this embodiment can be as the preferred embodiment of embodiment illustrated in fig. 4, the use of this embodiment
In the display processing unit of HScrollBar of DataGrid control except including the first acquiring unit of the 4th embodiment
10, outside second acquisition unit 20, display unit 30 and loading unit 40, also include judging unit 50, process list
Unit 60, unit 70 and assignment unit 80 are set.
The effect of the first acquiring unit 10, second acquisition unit 20, display unit 30 and loading unit 40 is real with first
That executes in example is identical, does not repeats them here.
Whether judging unit 50 is empty, wherein, when data source no data for judging the data source of DataGrid control
Time, it is judged that it is empty for this data source, otherwise when data source has data, it is judged that be sky for this data source.
If processing unit 60 is not empty for the data source of DataGrid control, do not process.Real in the present invention
Execute in example, do not process and refer to DataGrid control not processed.
If arranging unit 70 for the data source of DataGrid control is sky, then by user's energy of DataGrid control
The attribute of no interpolation newline is set to very, and so, DataGrid control will add a line null automatically.Need explanation
, in embodiments of the present invention, arranging unit 70 can replace with adding device, and this adding device is at sky
Row adds meaningless data, and these meaningless data refer to any data, and these the meaningless data in null
Do not appear in DataGrid control.
Assignment unit 80 is used for after the attribute that can the user of DataGrid control add newline is set to very,
The line width of DataGrid control is entered as the line width of null.
According to embodiments of the invention, it is provided that the display process side of a kind of HScrollBar for DataGrid control
Method, this is used for the display processing method of HScrollBar of DataGrid control for showing that HScrollBar is to check
Having the information of row, wherein it is desired to explanation, the display of this HScrollBar being used for DataGrid control processes dress
Put and do not had no data to have by current data Net Lattice Controls to be affected when showing HScrollBar.This is used for data grids control
The display processing method of the HScrollBar of part may operate on computer-processing equipment.It should be noted that this
The display processing method of the HScrollBar for DataGrid control that bright embodiment is provided can be real by the present invention
The display processing unit for the HScrollBar of DataGrid control executing example performs, being used for of the embodiment of the present invention
The display processing unit of the HScrollBar of DataGrid control can be used for perform the embodiment of the present invention for data
The display processing method of the HScrollBar of Net Lattice Controls.
Fig. 6 is the display processing method of the HScrollBar for DataGrid control according to a first embodiment of the present invention
Flow chart.
As shown in Figure 6, the method includes that steps S101 is to step S103:
Step S101, obtains the null in DataGrid control.
In embodiments of the present invention, DataGrid control can be the DataGrid control in WPF, and should
There is null set in advance when data are for sky in DataGrid control, and the whether visible of row pattern of this null belongs to
Property be preset as invisible, so, when in this null load data time, the data being loaded do not appear in DataGrid
The relevant position of control.It addition, data are that sky refers to do not have data in DataGrid control in DataGrid control.Need
Being noted that in embodiments of the present invention, null includes a container, and the overall width of container is the total of null
Width.The overall width of null can the col width summation of row all with DataGrid control consistent, or the beam overall of null
Degree can be more than the col width summation of all row in DataGrid control, or the overall width of null can be less than data grids
The col width summation of all row in control.
Step S102, obtains the col width summation of all row in DataGrid control by null.
Specifically, in embodiment of the present invention, can obtain in DataGrid control all by the overall width of null
The col width summation of row, it should be noted that the DataGrid control col width that can get the overall width equal to null is total
With, it is also possible to get the DataGrid control col width summation of the overall width more than null, it is also possible to get less than sky
The DataGrid control col width summation of the overall width of row, wherein, when the col width of each row is equal, the col width of all row
Summation is equal to the col width of single row and the product of columns;When the col width of each row is unequal, the col width summation of all row
Cumulative sum equal to the col width of each row.
Step S103, shows HScrollBar according to the col width summation of row all in DataGrid control.
In embodiments of the present invention, specifically, when the col width summation of all row and null in the DataGrid control obtained
Overall width equal time, the most just can show that HScrollBar is to search all column informations in DataGrid control;When obtaining
When the col width summation of all row is equal more than the overall width of null in the DataGrid control taken, then can show horizontal rolling
Bar is with part column information in lookup DataGrid control or can not show HScrollBar;When the DataGrid control obtained
When the col width summation of all row is less than the overall width of null in part, then can not only show that HScrollBar is to search
All column informations in DataGrid control, moreover it is possible to display is not belonging to other parts of column information.
In embodiments of the present invention, the display processing method of this HScrollBar being used for DataGrid control can also wrap
Include and loaded for DataGrid control before the col width summation according to row all in DataGrid control shows HScrollBar
Data source.Data source refers to provide container or the original media of certain required data, i.e. data source is data
Source, can find the database at data place by data source.In embodiments of the present invention, can be data grids
Control is loaded with the data source of data and the data source of no data.
By the present invention, use the null obtained in DataGrid control;When data at DataGrid control are empty,
The col width summation of all row in DataGrid control is obtained by null;And according to row all in DataGrid control
Col width summation display HScrollBar, solves in correlation technique when no data, and DataGrid control cannot show horizontal stroke
To scroll bar to check the problem of all of row, and then reach not by limiting with presence or absence of data and the level that directly displays is rolled
Dynamic bar is to check the effect of all row in DataGrid control.
Fig. 7 is the display processing method of the HScrollBar for DataGrid control according to a second embodiment of the present invention
Flow chart.
As it is shown in fig. 7, the display processing method of this HScrollBar being used for DataGrid control includes the steps
S201 is to step S206, and this embodiment can be as the preferred embodiment of embodiment illustrated in fig. 6.
Step S201, with step S101 of embodiment illustrated in fig. 6, does not repeats them here.
Step S202, obtains the current data content in DataGrid control.
It should be noted that in embodiments of the present invention, if the row in DataGrid control is as a class, then go
Each row be exactly an object in such, and the corresponding field in such of each row, so, current number
Data content according to every a line that content is in DataGrid control.
Step S203, obtains the parent data content of current data content.
It should be noted that in embodiments of the present invention, if DataGrid control is as class, then data grids
Every a line in control is exactly an object in such, and the corresponding field in such of every a line, so,
Parent data content is the data content at DataGrid control place, can obtain the DataGrid control institute at row place
Data content, row here can be null.
Step S204, is tied to the self-defining line width of parent data content of current data content by the width of container
Attribute.
In embodiments of the present invention, the parent data content that the width of container is tied to current data content is self-defining
Line width attribute, i.e. the width of container is tied to the DataGrid control self-defining line width attribute at row place,
Wherein, container is the container of null, and the whether visible attribute of the row pattern of null corresponding to container be preset as can not
Seeing, so, when loading data in this embodiment, the data being loaded do not appear in the corresponding positions of DataGrid control
Putting, line width attribute includes the overall width of row set in advance, and this line width attribute is used for obtaining in DataGrid control
The col width summation of all row, as such, it is possible to the DataGrid control that the width of null is tied to null place is self-defined
Line width attribute on.In embodiments of the present invention, self-defining line width attribute obtains in the following manner: counting
According to calculating total col width on the data content of Net Lattice Controls, specifically, when the col width of each row is equal, total col width etc.
Col width and the product of columns in single row;When the col width of each row is unequal, total col width is equal to the col width of each row
Cumulative sum;Total col width is assigned to self-defining line width attribute, i.e. can be by calculated total col width assignment
To the preset value of line width in DataGrid control, wherein, the preset value of line width is line width attribute.
It should be noted that in embodiments of the present invention, can be only obtained from by step S202 or step S203
The line width attribute of definition, and without using step S202 and step S203 to belong to obtain self-defining line width simultaneously
Property.
Step S205, obtains the col width summation of all row in DataGrid control by line width attribute.
In embodiments of the present invention, the overall width of the row in line width attribute is equal to the col width of all row in DataGrid control
Summation.
Step S206, with step S103 of embodiment illustrated in fig. 6, does not repeats them here.
By the embodiment of the present invention, use the col width summation being tied in line width attribute by the overall width of null, it is achieved that
The purpose that the col width summation of the overall width of null row all with DataGrid control is equal, has reached lucky display level
Scroll bar is to check the effect of all column informations.
Fig. 8 is the display processing method of the HScrollBar for DataGrid control according to a third embodiment of the present invention
Flow chart.
As shown in Figure 8, the display processing method of this HScrollBar being used for DataGrid control includes the steps
S301 is to step S307, and this embodiment can be as the preferred embodiment of embodiment illustrated in fig. 6.
Step S301 is to step S302, respectively with step S101 of embodiment illustrated in fig. 6 to step S102, at this
Repeat no more.
Step S303, it is judged that whether the data source of DataGrid control is empty.
It should be noted that before whether the data source judging DataGrid control is sky, can first obtain data
Source, wherein, data source can include the form etc. that third-party agent, internet and user are imported by monitoring.Work as number
When having data according to source, it is judged that be not empty for this data source, perform step S304A, otherwise when data source no data,
It is judged as that this data source, for sky, performs step S304B.
Step S304A, does not processes.
If the data source of DataGrid control is not empty, do not process.In embodiments of the present invention, do not process
Refer to DataGrid control not processed.
Step S304B, is set to the attribute that can the user of DataGrid control add newline very.
If the data source of DataGrid control is empty, then can the user of DataGrid control be added the attribute of newline
Being set to true, so, DataGrid control will add a line null automatically.It should be noted that it is real in the present invention
Executing in example, can add meaningless data in null, these meaningless data refer to any data, and due to
The line sample attribute of null is invisible, and therefore, these the meaningless data in null do not appear in DataGrid control
In.
Step S305, is entered as the line width of null by the line width of DataGrid control.
In embodiments of the present invention, the attribute that can the user of DataGrid control be added newline be set to true it
After, the line width of DataGrid control is entered as the line width of null.
Step S306, loads data source for DataGrid control.
In embodiments of the present invention, data source refers to provide container or the original media of certain required data, i.e.
Data source is the source of data, can be found the database at data place by data source.In embodiments of the present invention,
Can be that DataGrid control is loaded with the data source of data and the data source of no data.
Step S307, with step S103 of embodiment illustrated in fig. 6, does not repeats them here.
As can be seen from the above description, by the present invention, the null obtained in DataGrid control is used;?
When the data of DataGrid control are empty, obtain the col width summation of all row in DataGrid control by null;And
Col width summation display HScrollBar according to row all in DataGrid control, solves in correlation technique at no data
Time, DataGrid control cannot show that horizontal scroll bar, to check the problem of all of row, and then has reached not by data
With presence or absence of limit and directly display HScrollBar to check the effect of all row in DataGrid control.
It should be noted that can be at such as one group of computer executable instructions in the step shown in the flow chart of accompanying drawing
Computer system performs, and, although show logical order in flow charts, but in some cases, can
With to be different from the step shown or described by order execution herein.
Obviously, those skilled in the art should be understood that each module of the above-mentioned present invention or each step can be with general
Calculating device realize, they can concentrate on single calculating device, or is distributed in multiple calculating device institute
On the network of composition, alternatively, they can realize with calculating the executable program code of device, it is thus possible to
It is stored in storing in device and is performed by calculating device, or they are fabricated to respectively each integrated circuit die
Block, or the multiple modules in them or step are fabricated to single integrated circuit module realize.So, the present invention
It is not restricted to any specific hardware and software combine.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.All within the spirit and principles in the present invention, made
Any modification, equivalent substitution and improvement etc., should be included within the scope of the present invention.