|
Hello.
About your question... Well, this is one of the biggest limitations this control (RichTextBox is just a wrapper around RichEdit) has. This is not because I missed something, but because it was initialy designed as it it is now. You may refer to the MSDN documentation and get a little more info about sutiation yor are in and try to solve it.
The only way I can see in this situation is parsing RTF yourself and building internal table representation for later use. But it far from perfect. At least you may try this one .
Hope info about helped you. If you will have any questions or ideas, don't hesitate to contact me.
Cheers,
Alex.
Alex KraS
|
|
|
|
|
Thanks a lot man , thats what I was expecting.
I am working on that by editing the Rtf code
I don't know if you have better idea for this, inserting Rtf code into RichTextBox by using the following code:
richTextBox1.SelectedText = "hehehe";
String table = @"\trowd\trgaph108\trleft-108\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx2844\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx5796\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx8748\pard\intbl\ltrpar\nowidctlpar\f1 \cell\row";
richTextBox1.Rtf = richTextBox1.Rtf.Replace("hehehe", table);
Do you any better idea how to know the current position to insert a table into Rtf??
thanks in advance
|
|
|
|
|
Well, as a better solution (maybe) you may look at EM_INSERTTABLE message at MSDN. Oh, sorry, it's not there. Some time ago I found i in Murray Sargent's blog here.
Unfortunately, it also very limited as in functionality as in versions (AFAIR you should use version 4 and above - that means you should load msftedit.dll instead of standard riched20.dll).
You are trying to make a big job (tables in RichEdit). Hope you'll achive desired results. Good luck.
Cheers,
Alex.
Alex KraS
|
|
|
|
|
hey ,
Can't we add coding support as well as falling strategies here?? So this would be a more perfect editor..
|
|
|
|
|
Hello. You can add and/or remove everything you want. I did not attach any license to this control, so you can use it as you want.
But, I will not be able to help you there, due to the business at work (Just don't have free time). But if you need any explanations about control I will try go give them ASAP.
Good luck.
Alex KraS
|
|
|
|
|
it's the best richtextbox i've seen! chinese
|
|
|
|
|
Thank you. I am trying to make my best Alex KraS
|
|
|
|
|
1. I open file with some OLE object (for example Microsoft Equation).
2. Double click Microsoft Equation object and edit it
- when I save equation nothing change in editor - is there some solution how to refresh it in editor?
|
|
|
|
|
Hello. This is somehow unexpected. For me this works just fine. However, sometimes it happens so that I can't load object's content into its provider. At least I noticed such behavior for Microsoft Equation.
But still you may try the following:
Provide in place activation information (implement IRichEditOleCallback.GetInPlaceContext). I can't tell you whether that fixes the bug you reported, but as the first thing I may advise. You can do it like that:
OLEINPLACEFRAMEINFO frameInfo = (OLEINPLACEFRAMEINFO)Marshal.PtrToStructure(lpFrameInfo, typeof(OLEINPLACEFRAMEINFO));
frameInfo.cb = (uint)Marshal.SizeOf(frameInfo);
frameInfo.fMDIApp = 1;
frameInfo.hwndFrame = this.RichTextBox.Handle;
Marshal.StructureToPtr(frameInfo, lpFrameInfo, true);
IntPtr ptr_FrameWindow = Marshal.GetIUnknownForObject(OleFrameWindow);
Marshal.WriteIntPtr(lplpFrame, ptr_FrameWindow);
IntPtr ptr_DocWindow = Marshal.GetIUnknownForObject(OleDocWindow);
Marshal.WriteIntPtr(lplpDoc, ptr_DocWindow);
In code above don't forget to replace the following:
1. RichTextBox - ExtendedRichTextBox instance
2. OleFrameWindow - class that implements IOleInPlaceFrame interface
3. OleDocWindow - class that implements IOleInPlaceUIWindow
As I discovered, you don't need to provide full implementation of the above interfaces. Just fill the GetWindow methods in both classes. This one returns handle to the Window that will contain object's controls and menus.
However, I can't guarantee that this will definitely help you. I just offer this as a possible solution, because I as searching the ways to workaround OLE. This is difficult due to the fact that there is no any documentation for .NET and thus I have to define everything myself.
But, anyway, thank you for the feedback, as it helps me to enhance and fix that control.
Hope, my suggestions will help.
Regards,
Alex.Alex KraS
|
|
|
|
|
Hi Aleski,
if I set the right to left property of the ruler to yes, it dont changes from right to left.
|
|
|
|
|
Hello!
Yes this is known limitation. Initially it was not designed to support RTL layout.
But it is currently being fixed. I will post new code when it will be completed.
Regards,
AlexAlex KraS
|
|
|
|
|
|
Hi Alex,
Do u have time to fix the right to left problem, or if u can just guide me that which parts of code needs changes to fix the problem.
|
|
|
|
|
Hi dear,
Can u tell me where I can find this Advance Text Editor with Ruler for VB.net coz I dont know C#
Regards.
|
|
|
|
|
Hello.
Actually, I did not provide VB.NET version due to the free time limits (currently working on new version). But, you can easily compile that control to DLL and add a reference to your VB project. Also, you may use converters to achieve that.
Well known way to convert between .NET languages is using Reflector (hope you know that one). Just compile assembly, open it in Reflector and export sources in required language.
Hope that will help you.
Regards,
AlexAlex KraS
|
|
|
|
|
thanx dear for the reply.
|
|
|
|
|
Hello Aleksei,
First of all, Thanks for your great work.
However I try to embed your work in my project which built in X64, unfortunately it doesn't work.
I debug a little bit, error is caused by the SendMessage which import from USER32.
Any idea about it?
Thanks in advance.
Alva
Impossible is Nothing!
modified on Sunday, November 1, 2009 11:43 AM
|
|
|
|
|
SendMessage routine is a system one. Sorry, but I was not able to test this control on x64 system. Can you provide me with more info about the error. Which line (or lines) of code cause the exception?
Alex KraS
|
|
|
|
|
Hello Alex,
Thanks so much for your kindly reply.
The error occurs in line 1504 of ExtendedRichTextBox.cs, the last line of set property of SelectionCharStyle. As following:
SendMessage(new HandleRef(this, Handle), EM_SETCHARFORMAT, SCF_SELECTION, ref param);
The definition of SendMessage defined in line 732:
[DllImport("user32", CharSet = CharSet.Auto)]
private static extern int SendMessage(HandleRef hWnd, int msg, int wParam, ref CHARFORMAT2 lParam);
By the way, I tried to modify the CharSet attribute of DllImport from Auto to Unicode, it failed too.
Thanks again.
Alva
Impossible is Nothing!
|
|
|
|
|
I just found it not only doesn't work in X64 platform, but also not work properly in Windows 7, so that I decided to debug it and get rid of the bug.
The problem is caused for the structure which passed to SendMessage. To avoid this, I used the way as following:
Step 1. Modify the extern method definition
//[DllImport("user32", CharSet = CharSet.Auto)]
//private static extern int SendMessage(HandleRef hWnd, int msg, int wParam, ref CHARFORMAT2 lParam);
[DllImport("user32", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(HandleRef hWnd, int msg, Int32 wParam, ref IntPtr lParam);
Step 2. Modify the call to that method, as following:
//SendMessage(new HandleRef(this, Handle), EM_SETCHARFORMAT, SCF_SELECTION, ref fmt);
GCHandle gch = GCHandle.Alloc(fmt);
IntPtr lParam = GCHandle.ToIntPtr(gch);
SendMessage(new HandleRef(this, Handle), EM_SETCHARFORMAT, SCF_SELECTION, ref lParam);
gch.Free();
It works now in Windows 7 and I assume it should works fine in X64 bit as well.
BR,
Alva Chien
Impossible is Nothing!
|
|
|
|
|
Hello, guys. It seems that much time passed, after previous post was published but I think that solution to problem described before may help someone.
So, main problem in porting 32 bit code to 64 bit platform and vice versa is the size of pointers, which is 4 bytes in x86 and 8 bytes in x64. So far there is no way for native platforms (like C\C++\Delphi) to produce the code for both platforms other than recompilation with retargeting to new paltform.
In .NET world it's much easier, due to existence of IntPtr (UIntPtr) which is platform independent and changes accordingly to he underlying pointer size used in end user's system.
I have noticed that many P/Invoke declarations are written using Int32 or UInt32 instead of pointers, so did I here (this is my mistake, sorry). This will limit the usage of such code to the 32 bit platforms only as the size of Int32 and UInt32 is 4 bytes (comparing with x64 8 bytes). And of course when you'll try to execute such code you will get memory exception.
So, the solution is simple. Replace all Int32 and UInt32 parameters in P/Invoke declarations with corresponding pointers from .NET world (IntPtr, UIntPtr, SafeHandle, HandleRef and others).
Hope this info will help someone. Good luck!
Alex KraS
|
|
|
|
|
I really like it, i was just going to ask if you could make a project with ruler for VB 2008, i can not figure out how to create a ruler.
Thanks,
Charles
|
|
|
|
|
Hey,
I have a bit of a problem. When I set the ZoomFactor property in my richtextbox to anything other than 1, the ruler does not adjust to still show the indentation correctly. The ruler stays the same size while all the text in the box is zoomed correctly.
Like in openoffice, when you zoom out or in, the ruler adjusts itself. How can I achieve the same behaviour?
Thanks,
Anthony.
Check out my desktop conversion software for Windows -
www.universalconverter.net
|
|
|
|
|
Hey,
Thanks for this wonderful project. It really is a great editor, and I would love to use it in my projects.
However, I read in one of your posts some time ago that the next version will have Hunspell powered spell check. Just wondering, did I miss when you released it, or is it still in development?
Thanks in advance,
Anthony
Check out my desktop conversion software for Windows -
www.universalconverter.net
|
|
|
|
|
Hello, sory for inconvinience. I just don't have enough time to upload files (Currently very busy at work). I try to dedicate some time for upload.
I will also update an article when work will be done.
P.S. Thank you very much for your words. I am glad that this portion of code is usefull for people.
Cheers,
Alex
Alex KraS
|
|
|
|
|