473,769 Members | 5,885 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 2431

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
2931
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
10310
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
15501
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
18409
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
16932
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
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
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...
0
9863
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
8872
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
6673
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
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3959
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
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.