CN102193905A - Virtual text editing method and device based on GDI (graphics device interface)/GDI+ - Google Patents

Virtual text editing method and device based on GDI (graphics device interface)/GDI+ Download PDF

Info

Publication number
CN102193905A
CN102193905A CN2011101390237A CN201110139023A CN102193905A CN 102193905 A CN102193905 A CN 102193905A CN 2011101390237 A CN2011101390237 A CN 2011101390237A CN 201110139023 A CN201110139023 A CN 201110139023A CN 102193905 A CN102193905 A CN 102193905A
Authority
CN
China
Prior art keywords
gdi
text object
text
mouse
editing mode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2011101390237A
Other languages
Chinese (zh)
Inventor
尹显用
胡建华
黄宝华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vtron Technologies Ltd
Original Assignee
Vtron Technologies Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vtron Technologies Ltd filed Critical Vtron Technologies Ltd
Priority to CN2011101390237A priority Critical patent/CN102193905A/en
Publication of CN102193905A publication Critical patent/CN102193905A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • User Interface Of Digital Computer (AREA)

Abstract

The invention provides a virtual text editing method and device based on GDI(graphics device interface)/GDI+, and the method comprises the following steps of: creating a text object of GDI/GDI+; creating mouse response events of the text object to be in one-to-one correspondence to mouse events of a system; creating an editing state of the text object and judging whether to enter the editing state according to the mouse response events; and if so, creating keyboard response events of the text object to be in one-to-one correspondence to keyboard events of the system, and waiting for accepting input information of the keyboard. The text editing can be performed on the GDI/GDI+ without any extra text input window by using the method and the device; and the complex computation and character deviation can be avoided, the resource consumption caused by additionally opening a window and adding a control can be avoided, the intuitiveness of the GDI/GDI+ editing text is effectively increased, and the system performance is improved.

Description

