Click here to Skip to main content
15,909,645 members
Home / Discussions / C#
   

C#

 
AnswerRe: Saving datasets back to db problem Pin
rafiki27023-Jan-07 3:26
rafiki27023-Jan-07 3:26 
AnswerRe: Saving datasets back to db problem Pin
PIEBALDconsult23-Jan-07 3:46
mvePIEBALDconsult23-Jan-07 3:46 
GeneralRe: Saving datasets back to db problem Pin
rafiki27023-Jan-07 4:26
rafiki27023-Jan-07 4:26 
QuestionProject Mono, do you like it? Pin
TrooperIronMan22-Jan-07 23:57
TrooperIronMan22-Jan-07 23:57 
QuestionRegistry problem Pin
CodeItWell22-Jan-07 23:21
CodeItWell22-Jan-07 23:21 
AnswerRe: Registry problem Pin
Parwej Ahamad22-Jan-07 23:48
professionalParwej Ahamad22-Jan-07 23:48 
AnswerRe: Registry problem Pin
Syed Muhammad Kamran23-Jan-07 1:11
Syed Muhammad Kamran23-Jan-07 1:11 
QuestionHighlight spesific word on Datagridview Pin
Houw22-Jan-07 23:19
Houw22-Jan-07 23:19 
Hi all,

I'm trying to highlight spesific word inside a cell on any cell within a datagridviewcontrol, to do this i have write a special code inside OnCellPaint method


string v = e.FormattedValue.ToString().ToLower();
int idx = v.IndexOf(searchWord.ToLower());
if (idx != -1)
{
System.Drawing.Font ff = e.CellStyle.Font;
// get a length word before searchWord/highlightWord
int addx = e.Graphics.MeasureString(e.FormattedValue.ToString().Substring(0, idx), ff).ToSize().Width;

// get a length searchWord
int w = e.Graphics.MeasureString(e.FormattedValue.ToString().Substring(idx, searchWord.Length), ff).ToSize().Width;

// draw highlight background
Brush br2 = new SolidBrush(blockColor);
e.Graphics.FillRectangle(br2, new Rectangle(e.CellBounds.X + addx, e.CellBounds.Y + 1, w, e.CellBounds.Height - 3));


homever measurestring didn't return correct size from current cell text, therefore highlighted background didn't placed on right position. This code also doesn't work on cell with currency formatted cell because currency cell is rightalignment. My question is how do i get correct size in pixel from current cell text using measurestring ? Because measurestring combined with e.cellstyle.font didn't return correct size.


AnswerRe: Highlight spesific word on Datagridview Pin
Mircea Puiu23-Jan-07 3:44
Mircea Puiu23-Jan-07 3:44 
Questionwana buit an email clinet using a third party email server?? Pin
Saira Tanwir22-Jan-07 23:12
Saira Tanwir22-Jan-07 23:12 
GeneralRe: wana buit an email clinet using a third party email server?? Pin
Guffa23-Jan-07 0:05
Guffa23-Jan-07 0:05 
Questionvalidating multiple email addresses separated by comma Pin
babutkchn22-Jan-07 23:10
babutkchn22-Jan-07 23:10 
AnswerRe: validating multiple email addresses separated by comma Pin
Guffa23-Jan-07 0:13
Guffa23-Jan-07 0:13 
QuestionHow to add a watermark to an image Pin
gauthee22-Jan-07 23:01
gauthee22-Jan-07 23:01 
AnswerRe: How to add a watermark to an image Pin
Christian Graus22-Jan-07 23:02
protectorChristian Graus22-Jan-07 23:02 
AnswerRe: How to add a watermark to an image Pin
bobsugar22223-Jan-07 0:36
bobsugar22223-Jan-07 0:36 
GeneralRe: How to add a watermark to an image Pin
gauthee23-Jan-07 1:09
gauthee23-Jan-07 1:09 
GeneralRe: How to add a watermark to an image Pin
gauthee23-Jan-07 1:45
gauthee23-Jan-07 1:45 
GeneralRe: How to add a watermark to an image [modified] Pin
bobsugar22223-Jan-07 3:04
bobsugar22223-Jan-07 3:04 
Questionlistview custom control Pin
biswabhusan22-Jan-07 23:00
biswabhusan22-Jan-07 23:00 
AnswerRe: listview custom control Pin
aamironline24-Jan-07 15:27
aamironline24-Jan-07 15:27 
Generallink (oop c#) Pin
biswabhusan22-Jan-07 22:59
biswabhusan22-Jan-07 22:59 
GeneralRe: link (oop c#) Pin
Christian Graus22-Jan-07 23:03
protectorChristian Graus22-Jan-07 23:03 
GeneralRe: link (oop c#) Pin
Tamimi - Code23-Jan-07 1:31
Tamimi - Code23-Jan-07 1:31 
QuestionListview control with checkbox Pin
biswabhusan22-Jan-07 22:57
biswabhusan22-Jan-07 22:57 

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.