Click here to Skip to main content
15,910,121 members
Home / Discussions / C#
   

C#

 
Questiondeleting class objects Pin
Manu_8113-Jan-06 6:23
Manu_8113-Jan-06 6:23 
AnswerRe: deleting class objects Pin
Tom Larsen13-Jan-06 6:34
Tom Larsen13-Jan-06 6:34 
AnswerRe: deleting class objects Pin
Guffa13-Jan-06 6:39
Guffa13-Jan-06 6:39 
QuestionInclude C++ resources in C# code Pin
Erock12313-Jan-06 4:46
Erock12313-Jan-06 4:46 
Questioninserting image in form Pin
usmanali12313-Jan-06 3:53
usmanali12313-Jan-06 3:53 
AnswerRe: inserting image in form Pin
RizwanSharp13-Jan-06 9:45
RizwanSharp13-Jan-06 9:45 
AnswerRe: inserting image in form Pin
Koushik Biswas13-Jan-06 12:35
Koushik Biswas13-Jan-06 12:35 
QuestionEM_SETCHARFORMAT Question Pin
c#guy381113-Jan-06 3:47
c#guy381113-Jan-06 3:47 
I posted this once before, but it is about 20 pages back now. I am using EM_SETCHARFORMAT to try and set the background color of charachters in a RichTextBox, but it wont work. I have tried everything I can think of, and nothing. When I try and set the forecolor, that works, and I can paste in charachters with a set backcolor and it works fine, the code just isnt working how I want it to...

I tried dwEffects=0, dwEffects=CFE_PROTECTED, not setting dwEffects, etc. Nothing has worked. The call to DefWndProc is returning a non zero value, so it is working, just not how I want it to. There has to be something I am missing somewhere... I am going to list all my constants, structure, etc, and perhaps someone can figure out what is going on. FYI, I have also tried the API call and it does the same thing.

[StructLayout(LayoutKind.Sequential)]
private struct CHARFORMAT2
{
public int cbSize;
public int dwMask;
public int dwEffects;
public int yHeight;
public int yOffset;
public int crTextColor;
public byte bCharSet;
public byte bPitchAndFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)]
public string szFaceName;
public int wWeight;
public int sSpacing;
public int crBackColor;
public int lcid;
public int dwReserved;
public int sStyle;
public int wKerning;
public byte bUnderlineType;
public byte bAnimation;
public byte bRevAuthor;
public byte bReserved1;
}//struct charformat2

//constants
EM_SETCHARFORMAT=0x444;
CFM_BACKCOLOR=0x4000000;
CFM_COLOR=0x40000000;
SCF_SELECTION=0x1;

//Call to format, tried CFM_BACKCOLOR and CFM_BACKCOLOR|CFM_COLOR, etc,
// only forecolor changes
CHARFORMAT2 cf2=new CHARFORMAT2();
cf2.dwMask=CFM_BACKCOLOR;
cf2.cbSize=Marshal.SizeOf(cf2);
cf2.crBackColor=ColorTranslator.ToWin32(Color.Red);

IntPtr lParam=Marshal.AllocCoTaskMem(Marshal.SizeOf(cf2));
Marshal.StructureToPtr(cf2, lParam, false);

Message msg=Message.Create(this.Handle, EM_SETCHARFORMAT, (IntPtr)SCF_SELECTION, lParam);
DefWndProc(ref msg);

Marshal.FreeCoTaskMem(lParam);
AnswerRe: EM_SETCHARFORMAT Question Pin
mav.northwind13-Jan-06 21:48
mav.northwind13-Jan-06 21:48 
GeneralRe: EM_SETCHARFORMAT Question Pin
arow69d14-Jan-06 8:43
arow69d14-Jan-06 8:43 
QuestionImplementation of HTML HELP in Splitcontainer Pin
BlondeBusyBee13-Jan-06 3:28
BlondeBusyBee13-Jan-06 3:28 
QuestionExecutable c# without framework Pin
hellamasta13-Jan-06 3:16
hellamasta13-Jan-06 3:16 
AnswerRe: Executable c# without framework Pin
André Ziegler13-Jan-06 3:43
André Ziegler13-Jan-06 3:43 
GeneralRe: Executable c# without framework Pin
DotNetInterest13-Jan-06 5:35
DotNetInterest13-Jan-06 5:35 
GeneralRe: Executable c# without framework Pin
Tom Larsen13-Jan-06 6:22
Tom Larsen13-Jan-06 6:22 
GeneralRe: Executable c# without framework Pin
Dave Kreskowiak13-Jan-06 7:21
mveDave Kreskowiak13-Jan-06 7:21 
AnswerRe: Executable c# without framework Pin
Nish Nishant13-Jan-06 5:45
sitebuilderNish Nishant13-Jan-06 5:45 
GeneralRe: Executable c# without framework Pin
hellamasta14-Jan-06 0:16
hellamasta14-Jan-06 0:16 
GeneralRe: Executable c# without framework Pin
Nish Nishant14-Jan-06 4:35
sitebuilderNish Nishant14-Jan-06 4:35 
QuestionError in XML serialization Pin
Jesper196613-Jan-06 3:08
Jesper196613-Jan-06 3:08 
AnswerRe: Error in XML serialization Pin
Le centriste13-Jan-06 4:27
Le centriste13-Jan-06 4:27 
GeneralRe: Error in XML serialization Pin
Jesper196613-Jan-06 4:52
Jesper196613-Jan-06 4:52 
GeneralRe: Error in XML serialization Pin
Le centriste13-Jan-06 19:33
Le centriste13-Jan-06 19:33 
QuestionProblem in DataGrid Pin
P. Gnana Prakash13-Jan-06 2:58
P. Gnana Prakash13-Jan-06 2:58 
AnswerRe: Problem in DataGrid Pin
Drew McGhie13-Jan-06 5:44
Drew McGhie13-Jan-06 5:44 

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.