Virtual text edit methods and device based on GDI/GDI+
Technical field
The present invention relates to the word processing technical field, relate in particular to a kind of based on virtual text edit methods and device on the GDI/GDI+.
Background technology
Universal day by day along with computer utility, great variety is also taking place in the use-pattern of computing machine, and text editing is exactly one of them very important aspect.
Word processing is an important content in the multimedia technology, normally carries out the processing of literal and figure in the Windows system based on the GDI/GDI+ of Microsoft.The main task of GDI (Graphics Device Interface, Graphics Device Interface) is the message exchange of being responsible between system and the plotter program, handles the figure output of all Windows programs.Utilize numerous functions that GDI provides output pattern, text etc. on screen, printer and other output device easily, the appearance of GDI makes the programmer not need to be concerned about hardware device and device drives, just the output of application program can be converted into the output on the hardware device, realized the isolation of program developer and hardware device, greatly facilitate development, therefore obtain the favor of program developer and application widely.
Though GDI/GDI+ brings great convenience to program developer when the process user output interface, it is also very powerful that function is gone up in the processing of literal output, and GDI/GDI+ also exists some shortcomings in that power and while easily are provided.In display text, can not carry out the text editing of basic GDI/GDI+ as GDI/GDI+ in demonstration place, want to increase or the deletion literal, must be by an extra text input window mouth, and use extra text input window mouth not only will consume extra resource, and the literal drawn of editor's literal and GDI/GDI+ is very difficult is mapped one by one completely, is easy to generate the character relative deviation.
Summary of the invention
For addressing the above problem, the invention provides a kind of virtual text edit methods and device based on GDI/GDI+, not needing can be this editor of the enterprising style of writing of GDI/GDI+ by extra text input window mouth.
A kind of virtual text edit methods based on GDI/GDI+ may further comprise the steps:
Create the text object of a GDI/GDI+;
Create the mouse response events of described text object, make its mouse event corresponding one by one with system;
Create the editing mode of described text object, and judge whether to enter this editing mode according to described mouse response events;
If enter editing mode, then create the keyboard response incident of described text object, make its KeyEvent corresponding one by one, and wait for the input information of accepting keyboard with system.
A kind of virtual text editing device based on GDI/GDI+ comprises:
The text object creation module is used to create the text object of a GDI/GDI+;
With the mouse event creation module that described text object creation module is connected, be used to create the mouse response events of described text object, make its mouse event corresponding one by one with system;
With the editing mode creation module that described mouse event creation module is connected, be used to create the editing mode of described text object, and judge whether to enter this editing mode according to described mouse response events;
KeyEvent creation module with described editing mode creation module is connected is used for when entering editing mode, creates the keyboard response incident of described text object, makes its KeyEvent with system corresponding one by one, and waits for the input information of accepting keyboard.
From above scheme as can be seen, virtual text edit methods and device based on GDI/GDI+ of the present invention, owing to remedied the directly shortcoming of Edit Text of GDI/GDI+, can not need can be this editor of the enterprising style of writing of GDI/GDI+ by extra text input window mouth, the complicated calculations of having been brought when having avoided using additive method to realize the object of the invention and the problem of character deviation, also avoided because extra going opened up a window and added the resource consumption that control produced, effectively increase the intuitive of GDI/GDI+ Edit Text, improved system performance.
Description of drawings
Fig. 1 is the process flow diagram that the present invention is based on the virtual text edit methods of GDI/GDI+;
The text object effect synoptic diagram that Fig. 2 is created for application method of the present invention;
Fig. 3 is the structural representation that the present invention is based on the virtual text editing device of GDI/GDI+.
Embodiment
The invention provides a kind of virtual text edit methods and device, can solve GDI/GDI+ in the prior art and in display text, can not carry out the text editing of basic GDI/GDI+, the problem that need can carry out text editing by an extra text input window eloquence in demonstration place based on GDI/GDI+.
For achieving the above object, the invention provides a kind of virtual text edit methods, as shown in Figure 1, may further comprise the steps based on GDI/GDI+:
Step S1, the text object of a GDI/GDI+ of establishment.The text object of being created can be referring to Fig. 2.
In addition, as an embodiment preferably, create the text object of a GDI/GDI+ at step S1 after, can also comprise step S11: coordinate and big or small Text (x, y, the w of the text object that record is created, and determine the effective range of described text object according to described coordinate and size h).
Step S2 creates the mouse response events of described text object, makes its mouse event with system corresponding one by one.This step can comprise following little step again further:
1), obtain system's mouse event, and the coordinate position p that on screen, moves of record mouse (x, y);
2), use mouse coordinates p value and text object coordinate and size to compare, judge that whether the p value drops in the effective range of text object, can adopt following statement: Text.x<=x<=Text.x+Text.w﹠amp; ﹠amp; Text.y<=y<=Text.y+Text.h.If the p value satisfies above-mentioned formula, mouse then is described in the effective range of text object, and remembers that the effective status bFlag of mouse on text object is True, otherwise be non-effective status False;
3), in the effective range of mouse at text object, when pressing left button and not having UP (relieving), text object response mouse moving incident;
4), in the effective range of mouse at text object, when double-clicking left mouse button, the left button of text object response mouse is double-clicked incident;
5), in the effective range of mouse at text object, during a mouse click left button, the left button click event of text object response mouse;
6), in the effective range of mouse at text object, during a mouse click right button, the right-click incident of text object response mouse.
Need to prove that the state of text object is non-editing mode by default setting.
Step S3 creates the editing mode of described text object, so that the text editing of basic GDI/GDI+ to be provided, and judges whether that according to the mouse response events among the step S2 needs enter editing mode.Above-mentioned deterministic process specifically can comprise as follows: when mouse coordinates is positioned at the effective range of text object and the left button double-click incident of mouse takes place, enter editing mode, otherwise entering non-editing mode, is the text editing that GDI/GDI+ can not be provided under non-editing mode.
Further, step S3 can comprise following little step:
1), in the effective range of mouse at text object, and responded left mouse button and double-clicked incident, make when text object is in editing mode, system is according to the coordinate and the size of text object, around the object frame, draw angle and be approximately the 20-70 degree, highly be about 10-30 pixel, be about the oblique line section (see figure 2) of 3-10 pixel at interval, and write down the coordinate figure of all oblique line sections;
2) if text object is in editing mode, then about 5-20 pixel place vertical width of drafting is 1-2 pixel in the text object frame, highly be the cursor of 5-20 pixel, the big or small corresponding or equal (see figure 2) of font in the height of cursor and the described text object.
The drafting of cursor specifically can comprise three following steps:
I), open up the worker thread of a cursor, the demonstration that worker thread is mainly used to control the cursor straight line with hide.
The rendering algorithm of cursor ii), is set:
A, a definition time value nTime=1000 (an about second), State Control variable nFlag=0, a cycle counter nCount=0;
B, cursor drawing thread of startup;
C, in worker thread the operation loop statement (as while statement), and whether the size of judging the State Control variable equals 0, if equal just to begin to draw the loop statement of cursor straight line at 0 o'clock, cycle calculations device nCount begins to increase progressively simultaneously, when being recycled to nCount=nTime, nFlag=1 draws the cursor Statement Completion;
D, begin to hide the loop statement of cursor straight line when nFlag equals 1, nCount begins to successively decrease, nFlag=0 when being decremented to nCount=0, the statement operation that finishes to hide the cursor straight line;
The operation of E, repetition C, D reaches the effect that a cursor flashes like this.
Iii), the position of positioning cursor:
Word space between A, the default setting text object Chinese words is 2 pixels, and cursor just is plotted in left side or right then 1 the pixel place on next door of being close to word; The line space of default setting word is 10 pixels in addition, calculates the width and the height of word in the text object according to font size;
Line position in B, the localization of text, the point of the coordinate of under the text object editing mode, clicking according to mouse, again according to the height and the line space of word, calculating cursor should be in that delegation, when being the terminal point coordinate of the capable origin coordinates of cursor coordinates<=y+ word height+row height<=row, just the row-coordinate rx of cursor is decided;
Row coordinate position in C, the localization of text, the point of the coordinate of under the text object editing mode, clicking according to mouse, again according to the width and the word space of word, calculating cursor should be in that and list, be the origin coordinates<=x+ word of cursor coordinates row wide+during the terminal point coordinate of word space<=row, just the row coordinate cy of cursor is decided;
D, with row, column coordinate rx, cy passes to cursor drawing thread, locatees and draws out the position at cursor place and show.
Step S4 if need enter editing mode through judging, then creates the keyboard response incident of described text object, makes its KeyEvent with system corresponding one by one, and waits for the input information of accepting keyboard.
Above-mentioned establishment keyboard response incident specifically can comprise the steps:
1), be under the editing mode when judging text object, the message mechanism by the Windows system obtains the keyboard input character, responding system keyboard incoming event;
2), obtain the character of keyboard input, according to the position at current cursor place, the character of being keyed in is inserted into the character position at cursor place;
3), judge whether the character of input is the space, if just space character is inserted into the character position at cursor place;
4), judge whether keypad information is enter key, if just the enter key symbol is inserted into the character position at cursor place;
5), judge whether keypad information is backspace key, from text object if just the previous character of cursor is deleted;
6), judge whether keypad information is the left and right directions key, if just cursor is moved forward or backward the position of a character duration, and recording light target current location;
7), judge whether keypad information is up and down arrow keys, if just cursor is moved up or down the width position of delegation's line space, and recording light target current location.
Under editing mode and after having created the keyboard response incident of described text object, just can directly accept the input information of keyboard, that is to say that GDI/GDI+ can not need just can directly carry out text editing by extra text input window mouth.
In addition, when under editing mode, mouse moves to outside the text object effective range in the text object effective range, and when the left button click event of mouse took place, the effective status of text object just became False so, enters non-editing mode this moment.Under non-editing mode, the worker thread of text object finishes, and no longer the outer oblique line of rendered object frame is no longer drawn cursor line simultaneously.
Corresponding with a kind of virtual text edit methods based on GDI/GDI+ of the present invention, the present invention also provides a kind of virtual text editing device based on GDI/GDI+, as shown in Figure 3, comprising:
The text object creation module is used to create the text object of a GDI/GDI+;
With the mouse event creation module that described text object creation module is connected, be used to create the mouse response events of described text object, make its mouse event corresponding one by one with system;
With the editing mode creation module that described mouse event creation module is connected, be used to create the editing mode of described text object, and judge whether to enter this editing mode according to described mouse response events;
KeyEvent creation module with described editing mode creation module is connected is used for when entering editing mode, creates the keyboard response incident of described text object, makes its KeyEvent with system corresponding one by one, and waits for the input information of accepting keyboard.
Preferably, described text object creation module can also be used for behind the text object of creating a GDI/GDI+, the coordinate and the size of record text object, and according to described coordinate and the big or small effective range of determining described text object.
In addition, device of the present invention can also comprise the state exchange module, described state exchange module is used to enter after the editing mode, outside judging the effective range that mouse moves to text object and when the left button click event of mouse takes place, enters non-editing mode.
Preferably, can comprise judge module in the described editing mode creation module, described judge module is used for entering editing mode, otherwise entering non-editing mode when judging left button that mouse coordinates is positioned at the effective range of text object and mouse takes place and double-click incident.
In addition, described editing mode creation module can also comprise oblique line section drafting module and cursor drafting module;
Described oblique line section drafting module is used for coordinate and the size according to described text object, draws the oblique line section around described text object frame, and writes down the coordinate figure of all oblique line sections; And
Described cursor drafting module is used for drawing a cursor in described text object, the height of described cursor is big or small corresponding or equal with the interior font of described text object.
By above scheme as can be seen, virtual text edit methods and device based on GDI/GDI+ of the present invention, do not need just can on GDI/GDI+, realize text editing by extra text input window mouth, remedied the directly shortcoming of Edit Text of GDI/GDI+, the complicated calculations of having been brought when having avoided using additive method to realize the object of the invention and in the problem of the wide character deviation that produces when high of calculating character, also avoided because extra going opened up a window and added the resource consumption that control produced, effectively increased the intuitive of GDI/GDI+ Edit Text, accuracy when having strengthened text display and editor has improved system performance.
Above-described embodiment of the present invention does not constitute the qualification to protection domain of the present invention.Any modification of being done within the spirit and principles in the present invention, be equal to and replace and improvement etc., all should be included within the claim protection domain of the present invention.

