|
I just discovered the "\protect" and "\protect0" RTF code word (whatever RTF people call them, code words or tags or whatever). I wanted to implement it into my little program (it has a RichTextBox control).
I can get it to protect the rich text just fine (cannot be edited), but it's not unprotecting protected text at all. Can someone please take a look at my code snippet and tell me what I'm doing wrong?
Note: The following code is inside my KeyDown event handler, inside an if-block that checks for the CTRL key being down, so CTRL+P makes this run.
if (e.KeyCode == Keys.P)
{<br />
string line = rtf.SelectedRtf;<br />
string text = rtf.SelectedText;<br />
Console.WriteLine("-----LINE-----\r\n{0}\r\n", line);<br />
if (line.IndexOf("\\protect") > -1)
{<br />
Console.WriteLine("unprotected:");<br />
line = line.Replace("\\protect0", "");<br />
line = line.Replace("\\protect", "");<br />
Console.WriteLine(line);<br />
rtf.SelectedRtf = line;<br />
}<br />
else<br />
{<br />
Console.WriteLine("protected");<br />
int start = line.IndexOf(text, line.LastIndexOf("\\"));<br />
int end = start + text.Length;<br />
line = line.Insert(end, @"\protect0");<br />
line = line.Insert(start - 1, @"\protect");<br />
rtf.SelectedRtf = line;<br />
}<br />
}
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
This is just to help new people.
In this code following line of code should be changed
string line = rtf.SelectedRtf;
string text = rtf.SelectedText;
TO
string line = rtf.Rtf;
string text = rtf.Text;
It works for me after making this change
Thanks
|
|
|
|
|
Found few articles about writing to the event log but I just want to save the event log (appevent.evt and system.evt)
Any body knows an easy way to do this c# (NET 1.1)
thanX in avance
|
|
|
|
|
Hi,
Seems to me you can copy these, just like all other files, e.g. with File.Copy
Luc Pattyn
|
|
|
|
|
Tried to copy the files as you mention but they get corrupted (even when done manually). Some body told me that need to used the event viewer program to properly ave them. So I am looking for the example to do that.
|
|
|
|
|
Is there a way in which I can access and create NTFS Object Ids (the one NTFS uses to keep track of shortcut links etc), from within a C#/NET application, without resorting to issuing commands via Process.Start etc.
Ta PhilD
|
|
|
|
|
I can't get my namespaces to work! If I have a group .cs files with "namespace AAA {" at the top, aren't I supposed to be able to access all of these files by placing "using AAA;" at the top of my program?
P.S. Do NOT give me an answer including anything with Visual Studio. I don't have this program, and won't for a long time.
---
A 13 Year Old Programming Wiz
The elementary kids were right!
"1" + "1' does = "11"!
|
|
|
|
|
csc.exe has built-in help, use /? to see it
I believe you need /reference (or /r)
all namespaces mentioned in using statements, need to be referenced, except maybe
for a couple of default ones (such as System itself).
the program one is not allowed to mention has a free "Express" version that I would
recommend...
Luc Pattyn
|
|
|
|
|
Luc Pattyn wrote: the program one is not allowed to mention has a free "Express" version that I wouldrecommend...
What does this mean? (Oh thanks, by the way; it worked )
*** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
---
A 13 Year Old Programming Wiz
The elementary kids were right!
"1" + "1' does = "11"!
|
|
|
|
|
you're welcome.
it means you can download [^] and use a professional IDE with no charge
provided you are runnine WinXP with SP2.
Luc Pattyn
|
|
|
|
|
I have to use my dad's mac for internet, and i can usually use a flash drive to transfer files to my pc, which doesn't have internet (and won't for a long, long time). I tried downloading the installer from that website, but it requires you to be connected to the internet. I found another that didn't need the internet to install, but it is to big for the flash drive. my parents said they are getting an adapter that'll plug into my computer so it can have internet, but it is fairly expensive and I'll have to get it for my birthday, which is in about 4 months.
*** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
---
Description: A 13 Year Old Programming Wiz
The elementary kids were right! "1" + "1' does = "11"!
|
|
|
|
|
I understand.
I do believe it is possible to download a special version that you can burn on a CD
(provided your Mac does that). Such version is used mainly by companies that
need to install on many machines...
Hey, I used to use a Mac (with MPW, a precursor of CodeWarrior, long before Mac OS X)
when Windows was still in its infancy.
Luc Pattyn
|
|
|
|
|
Yeah, my mac can't burn cd's. Joy! lol
*** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
---
Description: A 13 Year Old Programming Wiz
The elementary kids were right! "1" + "1' does = "11"!
|
|
|
|
|
If you cannot get hold of a VS distribution, the free SharpDevelop IDE is probably a good alternative for you. SharpDevelop[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I think he was referring to the fact that MS has released express versions of the various code versions of visual studio 2005 for free (At least they were last time I checked). These versions give you allot of the primary functions and features that any hobbyist and possibly small business might need. They have versions for VB,C# and asp .net. This is the easiest way to get and play with vs2005.
Aaron
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
Hello,
I am trying to create a server for a game engine. Right now when a client connects to the server I create a new thread and a new Connection object for the client. The connection object listens for any data being sent from the client and somehow has to pass back the data to the server.
Client ---> Server ---> Connection
This is where I am stuck. I want to create a wrapper class for the server which causes me to rethink my design.
Right now the Connection object has a event which is fired when data is received from the client. The server also has an event for when data is received from the client. The connection object fires the servers event which in turn lets the wrapper class know data has be received.
Connection
----------
Event dataReceived
Server
----------
Event dataReceived
Connection.dataReceived += foo(DataReceived)
public void DataReceived(foo e)
{
dataReceived(this, e)
}
Wrapper
----------
Server.dataReceived += foo(DataReceived)
public void DataReceived(foo e)
{
}
I find this difficult to explain so I hope I was clear enough. I would appreciate any help regarding this subject. Is it even wise to create a new object for each client connection? etc..
ANY HELP would be extremely appreciated
Thanks, Thomas Hoggard
Thomas Hoggard
|
|
|
|
|
How to implement cut/paste etc. edit and toolstrip menus if Windows forms contains DatagridView.
to reproduce:
Observed:
first column is not empty
Expected:
first column must be empty
Code to reproduce:
using System.Windows.Forms;
using System.Data;
static class Program {
static void Main() {
Application.Run(new Frm());
}
}
class Frm : Form {
public Frm() {
DataGridView dataGrid1 = new DataGridView();
DataTable t = new DataTable();
t.Columns.Add();
t.Columns.Add();
t.Rows.Add("111111", "222222");
dataGrid1.DataSource = t;
dataGrid1.Dock = DockStyle.Fill;
Controls.Add(dataGrid1);
}
protected override void OnActivated(System.EventArgs e) {
base.OnActivated(e);
Control o = ActiveForm;
while (o is ContainerControl) {
ContainerControl oContainer = (ContainerControl)o;
o = oContainer.ActiveControl;
}
if (o != null && o is TextBox)
((TextBox)o).Cut();
SendKeys.SendWait("{TAB}");
}
}
Andrus
|
|
|
|
|
2. TabPage control without page captions
I have C# .NET 1.1 Winforms appication.
I use Toolstrip buttons to select pages in TabPage Control.
To save window space, I need to remove page captions.
Pages should appear without caption in Tab control.
I set tabpage Text properties to empty strings but empty page captions
are still present.
How to remove tab captions from TabPage pages ?
Andrus
|
|
|
|
|
Hello,
I think it would be easier to remove the TabPage from the TabPages Collection, hold the instance, and if you whant to show it, add it again.
All the best,
Martin
|
|
|
|
|
It works fine with C# .NET 2.0, but are you sure that it is not only that you has not redrawn the form? It might be an .Invalidate() call missing. Have you tried changing them in run-time to other strings? If empty strings does not work, try using one-space strings instead " ", might give you similar result.
Internet - the worlds biggest dictionary
|
|
|
|
|
Is there a way to get notified when the active document changes?
So far I've managed to subscribe on the DocumentOpened and the DocumentClosing events, however I did not find any way to know when the active document changed. My addin should be enabled only when the forms designer is viewed, and I would therefore liek to disable it when other documents are viewed.
Anyone got any hint for me?
|
|
|
|
|
Hi,
i have a problem with a WebBrowser-Control on my Form.
I navigate to a Webpage, which is broader than the width of the Form/WebBrowser-Control.
I have Scrollbars enabled but it doesn't show the horizontal Scrollbar.
But iIn the InternetExplorer it shows the Scrollbar.
Can sb help me?
greets
el_MKay
|
|
|
|
|
I trust there is quite a difference between an elementary browser component and a full-
fledged application such as Internet Explorer.
Have you read this recent article[^] ?
Luc Pattyn
|
|
|
|
|
Hi people,
I am running a DOS batch file (.bat) from inside a C# code. I am using the Process class to do that. The problem I have is weird, it seems that on the dev machine, the process is firing the event too quickly (i.e. it is not even executing) and since the call is supposed to create a file on disk, the file of course is not found. On the other hand, on a normal (client) machine, it seems to work, but i'm not sure that it works all the time.
Could anyone give me some solution to this weird problem?
Thanks,
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Are you calling the process synchronously or asynchronously? An asynchronous call returns immediately without waiting for the process to finish executing.
---
Year happy = new Year(2007);
|
|
|
|