Summary of the invention
The present invention provides the method for the many forms of a kind of while convergent-divergent, can eliminate when carrying out forms convergent-divergent animation, and each forms changes inconsistent phenomenon, improves user experience and animation efficient, improves resource utilization ratio.
For achieving the above object the scheme of employing:
The method of a plurality of WPF forms of a kind of while convergent-divergent comprises step:
Newly-built image zoom control, the parent of said image zoom control is set to the WPF application program;
Obtain the WPF forms are transformed into the transformational relation of WPF forms with respect to the position of WPF application program Main form plane coordinate system with respect to the position of screen plane coordinate system;
Obtain the coordinate of click position with respect to screen;
The click position is changed according to said transformational relation with respect to the position of screen with respect to the coordinate of screen, each predetermined WPF forms;
Confirm the scope that the image zoom control need show according to transformation result;
When the WPF forms are show state, these WPF forms are played up image; And image put into the image zoom control;
Reference position and end position according to transformation result initialisation image convergent-divergent; And the animation time of initialisation image zoom control at interval;
Reference position, end position animation time according to said image zoom carry out image zoom at interval in the scope that said image zoom control need show.
The inventive method produces animation effect when opening or closing the WPF forms through the image zoom control is feasible.Before animation began, newly-built image zoom control and its parent were set to the WPF application program; Then the WPF forms are transformed into the plane coordinate system of WPF forms for WPF application software Main form for the plane coordinate system of screen, according to the position of preset WPF forms, can confirm the scope that the image zoom control need show thus for screen; The WPF forms are played up image put into image zoom control; According to click position after the coordinate transformation and reference position and the end position of the WPF forms of being scheduled to for the location definition image zoom of screen; Define animation time more at interval; Open or close the animation effect of WPF forms then, can eliminate when carrying out forms convergent-divergent animation, each forms changes inconsistent phenomenon, improves user experience and animation efficient, improves resource utilization ratio.
The present invention provides the device of the many forms of a kind of while convergent-divergent, can eliminate when carrying out forms convergent-divergent animation, and each forms changes inconsistent phenomenon, improves user experience and animation efficient, improves resource utilization ratio.
For achieving the above object the scheme of employing:
The device of a plurality of WPF forms of a kind of while convergent-divergent comprises:
Control is created the unit, is used for newly-built image zoom control, and the parent of said image zoom control is set to the WPF application program;
First acquiring unit is used to obtain the WPF forms is transformed into the transformational relation of WPF forms with respect to the position of WPF application program Main form plane coordinate system with respect to the position of screen plane coordinate system;
Second acquisition unit is used to obtain the coordinate of click position with respect to screen;
Coordinate transformation unit is used for the click position is changed according to said transformational relation with respect to position, height and the width of screen with respect to the coordinate of screen, each predetermined WPF forms;
The control displaying contents is confirmed the unit, is used for confirming the scope that the image zoom control need show according to transformation result;
WPF forms rendering unit is used to obtain WPF forms state, when the WPF forms are show state, these WPF forms is played up image; And image put into the image zoom control;
Initialization unit is used for reference position and end position according to transformation result initialisation image convergent-divergent; And the animation time of initialisation image zoom control at interval;
The image zoom unit, the reference position, the end position animation time that are used for according to said image zoom carry out image zoom at interval in the scope that said image zoom control need show.
Apparatus of the present invention produce animation effect when opening or closing the WPF forms through the image zoom control is feasible.Before animation began, newly-built image zoom control and its parent were set to the WPF application program; Then the WPF forms are transformed into the plane coordinate system of WPF forms for WPF application software Main form for the plane coordinate system of screen, according to the position of preset WPF forms, can confirm the scope that the image zoom control need show thus for screen; The WPF forms are played up image put into image zoom control; According to click position after the coordinate transformation and reference position and the end position of the WPF forms of being scheduled to for the location definition image zoom of screen; Define animation time more at interval; Open or close the animation effect of WPF forms then, can eliminate when carrying out forms convergent-divergent animation, each forms changes inconsistent phenomenon, improves user experience and animation efficient, improves resource utilization ratio.
Embodiment
For ease of understanding, set forth below in conjunction with accompanying drawing.
The present invention proposes the method for a plurality of WPF forms of a kind of while convergent-divergent, please refer to Fig. 1, comprises step:
101, newly-built image zoom control;
Newly-built image zoom control, the parent of image zoom control is set to the WPF application program.
102, obtain the transformational relation that screen coordinate is tied to WPF application program coordinate;
Obtain the WPF forms are transformed into the transformational relation of WPF forms with respect to the position of WPF application program Main form plane coordinate system with respect to the position of screen plane coordinate system.
As a kind of concrete real-time mode, can adopt following steps:
Obtain cursor of mouse with respect to the coordinate of screen plane coordinate system and this cursor of mouse coordinate with respect to WPF application program Main form plane coordinate system;
With cursor of mouse with respect to the coordinate of screen and cursor of mouse with respect to the ratio of the coordinate of WPF application program as transformational relation.
103, obtain the coordinate of click position at screen coordinate system;
104, carry out coordinate conversion;
The click position is changed according to the transformational relation in the step 102 with respect to the position of screen plane coordinate system with respect to the coordinate of screen plane coordinate system, each predetermined WPF forms.
105, confirm image zoom control indication range according to transformation result;
106, the WPF forms are played up image and put into the image zoom control;
When the WPF forms are show state, these WPF forms are played up image; And image put into the image zoom control.
107, the reference position of initialization control animation, end position and the time interval;
Reference position and end position according to transformation result initialisation image convergent-divergent; And the animation time of initialisation image zoom control at interval.
As a kind of concrete real-time mode; Can adopt following steps: when opening the WPF forms; Click position after the conversion is initialized as the reference position of image zoom with respect to the coordinate of screen, is the end position of image zoom with each the predetermined WPF forms after the conversion with respect to the position initialization of screen;
When closing the WPF forms; From transform each predetermined WPF forms position of back with respect to screen; Obtain and leave nearest horizontal ordinate of WPF application program Main form plane coordinate system initial point and nearest ordinate; Horizontal ordinate that this is nearest and nearest ordinate are initialized as the reference position of image zoom, the click position after the conversion are initialized as the end position of image zoom with respect to the coordinate of screen.
108,, carry out image zoom according to reference position, end position, the time interval and indication range.
Reference position, end position and animation time according to image zoom carry out image zoom at interval in the scope that the image zoom control need show.
The inventive method produces animation effect when opening or closing the WPF forms through the image zoom control is feasible.Before animation began, newly-built image zoom control and its parent were set to the WPF application program; Then the WPF forms are transformed into the plane coordinate system of WPF forms for WPF application software Main form for the plane coordinate system of screen, according to the position of preset WPF forms, can confirm the scope that the image zoom control need show thus for screen; The WPF forms are played up image put into image zoom control; According to click position after the coordinate transformation and reference position and the end position of the WPF forms of being scheduled to for the location definition image zoom of screen; Define animation time more at interval; Open or close the animation effect of WPF forms then, can eliminate when carrying out forms convergent-divergent animation, each forms changes inconsistent phenomenon, improves user experience and animation efficient, improves resource utilization ratio.
Wherein, step 105 comprises:
From transform each predetermined WPF forms position of back with respect to screen; Obtain from WPF application program Main form plane coordinate system initial point horizontal ordinate farthest, nearest horizontal ordinate, ordinate farthest and nearest ordinate the width of the scope that the value that deducts nearest horizontal ordinate with horizontal ordinate farthest need show as said image zoom control; The height of the scope that the value that deducts nearest ordinate with ordinate farthest need show as said image zoom control.Concrete, set up screen plane coordinate system as shown in Figure 3, comprise that three WPF forms (1,2 and 3) are A from the nearest horizontal ordinate of coordinate origin; Horizontal ordinate farthest is B, and ordinate farthest is H, and nearest ordinate is G; Hence one can see that, and on screen, the zone of each WPF forms representative is shown in the CDEF; Again the scope of CDEF representative is converted to the plane coordinate system of WPF application program Main form, is zoom control and needs indication range.
In order to make image zoom that better visual effect arranged, when in step 107, carrying out the image zoom initialization, the transparency when also comprising the initialization animation.When opening the WPF forms, transparency from 0 to 1 gradual change is set; When closing the WPF forms, transparency from 1 to 0 gradual change is set, wherein, 0 expression is transparent fully, and 1 expression is opaque.
When closing forms in order to eliminate, the screen flicker situation of appearance can be provided with the time interval of hiding the WPF forms before carrying out image zoom, and the time interval of hiding the WPF forms is less than the animation time interval.
In order to eliminate when animation begins, the situation of flicker appears in screen, can be before opening the image zoom of forms, and it is overseas that the WPF forms that needs are played up image are arranged on screen display area.
In 106 steps, can image be put into the image zoom control according to the sequencing of playing up, make things convenient for the demonstration of image zoom control.
Please refer to Fig. 2, the device of a plurality of WPF forms of a kind of while convergent-divergent comprises:
Control is created unit T1, is used for newly-built image zoom control, and the parent of image zoom control is set to the WPF application program;
The first acquiring unit T2 is used to obtain the WPF forms is transformed into the transformational relation of WPF forms with respect to the position of WPF application program Main form plane coordinate system with respect to the position of screen plane coordinate system;
Second acquisition unit T3 is used to obtain the coordinate of click position with respect to screen;
Coordinate transformation unit T4 is used for the click position is changed according to above-mentioned transformational relation with respect to the position of screen with respect to the coordinate of screen, each predetermined WPF forms;
The control displaying contents is confirmed unit T5, is used for confirming the scope that the image zoom control need show according to height and width after the conversion;
WPF forms rendering unit T6 is used to obtain WPF forms state, when the WPF forms are show state, these WPF forms is played up image; And image put into the image zoom control;
Initialization unit T7 is used for reference position and end position according to transformation result initialisation image convergent-divergent; And the animation time of initialisation image zoom control at interval;
Image zoom unit T8, the reference position, end position and the animation time that are used for according to image zoom carry out image zoom at interval in the scope that the image zoom control need show.
Apparatus of the present invention produce animation effect when opening or closing the WPF forms through the image zoom control is feasible.Before animation began, newly-built image zoom control and its parent were set to the WPF application program; Then the WPF forms are transformed into the plane coordinate system of WPF forms for WPF application software Main form for the plane coordinate system of screen, according to the position of preset WPF forms, can confirm the scope that the image zoom control need show thus for screen; The WPF forms are played up image put into image zoom control; According to click position after the coordinate transformation and reference position and the end position of the WPF forms of being scheduled to for the location definition image zoom of screen; Define animation time more at interval; Open or close the animation effect of WPF forms then, can eliminate when carrying out forms convergent-divergent animation, each forms changes inconsistent phenomenon, improves user experience and animation efficient, improves resource utilization ratio.
Wherein, when the first acquiring unit T2 obtains transformational relation, obtain cursor of mouse with respect to the coordinate of screen and this cursor of mouse coordinate with respect to the WPF application program; With cursor of mouse with respect to the coordinate of screen and cursor of mouse with respect to the ratio of the coordinate of WPF application program as transformational relation;
When the control displaying contents confirms that unit T5 confirms indication range; From transform each predetermined WPF forms position of back with respect to screen; Obtain from WPF application program Main form plane coordinate system initial point horizontal ordinate farthest, nearest horizontal ordinate, ordinate farthest and nearest ordinate the width of the scope that the value that deducts nearest horizontal ordinate with horizontal ordinate farthest need show as said image zoom control; The height of the scope that the value that deducts nearest ordinate with ordinate farthest need show as said image zoom control;
When the reference position of initialization unit T7 initialisation image convergent-divergent and end position; If open the WPF forms; Click position after then will changing is initialized as the reference position of image zoom with respect to the coordinate of screen, is the end position of image zoom with each the predetermined WPF forms after the conversion with respect to the position initialization of screen; If close the WPF forms; Then from transform each predetermined WPF forms position of back with respect to screen; Obtain and leave nearest horizontal ordinate of WPF application program Main form plane coordinate system initial point and nearest ordinate; Horizontal ordinate that this is nearest and nearest ordinate are initialized as the reference position of image zoom, the click position after the conversion are initialized as the end position of image zoom with respect to the coordinate of screen.
In order to make image zoom that better visual effect arranged, when initialization unit T7 carries out the image zoom initialization, the transparency when also comprising the initialization animation.When opening the WPF forms, transparency from 0 to 1 gradual change is set; When closing the WPF forms, transparency from 1 to 0 gradual change is set, wherein, 0 expression is transparent fully, and 1 expression is opaque.
When closing forms in order to eliminate, the screen flicker situation of appearance, initialization unit T7 is provided with the time interval of hiding the WPF forms, and the time interval of hiding the WPF forms is less than the animation time interval.
In order to eliminate when animation begins, the situation of flicker appears in screen, can be before opening the image zoom of forms, and it is overseas that the WPF forms that needs are played up image are arranged on screen display area.
WPF forms rendering unit T6 can put into the image zoom control according to the sequencing of playing up with image, makes things convenient for the demonstration of image zoom control.
As a kind of concrete real-time mode, open a plurality of WPF forms (these several forms height can be different, and width can be different) from the WPF application program; Whole forms buttons are closed in click, and image zoom control (for example ViewBox) comes across this above several forms, and these several WPF forms disappear then; ViewBox begins animation; Height is wide from the starting position dwindles transparency from 1 to 0 gradual change, the place (end position) of last indentation click gradually; Whole process animation is smooth, screen flicker do not occur.
Above embodiment of the present invention does not constitute the qualification to protection domain of the present invention.Any modification of within spirit of the present invention and principle, being done, be equal to replacement and improvement etc., all should be included within the claim protection domain of the present invention.