Claims (10)

1. the virtual text edit methods based on GDI/GDI+ is characterized in that, may further comprise the steps:
Create the text object of a GDI/GDI+;
Create the mouse response events of described text object, make its mouse event corresponding one by one with system;
Create the editing mode of described text object, and judge whether to enter this editing mode according to described mouse response events;
If enter editing mode, then create the keyboard response incident of described text object, make its KeyEvent corresponding one by one, and wait for the input information of accepting keyboard with system.
2. the virtual text edit methods based on GDI/GDI+ according to claim 1, it is characterized in that, behind the text object of a GDI/GDI+ of described establishment, the coordinate and the size of record text object, and according to described coordinate and the big or small effective range of determining described text object.
3. the virtual text edit methods based on GDI/GDI+ according to claim 2, it is characterized in that, describedly judge whether that according to described mouse response events the process that enters editing mode specifically comprises: when the left button that is positioned at the effective range of text object and mouse takes place when mouse coordinates is double-clicked incident, enter editing mode, otherwise enter non-editing mode.
4. the virtual text edit methods based on GDI/GDI+ according to claim 2, it is characterized in that, described enter after the editing mode further comprising the steps of: when mouse moves to the left button click event of the outer and generation mouse of the effective range of text object, enter non-editing mode.
5. according to claim 3 or 4 described virtual text edit methods, it is characterized in that described text object is defaulted as non-editing mode based on GDI/GDI+.
6. the virtual text edit methods based on GDI/GDI+ according to claim 2 is characterized in that, the process of the editing mode of the described text object of described establishment specifically comprises:
According to the coordinate and the size of described text object, around described text object frame, draw the oblique line section, write down the coordinate figure of all oblique line sections; And
Draw a cursor in described text object, the height of described cursor is big or small corresponding or equal with the interior font of described text object.
7. the virtual text editing device based on GDI/GDI+ is characterized in that, comprising:
The text object creation module is used to create the text object of a GDI/GDI+;
With the mouse event creation module that described text object creation module is connected, be used to create the mouse response events of described text object, make its mouse event corresponding one by one with system;
With the editing mode creation module that described mouse event creation module is connected, be used to create the editing mode of described text object, and judge whether to enter this editing mode according to described mouse response events;
KeyEvent creation module with described editing mode creation module is connected is used for when entering editing mode, creates the keyboard response incident of described text object, makes its KeyEvent with system corresponding one by one, and waits for the input information of accepting keyboard.
8. the virtual text editing device based on GDI/GDI+ according to claim 7, it is characterized in that, described text object creation module also is used for behind the text object of creating a GDI/GDI+, the coordinate and the size of record text object, and according to described coordinate and the big or small effective range of determining described text object.
9. the virtual text editing device based on GDI/GDI+ according to claim 8 is characterized in that:
Also comprise the state exchange module, described state exchange module is used to enter after the editing mode, outside judging the effective range that mouse moves to text object and when the left button click event of mouse takes place, enters non-editing mode;
And/or
Comprise judge module in the described editing mode creation module, described judge module is used for entering editing mode, otherwise entering non-editing mode when judging left button that mouse coordinates is positioned at the effective range of text object and mouse takes place and double-click incident.
10. the virtual text editing device based on GDI/GDI+ according to claim 8 is characterized in that described editing mode creation module comprises oblique line section drafting module and cursor drafting module;
Described oblique line section drafting module is used for coordinate and the size according to described text object, draws the oblique line section around described text object frame, writes down the coordinate figure of all oblique line sections;
Described cursor drafting module is used for drawing a cursor in described text object, the height of described cursor is big or small corresponding or equal with the interior font of described text object.
CN2011101390237A 2011-05-26 2011-05-26 Virtual text editing method and device based on GDI (graphics device interface)/GDI+ Pending CN102193905A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011101390237A CN102193905A (en) 2011-05-26 2011-05-26 Virtual text editing method and device based on GDI (graphics device interface)/GDI+

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011101390237A CN102193905A (en) 2011-05-26 2011-05-26 Virtual text editing method and device based on GDI (graphics device interface)/GDI+

