|
Hi,
three comments:
- there are discussion threads about such things all the time, often they have the following
keywords: RichTextBox Syntax Coloring; and there are some article on it too on CP
= the more data and intelligence you add to RTB, it gets slower and slower
- IMO if you want to come up with a line-oriented editor with some fancy features and capable of
dealing with 1000+ lines of text, yiu should not use RTB, but just use a Panel, do all
the text handling and the painting yourself. That solution scales well, i.e. you can make it
deal with 1,000,000+ lines and still behave well. Example: I do most of the syntax coloring
analysis in the paint handler, and only for the lines that are visible (that's no more
than 100 on today's monitors).
If you expect to handle no more than say 300 lines of text, you're on a good track;
ptherwise you may have to rethink it.
|
|
|
|
|
Ok thanks, I am very early on in my learning of c# and so wouldn't really know how to go about painting the text myself etc.
Any tutorials?
Thanks.
|
|
|
|
|
Hi,
since you are new to C#, I do not recommend you dive into GDI+ with all the painting stuff
immediately. I do recommend you read and work your way through an introductory book on C#
though (possibly skipping some of the chapters you dont immediately need, e.g. GDI+,
databases, networking).
If you dont need to handle very large files, then probably the RichTextBox approach is
best for you. It has its quirks, but you will learn from trying, and possibly asking here.
If on the other hand you do get curious, dont forget to search on CodeProject.
Searching "paint text" in the search box above, resulted in many articles, including this
lenghty book chapter.[^]
Enjoy C# !
|
|
|
|
|
Ok thanks, I'll have a look at that chapter later. I have already learnt lots on ado.net and database work in C# and so now want to move into something different.
When I said I was just beginning, I meant beginning GDI stuff, not C#. But thankyou for the links.
|
|
|
|
|
|
Hi
I created a C# Application about 2 months ago. Haven't really touched done anything to it, other than moving the folder.
I re-opened it today and got these warnings..
Warning 1 The custom tool 'ResXFileCodeGenerator' failed while processing the file 'Properties\Resources.resx'.
Warning 2 The custom tool 'SettingsSingleFileGenerator' failed while processing the file 'Properties\Settings.settings'.
Warning 3 The custom tool 'SettingsSingleFileGenerator' failed while processing the file 'Properties\Settings.settings'.
They're just warnings, but unfortunately all the Forms and .cs files in my project cannot be opened, and i receive this error message "The project ______ does not exist in the current directory. It may have been moved, or deleted"
I have no idea why i got this message, I haven't really removed anything from the project folder. I always move the filed from my laptop-USB thumbdrive-pc, and it always works.
Can anyone help me out?
Thanks in advance.
|
|
|
|
|
Hello,
In my C# form application i rounded the UI of form using drawing region. Now i am not having any caption bar, it suppressed the movable property of form.
I want the form to be mavable though the caption is not available.
How can i do it?
Thanks.
Gajesh
-- modified at 7:53 Sunday 22nd July, 2007
|
|
|
|
|
Hi!
You can make the window moveable by clicking anywhere inside the window's client area by overriding its WndProc like this:
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
const int WM_NCHITTEST = 0x0084;
const int HTCAPTION = 0x0002;
if (m.Msg == WM_NCHITTEST)
m.Result = new IntPtr(HTCAPTION);
}
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks Mav,
It works perfectly for Form client area.
One more concern here is that i have put one user control on the form so if user click on control area then also it should give the same apperance.
How can i catch the control's WndProc event in Form??
Thanks
Gajesh.
|
|
|
|
|
You can override the WndProc of the usercontrol, too.
There's no such thing as a "WndProc event", so you cannot simply "catch" messages destined for another window (at least not without using a windows hook, but that's far beyond the scope of a forum reply).
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,all
I want to use Dictionary<> to make a map.I create a class named ILayer.So,I write
Dictionary<string, ilayer*=""> g_LyrNameToILayer =
new Dictionary<string, ilayer*="">();
But it was wrong,who can tell me what shoud i do? Thanks a lot!
|
|
|
|
|
The generic Dictionary<> class has to be parameterized with two types (one for the keys and one for the values).
Guessing from your variable name you must write something like this:
Dictionary<string, ILayer> g_LyrNameToILayer = new Dictionary<string, ILayer>();
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks,What you said is right,but,i want the Key is type of string,and the Value is type of pointer,It seems to be that pointer can't be a para in Dictionary.
so,how shoud i do?
|
|
|
|
|
What mav is saying should be sufficient if you're mapping up 'Name' with an instance of 'ILayer'.
Dictionary<string, ILayer> layerDict = new Dictionary<string, ILayer>();
List<ILayer> layers = GetLayers();
int counter = 0;
foreach(ILayer layer in layers)
{
layerDict.Add("Layer" + counter, layer);
counter++;
}
...
ILayer layerOne = null;
if(layerDict.ConstainsKey("Layer1"))
{
layerOne = layerDict["Layer1"];
}
Best regards!
-Larantz-
|
|
|
|
|
|
|
I am trying to create a persistent pub-sub application using wcf.
When a client subscribes to the service it passes a URI and a mehtod name.
When the service needs to callback the client it connects to the URI using a known contract (which can be passed too in a more complex scenario) and activates the method.
My problem is how to listen to the URI on the CLIENT after subscribing.
I know how to do that using a ServiceHost but all I need is a listener for the contract the client exposes.
Is there a way of listening to an "ICallback" (not IReplyChannel or IInputChannel)?
Thanks,
xshift
|
|
|
|
|
Hello everyone,
I have used gacutil tool to install my COM dll into Global Assembly Cache,
http://msdn2.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx
But I am not sure whether I need to manually copy the actual assembly dll into some directory (like Windows\System32? Windows?) after running this tool? Or gacutil tool will automatically copy (install) the assembly for me -- so I only need to run gacutil -i <dllname>?
thanks in advance,
George
|
|
|
|
|
Hi!
You don't have to copy the assembly somewhere else. That's what the GAC is all about...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks mav!
You mean GAC will store the dll in some hidden place? I have searched my machine but can not find where GAC has copied my dll.
A further question, I think when a CLSID is used for CoCreateInstance, GAC should be used for searching the codebase dll containing the implementation of the CLSID, right?
But, for most COM server, they are not in GAC (in GAC, if we list all entries, only tens of items.), so I think there should be some other ways to find codebase dll, other than through GAC, right? So, what are the other ways to find CLSID related codebase dll?
regards,
George
|
|
|
|
|
You can see what's in the GAC more easily than using gacutil by pointing your windows explorer to %WINDIR%\Assemblies .
When a COM server must be created, windows takes a look at HKCR\CLSID\COM Class ID\InprocServer32 (I'm skipping out-of-proc servers deliberately to keep it simple).
The value of this key is used to find the dll containing the implementation (a little simplified, once again).
For managed COM servers this value points to mscoree.dll and only for this type of servers the CodeBase value is neccessary. You can run regedit and then search for "codebase" inside of HKCR\CLSID to see several examples for the required structure of registry entries for managed COM servers.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks mav,
Your described process to load related dll is informative. But it has nothing to do with GAC? I am wondering what is the function of GAC in your following process?
BTW: I find in my Windows registry there are additional Assembly and Class value -- not every mscoree.dll has CodeBase.
I think Assembly is the name in GAC, and Class is for the entry point CLSID for CoCreateInstance? Right?
mav.northwind wrote: When a COM server must be created, windows takes a look at HKCR\CLSID\COM Class ID\InprocServer32 (I'm skipping out-of-proc servers deliberately to keep it simple).
The value of this key is used to find the dll containing the implementation (a little simplified, once again).
For managed COM servers this value points to mscoree.dll and only for this type of servers the CodeBase value is neccessary. You can run regedit and then search for "codebase" inside of HKCR\CLSID to see several examples for the required structure of registry entries for managed COM servers.
regards,
George
|
|
|
|
|
I didn't look into every detail of the registration of managed COM servers, but Junfeng Zhang has a very valuable blog talking about the inner workings of fusion, COM activation, the GAC and other related topics:
http://blogs.msdn.com/junfeng[^]
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks mav,
The blog is very informative. A lot of information... Could you let me know which part do you mean? I felt I lost my way when reading the Blog for 10 minutes.
regards,
George
|
|
|
|
|
I finally got visual c# studio to install on my computer! My grandpa, who's visiting, downloaded the iso images to his computer and burned it to a cd for me, because my dad's can't burn cd's. It's installing as I am typing this... Thank you guys for helping me along the way. Sorry, I didn't know if I should post this here or not... I hope I don't get in trouble 'cause it's not a question...
Oh, and don't mind the sig...
-----
*** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***
|
|
|
|
|