|
I am drawing a polygon by drawing lines on mouseup. after closing the figure the two points are not behaving as one.
Where did i went wrong.
Any help
|
|
|
|
|
Begineer wrote:
after closing the figure the two points are not behaving as one
This is really vague. What do you mean by "not behaving as one"?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry for not being able to explain my problem better.
I am drawing a polygon by positioning the mouse. when i choose the option close figure i am drawing a line from the current point to starting point.
After that it is not behaving as a closed figure. when i tried to drag i am able to drag two differnet lines on that last point.
Am i making sense.
|
|
|
|
|
Begineer wrote:
After that it is not behaving as a closed figure. when i tried to drag i am able to drag two differnet lines on that last point.
Try to drag what? One of the lines? Points? It sounds like your code isn't picking the correct points in your point array. Without seeing your drawing and dragging code, it's very difficult to say anything more.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Anyone know how to tell .NET to use another directory than /bin when it looks for referenced assemblies
I use "copy local" for all references ..... but want them to be copied into "bin/assemblies" for ex.
Anyone?
//Maw
|
|
|
|
|
Hello
You can try to use privatePath attribute. Look here[^].
With best regards,
Andrew
|
|
|
|
|
I'm currently working on a chart library project and encountered a conceptual problem touching interfaces, inheritance...
Facts first:
A so-called mapper class is responsible for mapping problem domain values to units (in terms of pixels). As there are different problem domains, there are different mapper classes, e.g.:
- MathMapper (numeric problem domain)
- TimeMapper (time domain)
- LabelMapper (non numeric domain)
This concept is implemented as follows. A interface called IMapper defines methods and properties all mappers have in common. (object globalMinimum, object globalMaximum, int minorUnitsPerMajorUnit, double pixelsPerUnit, double World2Unit(object obj)...).
Several interfaces are derived from IMapper to descripe specific mappers: IMathMapper, ITimeMapper, ILabelMapper. The derived interfaces define properties in terms of the problem domain:
- IMathMapper (double globalMinimum, globalMaximum...)
- ITimeMapper (TimeSpan globalMinimum, globalMaximum...)
...
This is the crucial factor: globalMinimum, globalMaximum... are defined in terms of the PROBLEM DOMAIN.
Classes implement the interfaces using explicit interface implementation thereby hiding the more general properties (object globalMinimum, object globalMaximum) and exposing the specific properties (double globalMinimum/TimeSpan globalMinimum...).
The properties mentioned so far should be known by the user (of the chart library) in advance. However for creating axes of dynamic range, the Maximum of a data series should be determined and stored in the mapper object (as MaxValue). Determing the maximum value is straightforward.
Given a series of data object[] dataSeries = new object[x] {12.9, 23.2, ...} the method World2Unit(object obj) of the underlying mapper object is invoked for each value, hence the maximum value can derived easily.
The challenge:
Problems arise when storing this maximum value in the mapper object. Currently this involves several type casts - not satisfying me. One has to distinguish between all possible mapper objects in order to store the value "problem domain dependent". Is there a way to avoid this discrimination? Sound solution needed!
Currently:
<br />
if (this.Mapper = MathMapper)<br />
{<br />
MathMapper math = (MathMapper) this.Mapper; <br />
math.MaxValue = (double) maximum; <br />
}<br />
else if (this.Mapper = TimeMapper)<br />
{<br />
TimeMapper time = (TimeMapper) this.Mapper; <br />
time.MaxValue = (TimeSpan) maximum; <br />
}<br />
else<br />
{<br />
each Mapper has to be listed.<br />
}
As it is my first major project and I'm not that experienced, could you please assist me in finding a better solution?
Thanks in advance!
Goebel
|
|
|
|
|
|
i wrote this code to create a marker file("TMP.txt) on another PC.
try
{
FileInfo TMPfile = new FileInfo(@"\\TERM1\\BOOTDRV\\TMP\\TMP.txt");
StreamWriter w = TMPfile.CreateText() ;
w.Close();
}
catch(Exception exp)
{
EventLog.WriteEntry(exp.Message);
}
Access to the path "\\Term1\\BOOTDRV\\TMP\\TMP.txt" is denied.
i wrote the same code in Windows Application and it's creating tmp.txt on term1.
*************
so with windows app i have access but not with windows services ?????
Please need help.
|
|
|
|
|
|
Windows Services, by default, run under the Local System account, which has no rights to any network resources on any machine. If you want your service to be able to get to a shared network resource, you'll have to change the account that the service runs under.
Right-click "My Computer" and click Manage. In the left pane of the MMC, expand Services and Applications. Click Services, then find your service in the right pane and double-click it. Click on the LogOn tab, then click on "This account". Type in the account name and password of an account that has permissions to the share you want the service to be able to get to, then click OK.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can someone please tell me how to call a C/C++ function that is in a .c or .cpp file from C#?
|
|
|
|
|
Hello
If the function is written on C, you can create a DLL exporting this function. Than you can interop it in C# using DllImport .
With best regards,
Andrew
|
|
|
|
|
Thanks Andrew,
And the same if it's written in C++?
Can you please guide me to an article or so,so I can follow it step by step?I have never tried creating a C++ dll before?
Thanks and Best Regards,
E.A.
|
|
|
|
|
You can browse this[^] site for question about interoping API or other functions.
It's not simple to use C++ dll from C#. More of it, there is no approaches for it known to me.
If you have a C++ class you can try to use it with MC++ (Managed C++) using IJW (it just works) technology.
With best regards,
Andrew
-- modified at 7:44 Tuesday 13th September, 2005
|
|
|
|
|
Thanks for trying to help out.
I have heard about MC++ but I havent' heard about IJT. Does this mean that after using my class with MC++ that I can call it directly from .NET or what?
Best Regards,
E.A.
|
|
|
|
|
Oh, sorry me very much. It's called IJW - "it just works"
Look here[^] and here[^].
You can create a library on MC++ and use it from C# as any other .NET assembly.
With best regards,
Andrew
|
|
|
|
|
Thanks a lot Andrew,
Hope this might help me sort it out.
Best Regards,
E.A.
|
|
|
|
|
Anyone know how to access the scroll bars in a .NET TextBox control? I'm trapping the VScroll event which works fine except for when the user drags the scroll thumb, which for some reason doesn't fire the event. The only way I can think of is to trap the event at the ScrollBar level, but there doesn't appear to be a way to get hold of them programmatically.
TIA
Ian.
|
|
|
|
|
Do you mean that you want to handle event fired when the user drag the scroll thumb?
MCAD
|
|
|
|
|
Thanks for your reply - yes, that's what I wanted to do. I think I've found the solution (although you may know a better way), by overriding WndProc in the TextBox as demonstrated in Help:
protected override void WndProc(ref Message m)
{
base.WndProc(ref m); // Do first to fire the event after the text has scrolled
// Listen for operating system messages.
switch (m.Msg)
{
case WM_VSCROLL:
short shtNotif = (short)((int)m.WParam & 0xffff);
if (shtNotif == SB_THUMBPOSITION ||
shtNotif == SB_THUMBTRACK)
{
this.OnVScroll(new System.EventArgs());
}
break;
}
}
Ian.
|
|
|
|
|
good you found the solution
this was what i will suggest if you didn't found the solution to override WndProc and catch WM_VSCROLL so this only solution i know
MCAD
|
|
|
|
|
Any pointers, suggestions, links, hints on making an enterprise app database independent... Thanks…
Salil Khedkar [^]
|
|
|
|
|
there are many O/R Mappers which try to be database indpendent they differ of the number of database they support there some free like NHibernate[^]
try to google O/R Mapping
MCAD
|
|
|
|
|
Here is a small example which i did,
Create a form with button, label, textbox, and progressbar on it (I just use the default names in this example).
Create two methods on the form, one that updates the label, and one that updates the progress bar.
Code:
private void UpdateLabel()
{
label1.BackColor=Color.Red;
}
private void UpdateProgress()
{
progressBar1.PerformStep();
}
Create a class that does the thread work, in this case it will start a timer, and invoke methods above for the form each time the timer elapses.
Code:
private class ThreadRunner
{
private Form1 _form;
private int _delay;
private System.Threading.Timer _timer;
public ThreadRunner(Form1 mainForm,int delayInSeconds)
{
_form=mainForm;
_delay=delayInSeconds;
}
public void Go()
{
_timer=new System.Threading.Timer(new TimerCallback(this.TimerElapsed),null,0,10);
while (_timer!=null)
Thread.Sleep(0); // Do nothing until timer has stopped
}
public void TimerElapsed(object o)
{
_delay--;
_form.Invoke(new MethodInvoker(_form.UpdateProgress));
if (_delay<=0)
{
_form.Invoke(new MethodInvoker(_form.UpdateLabel));
_timer.Dispose();
_timer=null;
}
}
}
Add code to start an object of the class defined above:
Code:
private void button1_Click(object sender, System.EventArgs e)
{
int timeToRun=Int32.Parse(textBox1.Text);
progressBar1.Maximum=timeToRun;
progressBar1.Step=1;
ThreadRunner tr=new ThreadRunner(this,timeToRun);
Thread t=new Thread(new ThreadStart(tr.Go));
t.Start();
}
Inthis u can see that for a specify seconds in the textbox, ,label glows red after the progress bar completes.
so now wht i need is that to do another thing in the above example,that is ..that giving a time in
the text box....say 3:00 pm....
then the label should turn red at 3:00pm..
i mean giving the system timing ,... then we should give a time in the text box,
then the button click property should be done at the specified time in the text box.
how can i do this in the above method....please can u help me to do this.
js
-- modified at 3:39 Tuesday 13th September, 2005
|
|
|
|