Publications (1)

Publication Number Publication Date
CN102193905A true CN102193905A (en) 2011-09-21

Family

ID=44601989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011101390237A Pending CN102193905A (en) 2011-05-26 2011-05-26 Virtual text editing method and device based on GDI (graphics device interface)/GDI+

Country Status (1)

Country Link
CN (1) CN102193905A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104035701A (en) * 2013-03-06 2014-09-10 夏普株式会社 Method, device and electronic equipment for compiling object on touch screen of electronic equipment
CN104252309A (en) * 2013-06-29 2014-12-31 北京新媒传信科技有限公司 Method and system for realizing text editing in intelligent terminal
CN104731445A (en) * 2013-12-24 2015-06-24 惠州市德赛西威汽车电子有限公司 Method for displaying long texts
CN107832274A (en) * 2017-11-22 2018-03-23 广州慧睿思通信息科技有限公司 A kind of reproducible text control implementation method highlighted
WO2019242274A1 (en) * 2018-06-22 2019-12-26 北京搜狗科技发展有限公司 Content processing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1684061A (en) * 2004-04-16 2005-10-19 佳能株式会社 Document processing apparatus and control method therefor
WO2006096139A1 (en) * 2005-03-10 2006-09-14 National University Of Singapore An authoring tool and method for creating an electronic document
CN101324844A (en) * 2008-07-10 2008-12-17 电子科技大学 Method for making rich text control with intelligent apperception

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1684061A (en) * 2004-04-16 2005-10-19 佳能株式会社 Document processing apparatus and control method therefor
WO2006096139A1 (en) * 2005-03-10 2006-09-14 National University Of Singapore An authoring tool and method for creating an electronic document
CN101324844A (en) * 2008-07-10 2008-12-17 电子科技大学 Method for making rich text control with intelligent apperception

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
詹瑾瑜,熊光泽,孙明: "一种嵌入式GUI软件结构实现方案", 《电子科技大学学报》 *
马现峰,李国和,赵磊: "基于VC的图形标识工具GLSTool设计与实现", 《计算机应用》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104035701A (en) * 2013-03-06 2014-09-10 夏普株式会社 Method, device and electronic equipment for compiling object on touch screen of electronic equipment
CN104252309A (en) * 2013-06-29 2014-12-31 北京新媒传信科技有限公司 Method and system for realizing text editing in intelligent terminal
CN104252309B (en) * 2013-06-29 2017-08-04 北京新媒传信科技有限公司 A kind of method and system for realizing intelligent terminal Chinese version editor
CN104731445A (en) * 2013-12-24 2015-06-24 惠州市德赛西威汽车电子有限公司 Method for displaying long texts
CN104731445B (en) * 2013-12-24 2018-11-30 惠州市德赛西威汽车电子股份有限公司 A kind of long text display methods
CN107832274A (en) * 2017-11-22 2018-03-23 广州慧睿思通信息科技有限公司 A kind of reproducible text control implementation method highlighted
WO2019242274A1 (en) * 2018-06-22 2019-12-26 北京搜狗科技发展有限公司 Content processing method and device

