|
This will break if the bold is inside a cluster of RTF codes yes. The principle is the same though. Remove the \b and insert the <b> after the first space after the \b. For the end tag \b0 look for the \b0 and find the first \ in the cluster of those tags and insert the </b> before it:
Example:
\b\ul Test\b0\uln
\ul <b>Test</b>\uln
NOTE: Although there is no other offical RTF code that I am aware of that starts with \b you might want to check to make sure it really is bold and not the begining of something else. Easiest way is to search for "\b " and "\b\" instead of just "\b". That will find the bold tag if it is on the end of a cluster of RTF codes or in the middle. As for the \b0 you can do the same I guess but I can't imagine an RTF ever starting out with \b0.
|
|
|
|
|
I wanna show a html file by default browser.
I know, in Win32, i can call ShellExecute to open a *.htm file directly.
but, in .NET, there is no Win32 APIs,
so, what should i do?
|
|
|
|
|
|
Nishant, thanks
I have got the solution.
here it is.
using System.Diagnostics;<br />
<br />
Process pro = new Process();<br />
pro.StartInfo.FileName = "C:\\test.htm";<br />
pro.Start();
thanks anyway
|
|
|
|
|
Can someone help me with multy form communication ? The question is: If I have 2,3,more... forms visible how can form number 1 send some data (for exmaple: move progress bar) on Form number 2,3,4,more... ?? Sending varibales from one form to another,sharing resources and stuff ??
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
There is more than one way to do this.
1/ You can have a singleton object in your system that will hold data (for example ints) through which these forms will communicate.
2/ If you have a singleton, one form could fire an event when it wishes to communicate data, the singleton have an event handler, and then invoking a method on form2 to set the variable.
|
|
|
|
|
1. Make the progress bar Public.
2. To the form number 1 give the references to forms 2,3,4...
3. Use the reference to move progress bar.
The refenrences can be passed as a constructor parameter or kept as a static array.
|
|
|
|
|
Like this ?
<br />
<br />
Form frm2 = new MyNamespace.Form2();<br />
frm2.Show();<br />
++frm2.progressBar1.value;<br />
This is what you mean ?
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
Yes. This is what I meant. Of course this relates to Windows forms, not Web forms.
|
|
|
|
|
But in this case I have to make progressBar1 on Form2 - static !
<br />
public static ProgressBar progressBar1;<br />
otherwise I can not see it
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
You can not see it because you use general type to reference your form. Consider the example:
Form frm1 = new MyFormWithProgressBar();
frm1.Show();
frm1.progressBar1.Value++;
The correct code is:
MyFormWithProgressBar frm1 = new MyFormWithProgressBar();
frm1.Show();
frm1.progressBar1.Value++;
Sorry that I have not noticed that mistake in your previous post.
|
|
|
|
|
Nice.. 10x
[Do you know how to make form transperent / non-standart shape ?]
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
Everyone, I'm in the process of developing what can be accurately
called a chat system, and I'm running into a problem that I just can't figure out:
My client login window (the GUI elements themselves are typical, and I don't think
they're relevant) grabs hold of a remote factory object (subclass of MarshalByRefObject),
and that factory respects the following interface:
namespace MyCompany.Interfaces
{
public delegate void WelcomeEvent(string username);
public delegate void DismissEvent(string username);
public interface ISessionFactory
{
void OpenSession(string username, WelcomeEvent welcomeEvent, DismissEvent dismissEvent);
void CloseSession(string username, WelcomeEvent welcomeEvent, DismissEvent dismissEvent);
}
}
The connect button of my Login Window fires off the following delegate when clicked:
private void OnConnectButtonClicked(object sender, EventArgs e)
{
if (usernameText.Text.Length == 0) return;
string username = usernameText.Text;
RemotingConfiguration.Configure("client.config");
ISessionFactory factory =
(ISessionFactory) Activator.GetObject(typeof(ISessionFactory),
"http://localhost:5007/SessionFactory");
FriendsWindow buddylist = new FriendsWindow();
WelcomeEvent welcomeEvent = new WelcomeEvent(buddylist.WelcomeUser);
DismissEvent dismissEvent = new DismissEvent(buddylist.DismissUser);
factory.OpenSession(username, welcomeEvent, dismissEvent);
buddylist.Show();
this.Visible = false; // hide login window
}
When OnConnectButtonClicked is fired, I see a FileNotFoundException thrown from inside
buddylist.Show();
claiming that it can't find the ChatClient assembly, or the assembly of one of its dependencies.
Information relevant to the FriendsWindow class
FriendsWindow is a subclass of Form
Not surprisingly, it defined methods WelcomeUser and DismissUser, and each (as you
can see) are compatible with my WelcomeEvent and DismissEvent delegate types.
FriendsWindow and LoginWindow (the class defining the above) are both defined within
the same namespace.
It's defined within a project named ChatClient.csproj.
That project's default namespace: ChatClient (though all of my classes are
placed in a namespace I call MyCompany.ChatClient)
That project's assembly name: ChatClient
What's odd to me? If I comment out the factory.OpenSession() line, the program
properly displays my FriendWindow in response to the Show message. It's as
if the act of calling OpenSession causes the problem on the very next line.
I've not tried very much, because I'm still in that denial which allows me
to think that I'm right and that there's just a bug in the compiler.
However, I *have* inspected all of the namespace declarations and whatnot
to ensure that there're no typos, and as far as I can tell, there are none.
Any help or general comments as to where I should look for help would
be greatly appreciated.
Best,
Jerry
|
|
|
|
|
hi,
The MDI layout for child MDIforms works fine for upto 3 child windows, i.e., the Horizontal, Vertical and the Cascade layout for the child windows works fine.
But for more than 3 MDIchild windows, the Horizontal and Vertical Layout doesn't work?
Any clue's about this?
Thanks,
Peenu.
|
|
|
|
|
Hi
I read a field of type Image from a SQLServer database. Now, what I want to do is creating a System.Drawing.Image object and holding my retrieved image into it. How?
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
doesn't
Image myImage = Image:FromFile(filename);
work?
|
|
|
|
|
Use SqlCommand 's ExecuteScalar method to retrieve the blob as a byte array, and load it with the Image.FromStream(...) static method using a MemoryStream object.
Sounds easy, eh?
Well, here's a code sample. GetImage() returns an Image object as you requested.
public Image GetImage()
{
return Image.FromStream(new MemoryStream(LoadImageBLOB(mImagePK)));
}
private byte[] LoadImageBLOB(int imagePK)
{
string sql = "SET TEXTSIZE 1000000\n" +
"SELECT the_blob_column FROM the_table " +
"WHERE the_where_clause\n" +
"SET TEXTSIZE 0";
SqlConnection cn = new SqlConnection("the_connection_string");
SqlCommand cmd = new SqlCommand(sql, cn);
cn.Open();
byte[] blob = (byte[])pq.ExecuteScalar();
cn.Close();
return blob;
}
|
|
|
|
|
|
This is my regular expression:
([A-Za-z0-9]+)\s\1
and this is my text:
"this this is the first option option"
And these are those who match:
1- this this
2- option option
To what should I change my regular expression so that the result changes to:
this this
is is
option option
Thanx in advance!
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
Umm... perhaps you should add the second 'is' to your text first?
--
-Blake (com/bcdev/blake)
|
|
|
|
|
There are already 2 is in my text: this is
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
The "is" will not be matched because "This this" has already been matched:
this this is the first option option
The regex engine is at the space after the bold text has been matched - it does not go back into the matched text to see if it is possible to make a 2nd, 3rd, nth match.
This is what the pattern tries to match when it hits "is":
this this is the first option option
That's why you get only the this this match, not is is match.
|
|
|
|
|
I know, that is why I posted my question on this forum! I am looking for some workaround.
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
I have an application that starts a commandline program to transfer some files. When I start the process a DOS box pops up and the output is displayed in it. When the process is done the window closes. The problem is that if the process exits very quickly (which usually happens when an error occurs) the user doesn't get to see what happened. So, I tried redirecting the StandardError to a string (using ReadToEnd) and then have a popup appear when the process is done if the string isn't empty. That works, but it also kills the StandardOutput (even though I told it NOT to redirect it) and my application hangs up until the process has finished (which it didn't do when I didn't redirect the stderr). I tried redirecting the output too, but again I can't get at it until the process has quit which could leave the user staring at a blank screen until the transfer is done (which could be a long time!). Is there a way to get at the stdout and stderr without hanging the application up?
|
|
|
|
|
I want to change a web application's web.config in its setup project
how can I get the directory of it installed when I run the setup project?
|
|
|
|