|
|
Well, to be honest I was not completely sure about that.
How to do this correctly? I tried (word){0} , but that doesn't work.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You need to use a Negative Lookbehind.
(?<!brown)\s+fox
|
|
|
|
|
|
I have a c# program I've been writing which dynamically loads an image. It also dynamically loads an xml file which defines rectangles within the image. Each xml entry defines the upperleft coordinate on the image, and the width and height of the rectangle.
What I need to do, is create outlines on the picturebox for each entry in the xml file. I'm not sure how to do this.
Basically, over my loaded image, if there is an entry in the xml file, for example: 10,10, 50, 50 ...
I need to draw a rectangle (outline, or full but semitransparent) over the picturebox at coordinates 10,10 width a height of 50 and width of 50.
I've no idea where to start.
Any help?
Thanks.
|
|
|
|
|
Here is some code used in a paint event. If it is not in an event with PaintEventArgs you will need to get a Graphics object in another way.
private void Image_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Rectangle selRect = new Rectangle(0,0,0,0);
Graphics selGraphics = null;
int lineThickness = 2;
selGraphics = e.Graphics;
selRect.X = 10;
selRect.Y = 10;
selRect.Width=50;
selRect.Height=50;
Pen selPen = new Pen(Color.Black, lineThickness);
selGraphics.DrawRectangle(selPen, selRect);
}
|
|
|
|
|
I'm using a FileSystemWatcher to detect changes made to files in a shared directory and have the app update it's internal copy of them. Rarely it detects a change and attempts to open the file to read the update before the instance of the app doing the changes has closed the file and throws an exception. I'd like to have the app wait a few seconds, and then retry loading the file, but am not sure how to do so.
|
|
|
|
|
You can try using Thread.Sleep[^] to "wait" for a few seconds before retrying. Something like
while (conditionNotMet)
{
Thread.Sleep(time);
conditionNotMet = evaluateCondition();
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
That should work I guess, but I was hoping to keep the app singlethreaded for simplicity.
|
|
|
|
|
It still is single threaded, Thread.Sleep suspends the current thread for a particular amount of time.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I need to update a C# form with values read to it from another program in addition to changes from C# code while retaining the ability to edit text/combo boxes on a different part of the form from the updates. Right now, I can get the updates running, but am denied access to the form while the updates are occurring. How can I achieve this functionality?
|
|
|
|
|
Hi Guys,
How can we create an object for vb dll without reference and reflection in c#.
In VB.Net we have a method CreateObject(), but in C# we don't have such method. How can we achieve this in C#.
Raghuram
|
|
|
|
|
AFAIK, CreateObject also uses reflection like techniques to do its job.
I'm not sure how you can do without adding a reference, because C# is a statically typed language, which means that you have to have a type definition to compile.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
|
|
I have found a problem using Rhino (incidentally the same problem is occurring with NMock 1.1).
When I try to mock an interface which defines a method with a multi-dimensional array return type: creating the mock instance throws an error:
ClassLibrary1.SampleTest.MethodOnSampleTest_Rhino : System.TypeLoadException : Method MethodOnSample in type ProxyInterfaceSystemObject_ISample_IMockedObject_ISerializable from assembly DynamicAssemblyProxyGen, Version=0.0.0.0 does not have an implementation.
e.g.
namespace ClassLibrary1
{
public interface ISample
{
double[,] MethodOnSample(string StringArg);
}
}
using NMock;
using NUnit.Framework;
using Rhino.Mocks;
namespace ClassLibrary1
{
///
/// Summary description for SampleTest.
///
[TestFixture]
public class SampleTest
{
[Test]
public void MethodOnSampleTest_Rhino()
{
using (MockRepository mocks = new MockRepository())
{
ISample sample = (ISample) mocks.CreateMock(typeof(ISample));
Expect.Call(sample.MethodOnSample("Test"));
mocks.ReplayAll();
double[,] actual = sample.MethodOnSample("Test");
Assert.IsTrue(true);
}
}
[Test]
public void MethodOnSampleTest_NMock()
{
DynamicMock mock = new DynamicMock(typeof(ISample));
ISample mockInstance = (ISample) mock.MockInstance;
Assert.IsTrue(true);
}
}
}
Has anyone else experienced this problem and is there another mock object I can use to mock this interface?
Thanks.
[U-H]c0d3-m0nk3y
|
|
|
|
|
hi
my C#.net application has a Reminder pop up where a user enters reminder dates,name etc.
how do i make the reminder pop up from the date and time that it was set to?
here's what ive done
DataTable dtRemNow
conn=connection
SqlDatadapter da= new SqlDataAdapter("select * from reminders",conn);
da.fill(dtRemNow )
if(dtRemNow.Rows.Count > 0)
{
foreach(DataRow row1 in dtRemNow.Rows)
{
string strReminder = row1["rem date"].ToString;
if (strReminder .Length == 0) continue;
// get the date the reminder is due
DateTime dt = DateTime.Parse(strReminder);
TimeSpan tsRem = dt - DateTime.Now;
if(tsRem.TotalMilliseconds == 0)
{
}
}
}
dtRemNow.AcceptChanges();
if(dtRemNow.Rows.Count>0)
{
//show pop up for reminder
form.Popup(dtRemNow);
}
the pop up does not show
i would really appreciate if any of you can provide articles that include source code and examples
examples on creating reminder applications.
regards paula
|
|
|
|
|
This isn't quite a reminder application, but it might be useful for what you want to do.
http://www.codeproject.com/dotnet/ABTransClockArticle.asp[^]
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
i'm unable to use System.IO.IsolatedStorage.
How can i create a file into a temp volume?
|
|
|
|
|
You cannot create temporary volumes.
You can read up on Isolated Storage, with some how-to's, here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi guys,
I am trying to add my command bar in OutLook 2000 using dotnet. Do you have nay idea?
Thanks
|
|
|
|
|
Topic posted in the WebDev forum:
Topic
Please help...
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
Dario Solera wrote: Topic posted in the WebDev forum:
No, no, no, no, no, dont cross post, ever!
xacc-ide 0.0.99-preview5 now with C#, C, IL, XML, Nemerle, IronPython and Boo highlighting support!
|
|
|
|
|
Since I don't know if the problem is about web development or simple C#, I needed to cross post...
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|