|
kasraa00098000 wrote: but this command only compiles one file and make exe
No, you can compile multiple files or produce a DLL. CSC is called by Visual Studio, so it can compile and produce anything VS can.
|
|
|
|
|
really? how can I compile a csproj file with csc? what about a group of cs file?
|
|
|
|
|
I know nothing about regex. I want to replace some charaters in a string.They are:
+ --> {+}
^ --> {^}
% --> {%}
{ --> {{}
} --> {}}
Who can give me the C# code? Thanks in advance.
|
|
|
|
|
Why do you have to use a regex? If you're not comfortable writing them and you don't have a complex pattern to parse, then don't bother. You can always use string.Replace instead which would do the job equally well. A lot of times, people are advised to use regular expressions when they don't add value, and it really is a case of using a sledgehammer to crack a nut.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Sometimes though, a regex is the right thing to use. String.Replace in this case is really nasty, partly because there are six cases, but mostly because two of the cases are included in the output of all six...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Perhaps something like this:
string inputText = "+{}^%";
// This is the search string
Regex regex = new Regex("[\\%\\{\\}\\^\\+]",RegexOptions.Compiled);
// This is the replacement string
string regexReplace = "{$&}";
// Replace the matched text in the InputText using the replacement pattern
string result = regex.Replace(inputText,regexReplace);
|
|
|
|
|
I tried. But...
I inputed:
\begin{equation}
y&=x+z;
m&=[s]^2%4
\end{equation}
The result was:
{+}{{}{}}{^}{%}
modified on Wednesday, June 9, 2010 7:26 AM
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
{
Regex regexWithAllPossible = new Regex(@"([\+\^%{}])");
string source = @"+ --> {+}^ --> {^}% --> {%}{ --> {{}} --> {}}";
string result = regexWithAllPossible.Replace(source, new MatchEvaluator(CheckMatch));
}
private string CheckMatch(Match m)
{
return "{" + m.Value + "}";
}
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
The "-->" means "to"! Haha. Thanks.
|
|
|
|
|
Yes, I know - I just included all of your text to give a sample...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
I'm sorry. Your code is right! Thanks.
|
|
|
|
|
No need to apologise - you have done nothing wrong!
You are more than welcome.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
I think you must be a C# expert!
I just have studied C# for two weeks. I'm writting a programm that can define some hotkeys to input some fixed blocks of TeX code automatically.
As you see, I'm trying to replace some invalid characters so that the text blocks can be sended to the active window by "SendKeys.Send()".
I almost finished it.
Do you mind give me your MSN or ICQ? Maybe I can consult you sometimes.
|
|
|
|
|
Don't worry about MSN or ICQ - just ask here. Most of the regulars are experts, and we are generally here most days. Anyone of us will help, but generally we prefer to keep it public - that way other can learn at the same time.
You aren't doing too bad for two weeks into a course - keep it up
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
that's neat. And so is the compact alternative:
Regex regex = new Regex(@"([\+\^%{}])");
string source = @"+ --> {+}^ --> {^}% --> {%}{ --> {{}} --> {}}";
string result = regex.Replace(source, (m) => "{" + m.Value + "}");
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I keep forgetting about lambda expressions!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
And so is the more compact alternative:
var result = Regex.Replace("+^%{}", @"\+|\^|\%|\{|\}", "{${0}}");
var result = Regex.Replace("+^%{}", @"[\+\^%{}]", "{${0}}");
EDIT: Compacted further
|
|
|
|
|
aspdotnetdev wrote: @"\+|\^|\%|\{|\}"
I suppose this could be a little more compact, what with all the unnecessary escaping.
|
|
|
|
|
hi friends,
i am using a panel of which i want to increase the size to maximum of may be 20,000 X 20,000
how can i achieve this on runtime? It gives me error like
System.ComponentModel.Win32Exception: The operation completed successfully
at System.Windows.Forms.DibGraphicsBufferManager.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits)
at System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) etc..
actually i am working on zooming of image.. i am calculating the zoom percent and just increasing the width and height of panel and redrawing the image on it.. this works fine ..but when my panel size is set to above 12,000 X 8000 the system gives the above error..
thanks in advance
Samir
|
|
|
|
|
I just experimented subclassing Panel and it worked OK for me.
public class MyPanel : Panel
{
public static readonly Size DefaultMaxSize = new Size(20000, 20000);
protected override Size DefaultMaximumSize
{
get { return DefaultMaxSize; }
}
}
MyPanel myPanel = new MyPanel();
myPanel.Size = myPanel.Size = MyPanel.DefaultMaxSize;
Console.WriteLine(myPanel.Size);
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Try to disable double buffering, if you enable it.
It seems that Control class (and its subclasses) tries to create a bitmap as a back buffer of same size as the control.
|
|
|
|
|
Hey guys,
I have a MDI Windows app. The MDI Parent has a MenuStrip control with a few menu options
File > Merge index 1
- New > Merge index 101
- Open > Merge index 102
- Seperator > Merge index 198
- Exit Application > Merge index 199
I have a second form which is opened as MDI Child of the parent described above containing a MenuStrip as well and having the following menu items :
File > Merge action MatchOnly
- Seperator > Merge index 110 & MergeAction Insert
- Save > Merge index 111 & MergeAction Insert
- Save As > Merge index 112 & MergeAction Insert
The MenuStrip's Visible property is set to 'false'.
Now when I run my app, the parent's menu is displayed, everything fine. When I open the child window, the items Seperator, Save and Save As are neatly merged into the File menu of the MDI Parent, however the items are not ordered using the Merge Index, the items are appended at the bottom of the menu. How can I make the menu strip work with the Index so the menu items order is right?
Thanks for the help, keep up the good work!
|
|
|
|
|
I have a User control that contains three radio buttons - rbCirc, rbRect, and rbTrap - representing 3 possible shapes, and three textboxes for user values. I'm used to programs that automatically advance to the next item in the tab order when I press Enter, but I haven't been able to duplicate that behavior. Tab works as expected, but Enter just makes a "Bonk" sound, at least in the debugger. What can I do to make the focus advance when a user presses Enter?
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
In the KeyDown event for the form, see if the key hit is enter and if so, write code to proceed
|
|
|
|
|
I do not know how to avoid sound.
But you can achieve the behavior by tracking keypress event
private void radioButton1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
Yourcontrol.Focus();
}
}
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|