473,783 Members | 2,317 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Odd last character in GetCharIndexFro mPosition() on DGV TBcell

Hi,

I am trying to get the inserting position of a string within a
DataGridViewTex tBoxCell in editing mode, based on the cursor point position
in selection mode.

I used the method GetCharIndexFro mPosition() in class
DataGridViewTex tBoxEditingCont rol.

It was found that the DataGridViewTex tBoxEditingCont rol.X has 3 pixel more
than what the function argument needs; the function argument needs a net
length while the X value in the class starts right from the edge of of the
cell. After deduction of 3, the function works fine for all the charters
except the last one: when the cursor in selection mode was in the left half
fo the font, the function returns the correct index so that the cursor in
editing mode will be set at the left side of the character. And vise versa.
However, for the last character, the editing cursor index would alway be set
to its left no matter which half of the font the selection cursor is on.

I tested the function in a TextBox control, it works the same way.

Is there anyway to get arround this problem.

Thanks in advance,
Li Qiu

P.S.
I posted this question in non managed MSDN forun for 3 days with no answer
yet. Please let me know if it is OK to do so.
http://forums.microsoft.com/MSDN/Sho...23700&SiteID=1
Jun 27 '08 #1
1 2433

Thanks to Rong-Chun Zhang who gave a solution on MSDN forum:
http://www.microsoft.com/communities...=en-us&m=1&p=1

"Li Qiu" wrote:
Hi,

I am trying to get the inserting position of a string within a
DataGridViewTex tBoxCell in editing mode, based on the cursor point position
in selection mode.

I used the method GetCharIndexFro mPosition() in class
DataGridViewTex tBoxEditingCont rol.

It was found that the DataGridViewTex tBoxEditingCont rol.X has 3 pixel more
than what the function argument needs; the function argument needs a net
length while the X value in the class starts right from the edge of of the
cell. After deduction of 3, the function works fine for all the charters
except the last one: when the cursor in selection mode was in the left half
fo the font, the function returns the correct index so that the cursor in
editing mode will be set at the left side of the character. And vise versa.
However, for the last character, the editing cursor index would alway be set
to its left no matter which half of the font the selection cursor is on.

I tested the function in a TextBox control, it works the same way.

Is there anyway to get arround this problem.

Thanks in advance,
Li Qiu

P.S.
I posted this question in non managed MSDN forun for 3 days with no answer
yet. Please let me know if it is OK to do so.
http://forums.microsoft.com/MSDN/Sho...23700&SiteID=1
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2932
by: josh dismukes | last post by:
/// here is the code i'm getting a parse error on the last line of the code which /// is </html> any help will be much appreciated. <?php session_start ();
4
10312
by: Charles Erwin | last post by:
Is there any way, upon scanning in a file line by line to avoid missing the last line if there is not a newline character (aka you have to hit return on the last line of input in your file). I was sure that there was a way around it but it escapes me if there is one. Thanks Charles Erwin
3
2009
by: yxq | last post by:
Hello, The XP Desktop clean wizard can get the last access time of desktop shortcut, i found that the info come from "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{75048700-EF1F-11D0-9888-006097DEACF9}\Count" The valuename and value are encrypted using ROT13, the function below can decrypt them *************************************************************
4
7401
by: Andyza | last post by:
I'm using FileSystemObject to open and write to a tab delimited text file. First, I connect to a database and select some data. Then I create the text file and insert each record in the text file. At the end of each record I insert a vbCrLf character in the text file to create a new line. Thus each record is in a new line. The problem is that I get a tab delimited text file where the LAST LINE in the text file is always a blank line....
2
15508
by: Sharkie | last post by:
I'm relatively new to XSLT, having strong background in bunch of other programming languages (Perl, Java, etc.). I'm writing an XSLT stylesheet, converting XML into HTML. Everything works just fine, except for one detail which I don't know how to handle. I have one element, which sometimes ends with a period, and sometimes not (the value of that element that is). In the output however, I need a period always. If I place a period inside...
6
18410
by: Daniel Mark | last post by:
Hello all: I have the following snippet: In : fileName = 'Perfect Setup.txt\n' In : fileName = fileName # remove the '\n' character In : fileName Out: 'Perfect Setup.txt'
9
16933
by: ice | last post by:
Hello, I have a couple of tables. The client tables and the contacted tables. I am not sure how to start on this, what I need is a way to query all my clients then show any client that the last visit and or called day is greater than 30 days. Now it gets confusing, Suppose the client was visited more than 30 days ago but was called only 10 days ago, I really would like to have this
4
7406
by: Rasputin | last post by:
Hello, The topic of this question is somewhat related to my previous question, but I wasn't sure if it diserved its own thread. In case of doubt... I double threated. If it's not OK let me know for next time. I am reading strings from a file to a vector, doing some "operations" on them, and then rewriting a new file. I noticed, after intense searching, than when there is a newline ("\n") at the end of the input file, the last...
5
15599
by: dudeja.rajat | last post by:
Sorry : Earlier mail had a typo in Subject line which might look in-appropriate to my friends Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this character set at their end,
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.