Click here to Skip to main content
15,894,646 members
Home / Discussions / C#
   

C#

 
GeneralRe: conversion to pdf Pin
John Kuhn4-Feb-04 19:37
John Kuhn4-Feb-04 19:37 
GeneralRe: conversion to pdf Pin
mohdshiraz4-Feb-04 19:46
mohdshiraz4-Feb-04 19:46 
GeneralRe: conversion to pdf Pin
John Kuhn4-Feb-04 19:56
John Kuhn4-Feb-04 19:56 
GeneralRe: conversion to pdf Pin
Gerald Leslie Jones4-Feb-04 20:05
Gerald Leslie Jones4-Feb-04 20:05 
GeneralRe: conversion to pdf Pin
Heath Stewart5-Feb-04 4:45
protectorHeath Stewart5-Feb-04 4:45 
GeneralRe: conversion to pdf Pin
mohdshiraz5-Feb-04 0:43
mohdshiraz5-Feb-04 0:43 
GeneralWhat's Wrong Pin
Inam4-Feb-04 17:58
Inam4-Feb-04 17:58 
Generalno instantiate Pin
rod termaat4-Feb-04 17:24
rod termaat4-Feb-04 17:24 
GeneralRe: no instantiate Pin
Tom Clement4-Feb-04 17:39
professionalTom Clement4-Feb-04 17:39 
GeneralRe: no instantiate Pin
Not Active4-Feb-04 18:09
mentorNot Active4-Feb-04 18:09 
GeneralRe: no instantiate Pin
boogs5-Feb-04 2:48
boogs5-Feb-04 2:48 
GeneralRe: no instantiate Pin
Heath Stewart5-Feb-04 4:42
protectorHeath Stewart5-Feb-04 4:42 
QuestionRichTextBox has a bug? Pin
Zembaliti4-Feb-04 14:56
Zembaliti4-Feb-04 14:56 
AnswerRe: RichTextBox has a bug? Pin
Nick Parker4-Feb-04 16:50
protectorNick Parker4-Feb-04 16:50 
GeneralRe: RichTextBox has a bug? Pin
Tom Clement4-Feb-04 17:07
professionalTom Clement4-Feb-04 17:07 
GeneralRe: RichTextBox has a bug? Pin
Zembaliti5-Feb-04 16:03
Zembaliti5-Feb-04 16:03 
GeneralRe: RichTextBox has a bug? Pin
Tom Clement5-Feb-04 16:17
professionalTom Clement5-Feb-04 16:17 
Good question. I don't have time to investigate it now, but because you can't be sure of which RichTextBox control you will be working with on the client machine (e.g. Riched32.dll or Riched20.dll), I still recommend that you derive a new control from RichTextBox and override the problem methods. You could do something like this:
public override string Text
{
get{
return API.GetRichTextText(this.Handle);
}
set {
base.Text = value;
}
}

where you define API.GetRichTextText() as:

public static string GetRichTextText(IntPtr hwndRichTextControl)
{
GETTEXTEX lpGETTEXTEX = new GETTEXTEX();

// * 2 For double byte
lpGETTEXTEX.cb = (GetTextLength(hwndRichTextControl) + 1) * 2;
lpGETTEXTEX.flags = 0; // For default.
lpGETTEXTEX.codepage = 1200; // Unicode.
StringBuilder sText = new StringBuilder(lpGETTEXTEX.cb);
SendMessage(hwndRichTextControl, EM_GETTEXTEX, ref lpGETTEXTEX, sText);
return sText.ToString();
}

and

[StructLayout(LayoutKind.Sequential)]
public struct GETTEXTEX
{
public Int32 cb;
public Int32 flags;
public Int32 codepage;
public IntPtr lpDefaultChar;
public IntPtr lpUsedDefChar;
}
private const int WM_USER = 0x400;
private const int EM_GETTEXTEX = WM_USER + 94;

You can do something similar for TextLength, or just get the text and measure it.

Tom Clement
Apptero, Inc.

GeneralRe: RichTextBox has a bug? Pin
Zembaliti5-Feb-04 20:41
Zembaliti5-Feb-04 20:41 
GeneralRe: RichTextBox has a bug? Pin
Zembaliti6-Feb-04 0:25
Zembaliti6-Feb-04 0:25 
QuestionMulti-platform C#? Pin
Kryal4-Feb-04 12:50
Kryal4-Feb-04 12:50 
AnswerRe: Multi-platform C#? Pin
Dmitriy Kostovetskiy4-Feb-04 13:22
Dmitriy Kostovetskiy4-Feb-04 13:22 
GeneralRe: Multi-platform C#? Pin
Gerald Leslie Jones4-Feb-04 20:00
Gerald Leslie Jones4-Feb-04 20:00 
GeneralRe: Multi-platform C#? Pin
Michael P Butler5-Feb-04 2:01
Michael P Butler5-Feb-04 2:01 
GeneralRe: Multi-platform C#? Pin
Heath Stewart5-Feb-04 4:32
protectorHeath Stewart5-Feb-04 4:32 
GeneralCustom WebControl - Rendering Images Pin
Member 6440164-Feb-04 12:26
Member 6440164-Feb-04 12:26 

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.