Similar Documents

Publication Publication Date Title
US9152529B2 (en) Systems and methods for dynamically altering a user interface based on user interface actions
CN105807966B (en) Method and device for acquiring touch screen event
CN105807967B (en) Writing method and device of electronic whiteboard
CN108874275B (en) Handwriting erasing method, handwriting erasing device, terminal and computer-readable storage medium
CN107193476B (en) Information input method and device, computer equipment and readable medium
WO2018107747A1 (en) Multi-screen labelling method and splicing wall
US20130132878A1 (en) Touch enabled device drop zone
US9612697B2 (en) Touch control method of capacitive and electromagnetic dual-mode touch screen and handheld electronic device
CN102193905A (en) Virtual text editing method and device based on GDI (graphics device interface)/GDI+
CN101882007A (en) Method and device for carrying out information input and execution based on input interface
WO2013149403A1 (en) Text select and enter
CN103226434B (en) A kind of method that menu information is shown and device
US9727535B2 (en) Authoring presentations with ink
CN111770368A (en) Control method and device for large-screen display equipment, storage medium and electronic equipment
WO2021258917A1 (en) Intelligent interaction method and device, and storage medium
WO2018112856A1 (en) Location positioning method and device based on voice control, user equipment, and computer program product
CN104216646A (en) Method and device for creating application program based on gesture
CN104281398A (en) Touch keyboard key variable method and terminal
WO2012006916A1 (en) Method and system for implemanting handwriting input on web page
CN104626165A (en) Demonstrator key reaction sensitivity optimization method
CN112580312A (en) Screen-casting content annotation method, device and system and computer-readable storage medium
CN103616973B (en) The operating method and touch panel device of a kind of touch-screen
Hudson et al. Extensible input handling in the subArctic toolkit
Dixon et al. Pixel-based methods for widget state and style in a runtime implementation of sliding widgets
CN117057318A (en) Domain model generation method, device, equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20110921