|
The best you can do is to write a mixed-mode wrapper around the classes in the library and then use that wrapper from C#.
uumeme wrote:
Is it same the writen methods with Visual C++.NET & Visual C++?
No, VC++ .NET generates IL, VC++ code is compiled to machine code.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
Hi All,
I Have two RichTexBoxes on a form vertically one above the other.
Now i want to draw a rectangle on the Richtextbox like we draw in MS-WORD.
This rectangle should allow the user to enter text within it.
and if the rectangle is dragged by holding one of it's end the size of the rectangle should increase. if the size of the rectangle increases more than the Richtextbox's size the rectangle should be continued on the next Richtextbox.
What i want to achieve is the same that we do in MS-WORD.
I dont know whether it is possible or not.
Please help me out,
Waiting for reply
Rgards,
Pramod
|
|
|
|
|
Nope, you can't do it. A richtextbox is a box for text only. You'll need to create your own control to draw text and graphics, and to control the input area like this.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks Christian,
I would also like some more help from u.
can i paste any object on the Richtextbox i.e. if i paste a form or a panel on a richtextbox and enter text on the Richtextbox the text should not go behind that panel / form. Is that possible .
OR is there any way to insert a table on the RichTextBox as we insert the table in MS-WORD.
Waiting for Reply.....
Regards,
Pramod.
|
|
|
|
|
No, in every case, you're talking about a control you will need to create yourself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Now i have a Main richtextbox placed on a form and i try to create a table using forms and placing Richtextbox on the Forms. Each form looks like the cell of the table,
Now the problem is that i have to print the contents of the Richtext in each forms in the tabular form
|
|
|
|
|
you can insert table in the same way i told you in draw rectangle or if you want more elegant way you must deal with RTF syntax and i think this way Ms word work -Not sure- RichTextBox have Rtf Property which you can set to rtf for example the following code will draw table with one row and three cells
{\rtf1\fbidis\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}}
\viewkind4\uc1\trowd\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx2952\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx5904\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx8856\pard\intbl\ltrpar\lang3073\f0\fs24 Cell 1\cell Cell 2\cell Cell 3\cell\row
\pard\ltrpar\fi-108
\par }
this things you see are rtf syntax of the table
for its Specificationlook at Rich Text Format (RTF) Specification, version 1.6[^]
to see this things in action create new appliction put rRichTextBox and textbox or hardcoded this syntax in string variable in somewher in your application write
<br />
richTextBox1.Rtf=textBox1.Text;<br />
or richTextBox1.Rtf=yourStringVariable;
this will draw the table
i hope this help you but i think that if you make your application automate MS-Word may it will be easier
NOTE SORRY FOR THE WIDTH OF TEXT BUT I DIDN"T NOW HOW TO CONFIGURE IT
MCAD
-- modified at 20:05 Friday 2nd September, 2005
|
|
|
|
|
You can work around this by draw rectangle in Bitmap and then copy it into clipboar and paste it in Richtext box
some thing like the following code
Bitmap bm=new Bitmap(26,14);
Graphics g= Graphics.FromImage(bm);
g.DrawRectangle(Pens.Red,0,0,25,13);
g.FillRectangle(new SolidBrush(Color.Yellow),1,1,24,12);
Clipboard.SetDataObject(bm,false);
IDataObject rect=Clipboard.GetDataObject();
if(rect.GetDataPresent(DataFormats.Bitmap))
{
richTextBox1.Paste();
}
bm.Dispose();
g.Dispose();
you have to handle mouse events of richtextbox to create the bitmap and copy and paste it
MCAD
-- modified at 19:36 Friday 2nd September, 2005
|
|
|
|
|
Well Dear!
i m using 3 monitors with windows xp sp2 professional. i want to write a program in C# which forces all of three screens to use same resolution overwriting their individual resolutions and on exiting from application resumes their individual resolution back. plz help me how to do some guidance ?
Thanx
I M new in .net p
|
|
|
|
|
I'm pretty sure you cannot do that in C#. You should search a Win32 DLL and use it with PInvoke or DllImport.
try here www.pinvoke.net
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
hi all,
How am I open Excel File page on windows Form?.Is there a library to Load Excel file and read it using C#?
thanks in advance.
|
|
|
|
|
Why dont you at least try to use the search[^] function?
You'll find plenty of hits which basically seperate into those who use automation and others that use Ado.Net. Which one is better depends on your requirements.
|
|
|
|
|
Hi :
How can I darg-drop item to a WebBrowser control ?
I created an application written by C#,it includes two forms , one form
includes a TreeView control , the other includes a WebBrower control and a
TextBox control, now we call them as Form1 and Form2.
First , I try drag a item to the TextBox control,(I have set TreeView for
drag well ) I set
"this.textBox1.AllowDrop = true;" then add Events and write these methods:
this.textBox1.DragOver += new System.Windows.Forms.DragEventHandler
(this.textBox1_DragOver);
this.textBox1.DragDrop += new System.Windows.Forms.DragEventHandler
(this.textBox1_DragDrop);
this.textBox1.DragEnter += new System.Windows.Forms.DragEventHandler
(this.textBox1_DragEnter);
Run this application,and drag item from TreeView which in Form1 to TextBox
which in Form2,the TextBox 3 Events (DragOver,DragDrop,DragEnter) is done
well.
But when I want drag item to the WebBrower,I can not find DragEnter Event and
others Events related to "Drag-Drop",so I can not drop Item to WebBrowser.
Also I have tryed set WebBrowser's Document.DesignMode="On",but can not drop
too.
Then I Write a HTMLBody's ondragenter Event ,but this ondragenter() can not
trigger.
So I think it must be solved by COM knowledge.
Can any one give my some suggestion,
because my COM knowledge is poor, if anyone give me an all solved code ,I
will be very appreciated.Thanks very
|
|
|
|
|
Grettings All,
I am not familiar with Virtual Dispatching, I know only concepts.
Could some guide to a good atrcile about virtual dispatching or explain in details the benefits of virtual dispatching.
Thank you
Sincerely,
Max Pastchenko
|
|
|
|
|
|
I'm looking for feedback if the following makes sense:
- I declared an Interface IDocument:
public interface IDocument
{
bool IsDirty { get; }
void Save(System.IO.Stream stream, bool resetDirty);
void Load(System.IO.Stream stream);
}
A Helper class implementing the Open/Close/Save/SaveAs/AskForFilename UI should work wiht the document(s) through this interface.
I'm a bit uneasy with the Load/Deserialize design: DeSerialize returns an objec. This makes sense but:
- I can't have a static Load method in the interface
- doesn't allow to implement "Revert"
So I did implement Load the following way:
public void Load(System.IO.Stream stream)
{
System.Xml.Serialization.XmlSerializer ser =
new System.Xml.Serialization.XmlSerializer(typeof(RTDocument));
RTDocument loaded = ser.Deserialize(stream) as RTDocument;
Root = loaded.Root;
}
Is this exceptionally stupid? Some better way?
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
|
Yeah, I arrived at that point, too.
I *think* it can be does by constructing a generic Document Manager just using the typeof(document).
Q: is it possible to override the default "[Serialize]" imlementatìon?
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
Q: is it possible to override the default "[Serialize]" imlementatìon?
Sure - inherit from ISerializable and then override the GetObjectData(SerializationInfo info, StreamingContext context) method. You may also need to supply a special constructor for your class (protected MyClass(SerializationInfo si, StreamingContext context) ) - MSDN has conflicting info on this (see ISerializable[^] and Custom Serialization[^])
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
What's the "good thing" to prefix private members?
example:
public bool IsDirty { get { return ??sDirty; } }
private bool ??sDirty;
m_ seems to be discouraged. As I understand, using lowercase isDirty is not a problem for private members - but what do you do?
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
I use uppercase for public, lowercase for private. To be CLS compliant, if you have a private member and you want a public property, you can't do this, because CLS compliance takes into account VB, which is crap and is not case sensitive. Instead, the recommmended syntax is to prefix with an _.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I use uppercase for public, lowercase for private. To be CLS compliant, if you have a private member and you want a public property, you can't do this
Not true (for C# anyway - VB is another story ) - if you mark your assembly with [assembly: CLSCompliant(true)] and then do something like this
protected string hello;<br />
public string Hello<br />
{<br />
get<br />
{<br />
return this.hello;<br />
}<br />
}
the compiler throws a fit but if you change
protected string hello;
to
private string hello;
everything works fine. I do all my coding in C# this way and VB doesn't have any problems using the assemblies
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
Interesting, I always use private over protected, but I've definately had to mark some methods as not CLS compliant in order to keep this approach. I wonder what was different ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'd do the same as Christian (I loathe hungarian notation )
"I think I speak on behalf of everyone here when I say huh?" - Buffy
-- modified at 7:07 Friday 2nd September, 2005
|
|
|
|