|
Thanks for all the answers...
|
|
|
|
|
May I ask if it is possible to implement syntax highlight function using c#?
Example will be a great help.
|
|
|
|
|
I asked about this a little while back and there seems to be very little information available on it
I was pointed to sharp develop, an open source IDE for c# written in c#, to me this was of little use and far to complicated for what i need but it might be of use to you?
|
|
|
|
|
you could take a look at our syntax highlighter
http://www.compona.com/Default.ascx
(costs 155$ tho)
//Roger
|
|
|
|
|
So, may I ask, after I download the source of SharpDevelop, which component I should look for??
Thank you very much.
|
|
|
|
|
the first thing to do is compile sharp develop, once youve done that run it and open the sharpdevelop combine, it will list some components in the project browser, i cant remember which part its in, but its fairly obvious its one of the editor projects (either text editor or default editor).
I suggest you open a .cs file in the editor to see what it can do and see how complicated it all is! i pretty much gave up on it but if you do find anything of use (even a hint or two) or manage to develop a basic component i would be massivly greatful if you could share some of the mroe complicated areas with me
|
|
|
|
|
Hi all,
The simple test-case below shows a trivial WinForm with an exception in one of its event handlers.
Before the form is created and run, an exception handler is declared. Note that when the app. is run without the debugger (i.e. Ctrl+F5 as opposed to F5), the exception IS NOT CAUGHT...
Any body have any explanations / workarounds?
many thanks,
dm.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication7
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(290, 260);
this.Name = "Form1";
this.Text = "Form1";
this.VisibleChanged += new System.EventHandler(this.Form1_VisibleChanged);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
try
{
Application.Run(new Form1());
}
catch
{
MessageBox.Show("caught");
}
}
private void Form1_VisibleChanged(object sender, System.EventArgs e)
{
object i = null;
i.ToString();
}
}
}
|
|
|
|
|
Can you please explain what the problem is instead of just pasting some code?
Domster wrote:
object i = null;
i.ToString();
What are you trying to here? Are you trying to catch this? Then add a try/catch around this.
Domster wrote:
try
{
Application.Run(new Form1());
}
catch
{
MessageBox.Show("caught");
}
This will catch all exceptions (plus no info would be returned) and your application will exit. See previous reply , to see how to catch exceptions where they occur.
Cheers
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
I am trying to create an owner-drawn TextBox control, but as anyone who may have tried this knows, overriding the OnPaint method is useless as the base class uses the Windows API for painting. I know I can capture the WM_NCPAINT message in WndProc, but the absolute most you can do with this in reality is paint a custom border for the TextBox, anything else just gets painted over by the base class.
So the question is, how can I paint the TextBox without having to resort to building the whole damn thing from scratch? Has anyone actually seen a custom painted TextBox actually implementsd in .Net? Or (hopefully) am I missing something here?
|
|
|
|
|
I can't really test it since I don't have .NET at work, but from the class outlook, I can see that :
- TextBox inherits the PaintEventHandler from its base class (TextBoxBase) : have you tried to implement an handler for it ?
- I don't know why overriding WndProc and processing WM_PAINT (not WM_NCPAINT) should not let you do exactly what you want.
In addition to WM_PAINT, I believe you should process WM_ERASEBKGND as well. In fact what those WIN32 messages are for is as follows :
- WM_ERASEBKGND : background
- WM_PAINT : actual content
- WM_NCPAINT : border
It's reasonable to think that the .NET PaintEvent event is thrown whenever the base class receives (reflected) the WM_PAINT message.
|
|
|
|
|
Thanks heaps for the suggestions, but unfortunately I'm still no closer to my goal.
Intercepting WM_PAINT instead of WM_NCPAINT still only gives me the ability to paint the same 2px wide border - not the background itself. WM_ERASEBKGND also doesn't get me anywhere as the border and control are painted after it anyway.
The problem is that the text area is being overlaid on top, wiping out any background painting you do. Even if I were happy to only have access to paint a 2px wide border, the problem when doing that is that it totally messes up the scrollbar painting.. Uggghhh.
|
|
|
|
|
You didn't say, so just to confirm: are you are inheriting from TextBox or TextBoxBase, and explicitly overriding OnPaint and OnPaintBackground, and are calling SetStyle with the ControlStyles.UserPaint (and optionally AllPaintingInWmPaint and DoubleBuffer)? If you comment-out the normally-required base.OnPaint call, the text is still rendered by the CLR stuff?
|
|
|
|
|
Hi Jeff, I'm inheriting from TextBox not TextBoxBase as I wish to maintin all the functionality of the TextBox control. Overriding OnPaint and/or OnPaintBackground has odd effects, regardless of what Styles have been set, as the TextBox (or TextBoxBase) is overpainting the control with WndProc intercepts.
|
|
|
|
|
I'll have to remember that, thanks for the heads-up. I suppose I should be glad I wrote a binary editor derived straight from Control, as I can see I would have had the problems you're having. Of course, much of TextBox's functionality didn't apply for me. Still a pain in the "details", so I see why you're trying to avoid it.
Still, I'm curious as to why the problems. I'll post back if I find anything.
|
|
|
|
|
I made a UserControl Button. Now I would like to use the Text Property in the Properties Window of the Button inthe Designer to show my Text. I tried with accessors but in my TestForm with my Button is shown "BarButton1" (which is the classname BarButton+1) and not "New" as in the properties window Text-Property.
Does anybody know how to to this?
Stefan
|
|
|
|
|
Expose the button object, ie
public Button MyButton
{
get {return mybutton;}
} This should make it visible via the propertygrid. You might have to add an ExpandableObjectConverter to the property.
Cheers
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
Hi!
I think NameVaueCollection can be very usefull at web developement. (HttpRequest.Params )
But, how can I use NameValueCollections Set function. (It always seems to be readonly...)
(Th e other way is the useing the Session property, where i should use)
Agyklon
|
|
|
|
|
|
Hello,
I am working on my first project on C# after coming from C++ and I cannot seem to find out how to write long strings on multiple lines. It seems like
string longstr = "aaaa"
"bbbb";
or
string longstr = "aaaa \
bbbb";
do not work. Of course I can use the + operator, but I don't want to introduce an extra overhead.
Thanks!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
string longstr = @"aaaa
bbbb";
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
Thanks!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
Me again!
I tried your solution and of course it works, but when I take a look at the string in the debugger I am not satisfied with what I see. It semmes like my string contains lots of spaces between the last a and the first b. I didn't mean that, all I want is a way the compiler can concatenate my strings....
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
OK you have this then:
string longstr = "jsandjksajdhakhdkajshd" +
"asmndjashdkashdhaskdhk" +
"asmndjashdkashdhaskdhk" +
"asmndjashdkashdhaskdhk" +
"asmndjashdkashdhaskdhk".
ToString();
Remember C# is freeform.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Hi All
How can I use HRESULT in C# application in order to check the return value from COM method?
Thanks
|
|
|
|
|