Click here to Skip to main content
15,890,186 members
Home / Discussions / C#
   

C#

 
QuestionReplacing backslahes in a string Pin
Danpeking24-Dec-09 2:57
Danpeking24-Dec-09 2:57 
AnswerRe: Replacing backslahes in a string Pin
Danpeking24-Dec-09 3:03
Danpeking24-Dec-09 3:03 
GeneralRe: Replacing backslahes in a string Pin
Saksida Bojan24-Dec-09 3:55
Saksida Bojan24-Dec-09 3:55 
Questionpassing parameters from crystal report to windows form Pin
Nitin S24-Dec-09 1:11
professionalNitin S24-Dec-09 1:11 
Generalcoding of IPsec functionality Pin
3bood.ghzawi24-Dec-09 0:00
3bood.ghzawi24-Dec-09 0:00 
QuestionCREATE DATABASE permission denied in database 'master' Pin
haleemasher23-Dec-09 19:39
haleemasher23-Dec-09 19:39 
AnswerRe: CREATE DATABASE permission denied in database 'master' Pin
Russ-T23-Dec-09 20:24
Russ-T23-Dec-09 20:24 
Questiondraw rich text in a custom control Pin
Duong Tien Nam23-Dec-09 16:11
Duong Tien Nam23-Dec-09 16:11 
I'm writing a control similar to visio to draw shapes and text, now I want to support rich text drawing into my control.

I searched the web and found what they call "windowless rich text control" but it does not have code for C#, below is what I tried to do but it is not work:
namespace WindowsFormsApplication1
{
    [Guid("c5bdd8d0-d26e-11ce-a89d-00aa006cadc5")]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ITextHost
    {
        IntPtr TxGetDC();
        IntPtr TxReleaseDC(IntPtr hdc);
    }

    public partial class Form1 : Form, ITextHost
    {
        [DllImport("riched20.dll")]
        private static extern int CreateTextServices(
          [MarshalAs(UnmanagedType.IUnknown)] object punkOuter,
          ITextHost pITextHost,
          [MarshalAs(UnmanagedType.IUnknown), Out] out object ppUnk);

        public Form1()
        {
            InitializeComponent();
            this.Load += new EventHandler(Form1_Load);
        }

        void Form1_Load(object sender, EventArgs e)
        {
            object ppUnk = null;
            int result = CreateTextServices(null, this, out ppUnk);
        }

        #region ITextHost Members

        public IntPtr TxGetDC()
        {
            return this.Handle;
        }

        public IntPtr TxReleaseDC(IntPtr hdc)
        {
            return IntPtr.Zero;
        }
    }
}


When run into the method CreateTextServices, it keeps saying that the memory is corrupted. I don't know what I did wrong in the code. And I stuck with it.

Please help me with that, thanks for your concern.
AnswerRe: draw rich text in a custom control Pin
Jimmanuel24-Dec-09 2:25
Jimmanuel24-Dec-09 2:25 
QuestionC# TripleDES and Perl CPAN:Crypt Pin
draskosaric23-Dec-09 15:28
draskosaric23-Dec-09 15:28 
AnswerRe: C# TripleDES and Perl CPAN:Crypt Pin
Garth J Lancaster23-Dec-09 17:01
professionalGarth J Lancaster23-Dec-09 17:01 
GeneralRe: C# TripleDES and Perl CPAN:Crypt Pin
draskosaric24-Dec-09 20:59
draskosaric24-Dec-09 20:59 
QuestionC# Creating a class and assigning properties to it. Pin
Darrall23-Dec-09 14:01
Darrall23-Dec-09 14:01 
AnswerRe: C# Creating a class and assigning properties to it. Pin
Luc Pattyn23-Dec-09 15:00
sitebuilderLuc Pattyn23-Dec-09 15:00 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall23-Dec-09 15:49
Darrall23-Dec-09 15:49 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Luc Pattyn23-Dec-09 16:06
sitebuilderLuc Pattyn23-Dec-09 16:06 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall24-Dec-09 4:26
Darrall24-Dec-09 4:26 
AnswerRe: C# Creating a class and assigning properties to it. Pin
#realJSOP23-Dec-09 21:56
mve#realJSOP23-Dec-09 21:56 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall24-Dec-09 4:52
Darrall24-Dec-09 4:52 
AnswerRe: C# Creating a class and assigning properties to it. Pin
Richard MacCutchan23-Dec-09 22:28
mveRichard MacCutchan23-Dec-09 22:28 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall24-Dec-09 4:59
Darrall24-Dec-09 4:59 
AnswerRe: C# Creating a class and assigning properties to it. Pin
hamed-vojdani24-Dec-09 5:27
hamed-vojdani24-Dec-09 5:27 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall24-Dec-09 5:39
Darrall24-Dec-09 5:39 
QuestionCondense a list Pin
o m n i23-Dec-09 11:57
o m n i23-Dec-09 11:57 
AnswerRe: Condense a list Pin
Luc Pattyn23-Dec-09 12:07
sitebuilderLuc Pattyn23-Dec-09 12:07 

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.