Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Custom WebControl - Rendering Images Pin
krisp4-Feb-04 12:45
krisp4-Feb-04 12:45 
GeneralRe: Custom WebControl - Rendering Images Pin
Nick Parker4-Feb-04 14:38
protectorNick Parker4-Feb-04 14:38 
GeneralString Array written to and parsed from hidden web control Pin
krisp4-Feb-04 12:24
krisp4-Feb-04 12:24 
GeneralRe: String Array written to and parsed from hidden web control Pin
Heath Stewart5-Feb-04 4:22
protectorHeath Stewart5-Feb-04 4:22 
GeneralRe: String Array written to and parsed from hidden web control Pin
krisp5-Feb-04 19:22
krisp5-Feb-04 19:22 
GeneralWeb service question Pin
pankajdaga4-Feb-04 10:24
pankajdaga4-Feb-04 10:24 
GeneralRe: Web service question Pin
Heath Stewart4-Feb-04 10:34
protectorHeath Stewart4-Feb-04 10:34 
GeneralIntPtr and Strings Pin
Tristan Rhodes4-Feb-04 10:10
Tristan Rhodes4-Feb-04 10:10 
GeneralRe: IntPtr and Strings Pin
Heath Stewart4-Feb-04 10:29
protectorHeath Stewart4-Feb-04 10:29 

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.