Summary of the invention
The invention provides the method for the many forms of a kind of while convergent-divergent, can eliminate while carrying out forms convergent-divergent animation, each forms change inconsistent phenomenon, improve user and experience and animation efficiency, improve resource utilization ratio.
For achieving the above object, the scheme of employing:
A method for the multiple WPF forms of while convergent-divergent, comprises step:
Newly-built image scaling control, the parent of described image scaling control is set to WPF application program;
Obtain 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 mouse click location with respect to screen;
Mouse click location is changed according to described transformational relation with respect to the position of screen with respect to the coordinate of screen, predetermined each WPF forms;
Determine according to transformation result the scope that image scaling control need show, comprise: from transforming in predetermined each WPF forms position with respect to screen, obtain from horizontal ordinate farthest of WPF application program Main form plane coordinate system initial point, nearest horizontal ordinate, ordinate farthest and nearest ordinate, deduct the width of the scope that the value of nearest horizontal ordinate need show as described image scaling control using horizontal ordinate farthest; Deduct the height of the scope that the value of nearest ordinate need show as described image scaling control using ordinate farthest;
In the time that WPF forms are show state, these WPF forms are played up to image; And image is put into image scaling control;
According to reference position and the end position of transformation result initialisation image convergent-divergent; And the animation time interval of initialisation image zoom control, particularly, in the time opening WPF forms, mouse click location after conversion is initialized as to the reference position of image scaling with respect to the coordinate of screen plane coordinate system, the end position that is image scaling with respect to the position initialization of screen by the predetermined each WPF forms after changing; In the time closing WPF forms, from transforming in predetermined each WPF forms position with respect to screen, obtain the horizontal ordinate nearest from WPF application program Main form plane coordinate system initial point and nearest ordinate, this nearest horizontal ordinate and nearest ordinate are initialized as to the reference position of image scaling, the mouse click location after conversion are initialized as to the end position of image scaling with respect to the coordinate of screen;
In the scope that need show at described image scaling control according to the reference position of described image scaling, end position animation time interval, carry out image scaling.
The inventive method produces animation effect when making to open by image scaling control or closing WPF forms.Before animation starts, newly-built image scaling control its parent are set to WPF application program; Then 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, the position for screen according to default WPF forms, can determine the scope that image scaling control need show thus; WPF forms are played up to image and put into image scaling control; The predetermined WPF forms of reference position and end position according to the mouse click location after coordinate transformation and to(for) the position definition image scaling of screen; Define again animation time interval; Then open or close the animation effect of WPF forms, can eliminate while carrying out forms convergent-divergent animation, each forms change inconsistent phenomenon, improve user and experience and animation efficiency, improve resource utilization ratio.
The invention provides the device of the many forms of a kind of while convergent-divergent, can eliminate while carrying out forms convergent-divergent animation, each forms change inconsistent phenomenon, improve user and experience and animation efficiency, improve resource utilization ratio.
For achieving the above object, the scheme of employing:
A device for the multiple WPF forms of while convergent-divergent, comprising:
Control creating unit, for newly-built image scaling control, the parent of described image scaling control is set to WPF application program;
The first acquiring unit, is transformed into WPF forms transformational relation with respect to the position of WPF application program Main form plane coordinate system by WPF forms with respect to the position of screen plane coordinate system for obtaining;
Second acquisition unit, for obtaining the coordinate of mouse click location with respect to screen;
Coordinate transformation unit, for changing mouse click location with respect to position, height and the width of screen with respect to the coordinate of screen, predetermined each WPF forms according to described transformational relation;
Control displaying contents determining unit, for determining the scope that image scaling control need show according to transformation result; When described control displaying contents determining unit is determined indication range, from transforming in predetermined each WPF forms position with respect to screen, obtain from horizontal ordinate farthest of WPF application program Main form plane coordinate system initial point, nearest horizontal ordinate, ordinate farthest and nearest ordinate, deduct the width of the scope that the value of nearest horizontal ordinate need show as described image scaling control using horizontal ordinate farthest; Deduct the height of the scope that the value of nearest ordinate need show as described image scaling control using ordinate farthest;
WPF forms rendering unit, for obtaining WPF forms state, in the time that WPF forms are show state, plays up image by these WPF forms; And image is put into image scaling control;
Initialization unit, for according to reference position and the end position of transformation result initialisation image convergent-divergent; And the animation time interval of initialisation image zoom control;
Image scaling unit, for carrying out image scaling in the scope that need show at described image scaling control according to the reference position of described image scaling, end position and animation time interval.
Apparatus of the present invention produce animation effect when making to open by image scaling control or closing WPF forms.Before animation starts, newly-built image scaling control its parent are set to WPF application program; Then 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, the position for screen according to default WPF forms, can determine the scope that image scaling control need show thus; WPF forms are played up to image and put into image scaling control; The predetermined WPF forms of reference position and end position according to the mouse click location after coordinate transformation and to(for) the position definition image scaling of screen; Define again animation time interval; Then open or close the animation effect of WPF forms, can eliminate while carrying out forms convergent-divergent animation, each forms change inconsistent phenomenon, improve user and experience and animation efficiency, improve resource utilization ratio.
Embodiment
For ease of understanding, set forth below in conjunction with accompanying drawing.
The present invention proposes the method for the multiple WPF forms of a kind of while convergent-divergent, please refer to Fig. 1, comprises step:
101, newly-built image scaling control;
Newly-built image scaling control, the parent of image scaling control is set to WPF application program.
102, obtain screen coordinate and be tied to the transformational relation of WPF application program coordinate;
Obtain 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 the concrete real-time mode of one, can adopt following steps:
Obtain cursor of mouse with respect to the coordinate of screen plane coordinate system and this cursor of mouse the coordinate with respect to WPF application program Main form plane coordinate system;
Using 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 mouse click location at screen coordinate system;
104, carry out coordinate conversion;
Mouse click location is changed according to the transformational relation in step 102 with respect to the position of screen plane coordinate system with respect to the coordinate of screen plane coordinate system, predetermined each WPF forms.
105, determine image scaling control indication range according to transformation result;
106, WPF forms are played up to image and put into image scaling control;
In the time that WPF forms are show state, these WPF forms are played up to image; And image is put into image scaling control.
107, the reference position of initialization control animation, end position and the time interval;
According to reference position and the end position of transformation result initialisation image convergent-divergent; And the animation time interval of initialisation image zoom control.
As the concrete real-time mode of one, can adopt following steps: in the time opening WPF forms, mouse click location after conversion is initialized as to the reference position of image scaling with respect to the coordinate of screen, the end position that is image scaling with respect to the position initialization of screen by the predetermined each WPF forms after changing;
In the time closing WPF forms, from transforming in predetermined each WPF forms position with respect to screen, obtain the horizontal ordinate nearest from WPF application program Main form plane coordinate system initial point and nearest ordinate, this nearest horizontal ordinate and nearest ordinate are initialized as to the reference position of image scaling, the mouse click location after conversion are initialized as to the end position of image scaling with respect to the coordinate of screen.
108,, according to reference position, end position, the time interval and indication range, carry out image scaling.
In the scope that need show at image scaling control according to the reference position of image scaling, end position and animation time interval, carry out image scaling.
The inventive method produces animation effect when making to open by image scaling control or closing WPF forms.Before animation starts, newly-built image scaling control its parent are set to WPF application program; Then 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, the position for screen according to default WPF forms, can determine the scope that image scaling control need show thus; WPF forms are played up to image and put into image scaling control; The predetermined WPF forms of reference position and end position according to the mouse click location after coordinate transformation and to(for) the position definition image scaling of screen; Define again animation time interval; Then open or close the animation effect of WPF forms, can eliminate while carrying out forms convergent-divergent animation, each forms change inconsistent phenomenon, improve user and experience and animation efficiency, improve resource utilization ratio.
Wherein, step 105 comprises:
From transforming in predetermined each WPF forms position with respect to screen, obtain from horizontal ordinate farthest of WPF application program Main form plane coordinate system initial point, nearest horizontal ordinate, ordinate farthest and nearest ordinate, deduct the width of the scope that the value of nearest horizontal ordinate need show as described image scaling control using horizontal ordinate farthest; Deduct the height of the scope that the value of nearest ordinate need show as described image scaling control using ordinate farthest.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 is farthest B, and ordinate is farthest H, nearest ordinate is G, hence one can see that, and on screen, the region of each WPF forms representative is shown in CDEF, the plane coordinate system that again scope of CDEF representative is converted to WPF application program Main form, is zoom control and needs indication range.
In order to make image scaling have better visual effect, carry out image scaling initialization in step 107 time, the transparency while also comprising initialization animation.While opening WPF forms, transparency from 0 to 1 gradual change is set; While closing WPF forms, transparency from 1 to 0 gradual change is set, wherein, 0 expression is completely transparent, and 1 expression is opaque.
While closing forms in order to eliminate, the screen flicker situation of appearance, can, carrying out before image scaling, arrange the time interval of hiding WPF forms, and the time interval of hiding WPF forms is less than animation time interval.
In order to eliminate in the time that animation starts, there is the situation of flicker in screen, can be opening before the image scaling of forms, and it is overseas that the WPF forms that need to play up image are arranged on screen display area.
In 106 steps, image can be put into image scaling control according to the sequencing of playing up, facilitate the demonstration of image scaling control.
Please refer to Fig. 2, the device of the multiple WPF forms of a kind of while convergent-divergent, comprising:
Control creating unit T1, for newly-built image scaling control, the parent of image scaling control is set to WPF application program;
The first acquiring unit T2, is transformed into WPF forms transformational relation with respect to the position of WPF application program Main form plane coordinate system by WPF forms with respect to the position of screen plane coordinate system for obtaining;
Second acquisition unit T3, for obtaining the coordinate of mouse click location with respect to screen;
Coordinate transformation unit T4, for changing mouse click location with respect to the position of screen with respect to the coordinate of screen, predetermined each WPF forms according to above-mentioned transformational relation;
Control displaying contents determining unit T5, for determining according to height and width after conversion the scope that image scaling control need show;
WPF forms rendering unit T6, for obtaining WPF forms state, in the time that WPF forms are show state, plays up image by these WPF forms; And image is put into image scaling control;
Initialization unit T7, for according to reference position and the end position of transformation result initialisation image convergent-divergent; And the animation time interval of initialisation image zoom control;
Image scaling unit T8, for carrying out image scaling in the scope that need show at image scaling control according to the reference position of image scaling, end position and animation time interval.
Apparatus of the present invention produce animation effect when making to open by image scaling control or closing WPF forms.Before animation starts, newly-built image scaling control its parent are set to WPF application program; Then 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, the position for screen according to default WPF forms, can determine the scope that image scaling control need show thus; WPF forms are played up to image and put into image scaling control; The predetermined WPF forms of reference position and end position according to the mouse click location after coordinate transformation and to(for) the position definition image scaling of screen; Define again animation time interval; Then open or close the animation effect of WPF forms, can eliminate while carrying out forms convergent-divergent animation, each forms change inconsistent phenomenon, improve user and experience and animation efficiency, improve 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 the coordinate with respect to WPF application program; Using 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 control displaying contents determining unit T5 determines indication range, from transforming in predetermined each WPF forms position with respect to screen, obtain from horizontal ordinate farthest of WPF application program Main form plane coordinate system initial point, nearest horizontal ordinate, ordinate farthest and nearest ordinate, deduct the width of the scope that the value of nearest horizontal ordinate need show as described image scaling control using horizontal ordinate farthest; Deduct the height of the scope that the value of nearest ordinate need show as described image scaling control using ordinate farthest;
When the reference position of initialization unit T7 initialisation image convergent-divergent and end position, if open WPF forms, the mouse click location after conversion is initialized as to the reference position of image scaling with respect to the coordinate of screen, the end position that is image scaling with respect to the position initialization of screen by the predetermined each WPF forms after changing; If close WPF forms, from transforming in predetermined each WPF forms position with respect to screen, obtain the horizontal ordinate nearest from WPF application program Main form plane coordinate system initial point and nearest ordinate, this nearest horizontal ordinate and nearest ordinate are initialized as to the reference position of image scaling, the mouse click location after conversion are initialized as to the end position of image scaling with respect to the coordinate of screen.
In order to make image scaling have better visual effect, when initialization unit T7 carries out image scaling initialization, the transparency while also comprising initialization animation.While opening WPF forms, transparency from 0 to 1 gradual change is set; While closing WPF forms, transparency from 1 to 0 gradual change is set, wherein, 0 expression is completely transparent, and 1 expression is opaque.
While closing forms in order to eliminate, the screen flicker situation of appearance, initialization unit T7 arranges the time interval of hiding WPF forms, and the time interval of hiding WPF forms is less than animation time interval.
In order to eliminate in the time that animation starts, there is the situation of flicker in screen, can be opening before the image scaling of forms, and it is overseas that the WPF forms that need to play up image are arranged on screen display area.
WPF forms rendering unit T6 can put into image scaling control according to the sequencing of playing up by image, facilitates the demonstration of image scaling control.
As the concrete real-time mode of one, (these forms are high can be different to open multiple WPF forms from WPF application program, width can be different), whole forms buttons are closed in click, image scaling control (for example ViewBox) comes across these above forms, then these WPF forms disappear, ViewBox starts animation, set high from start bit and widely dwindle gradually, transparency from 1 to 0 gradual change, the place (end position) that last indentation mouse is clicked,, there is not screen flicker in whole process animation smoothness.
Above embodiment of the present invention, does not form limiting the scope of the present invention.Any amendment of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in claim protection domain of the present invention.