Click here to Skip to main content
15,904,024 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Tracing SQL generated by DataAdapter.Update(dataset) Pin
Jean-Louis Leroy4-Apr-11 21:30
Jean-Louis Leroy4-Apr-11 21:30 
GeneralRe: Tracing SQL generated by DataAdapter.Update(dataset) Pin
PIEBALDconsult5-Apr-11 3:08
mvePIEBALDconsult5-Apr-11 3:08 
QuestionHighlight only Searched keywords in a Datagrid Pin
Defender-NF31-Mar-11 0:24
Defender-NF31-Mar-11 0:24 
AnswerRe: Highlight only Searched keywords in a Datagrid Pin
Dave Kreskowiak31-Mar-11 3:48
mveDave Kreskowiak31-Mar-11 3:48 
GeneralRe: Highlight only Searched keywords in a Datagrid Pin
Defender-NF31-Mar-11 3:54
Defender-NF31-Mar-11 3:54 
GeneralRe: Highlight only Searched keywords in a Datagrid Pin
Dave Kreskowiak31-Mar-11 6:11
mveDave Kreskowiak31-Mar-11 6:11 
GeneralRe: Highlight only Searched keywords in a Datagrid Pin
Defender-NF31-Mar-11 6:18
Defender-NF31-Mar-11 6:18 
AnswerRe: Highlight only Searched keywords in a Datagrid Pin
Luc Pattyn31-Mar-11 7:28
sitebuilderLuc Pattyn31-Mar-11 7:28 
There are two possibilities:

1.
you use a non-proportional or monospaced font such as Courier New or Consolas; then you can simply count the number of characters, multiply that with an appropriate factor (not an integer!), and use that to calculate your starting and ending positions. The factor depends on font size and more. Either experiment or use #2. (What I do in simple situations is call Graphics.MeasureString once on a string of length 100, then store one hundredth of that as a permanent factor using a float).

2.
you use any font you like; with Graphics.MeasureString() you can obtain the width a string will require when going to be painted using Graphics.DrawString() provided you give corresponding parameters; warning: it could be off by a few pixels due to some internal anomalies.

If it sounds complex, that is because it is.

BTW: there are some good articles that include this subject here at CodeProject, including a recent one; look for things such as "syntax color", "syntax highlight", "TextBox".

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: Highlight only Searched keywords in a Datagrid Pin
Dave Kreskowiak31-Mar-11 10:06
mveDave Kreskowiak31-Mar-11 10:06 
QuestionDataView.Select Syntax Pin
Defender-NF30-Mar-11 8:43
Defender-NF30-Mar-11 8:43 
AnswerRe: DataView.Select Syntax Pin
Pete O'Hanlon30-Mar-11 9:05
mvePete O'Hanlon30-Mar-11 9:05 
GeneralRe: DataView.Select Syntax Pin
Defender-NF30-Mar-11 10:12
Defender-NF30-Mar-11 10:12 
AnswerRe: DataView.Select Syntax Pin
Prasanta_Prince14-Apr-11 0:15
Prasanta_Prince14-Apr-11 0:15 
QuestionSimilar property in WPF Control.AccessibleRole Pin
Pranit Kothari29-Mar-11 23:42
Pranit Kothari29-Mar-11 23:42 
AnswerRe: Similar property in WPF Control.AccessibleRole Pin
Pete O'Hanlon30-Mar-11 0:08
mvePete O'Hanlon30-Mar-11 0:08 
QuestionNeed to kill thread when application is closed Pin
Amit Sk Sharma29-Mar-11 0:40
Amit Sk Sharma29-Mar-11 0:40 
AnswerRe: Need to kill thread when application is closed Pin
Eddy Vluggen29-Mar-11 0:49
professionalEddy Vluggen29-Mar-11 0:49 
GeneralRe: Need to kill thread when application is closed Pin
Amit Sk Sharma29-Mar-11 2:12
Amit Sk Sharma29-Mar-11 2:12 
GeneralRe: Need to kill thread when application is closed Pin
Eddy Vluggen29-Mar-11 8:54
professionalEddy Vluggen29-Mar-11 8:54 
AnswerRe: Need to kill thread when application is closed Pin
Luc Pattyn29-Mar-11 1:10
sitebuilderLuc Pattyn29-Mar-11 1:10 
GeneralRe: Need to kill thread when application is closed Pin
Amit Sk Sharma29-Mar-11 2:22
Amit Sk Sharma29-Mar-11 2:22 
GeneralRe: Need to kill thread when application is closed Pin
Luc Pattyn29-Mar-11 2:24
sitebuilderLuc Pattyn29-Mar-11 2:24 
QuestionLoad Report Failed is coming if i run Windows application exe in Windows 7 OS but it is working fine in Windows XP [modified] Pin
sr15928-Mar-11 23:17
sr15928-Mar-11 23:17 
AnswerRe: Load Report Failed is coming in Windows application in Windows 7 OS but it is working fine in Windows XP Pin
Dave Kreskowiak29-Mar-11 2:00
mveDave Kreskowiak29-Mar-11 2:00 
GeneralRe: Load Report Failed is coming in Windows application in Windows 7 OS but it is working fine in Windows XP Pin
sr15929-Mar-11 2:47
sr15929-Mar-11 2:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.