Cheers
Daniel
--
http://www.danielmoth.com/Blog/
"Piotrek "Alchemik"" <alch...@autograf.pl> wrote in message
news:d4p0d3$jts$3...@news.onet.pl...
--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate
"Piotrek "Alchemik"" <alch...@autograf.pl> wrote in message
news:d4p0d3$jts$3...@news.onet.pl...
Great. I found a solutions in your blog how to pass a argument to through
invoke, but it's written in VB and i have no idea what is this:
Private Sub UpdateBox(ByVal sender As Object, ByVal e As EventArgs)
Dim o As Object SyncLock mDataQue.SyncRoot
If mDataQue.Count > 0 Then
o = mDataQue.Dequeue()
End If End SyncLock
' TODO use o
' cast o to your object/structure and
' use it to update the GUI
End Sub
Maybe somebody has a solution in C, C++, C#?
HINT: You must learn to at least read VB.NET
HINT 2: There are many online converters (and I don't mean other people :-)
Cheers
Daniel
--
http://www.danielmoth.com/Blog/
"Piotrek "Alchemik"" <alch...@autograf.pl> wrote in message
news:d4p2uq$2ab$1...@news.onet.pl...
Ok i found one, i think i'll try this later this evening.
Thank u.
private void button1_Click(object sender, System.EventArgs e)
{
starter1 = new ThreadStart(akcja);
t1 = new Thread(starter1);
t1.Start();
}
private void akcja()
{
ln.a="zmiana";
this.Invoke(new EventHandler(Zmiana));
Console.WriteLine(ln.a);
}
private void Zmiana (Object o, EventArgs e)
{
this.label1.Text = ln.a;
}
}
public class Linia
{
public String a;
Linia()
{
a="cos";
}
}
}
And the problem is that is not working. Maybe i'm doing something wrong?
Debugger told me that the problem is with line
this.label1.Text = ln.a;
If anybody could help me i'd be greatfull
Thanks in advance
I don't see where you create the object... maybe you should change the
declaration line to:
public Linia ln = new Linia();
Also you'll have to make the constructor of Linia public:
public Linia() {
Cheers
Daniel
--
http://www.danielmoth.com/Blog/
"Piotrek "Alchemik"" <alch...@autograf.pl> wrote in message
news:d4so4u$skp$2...@news.onet.pl...
Yes, indeed in this case it works perfect, but in my more complicated example i
have the same problem wharever i create that public or not. I pass elements to
invoke function, maybe there is somethin wrong with onpaint function from the
line class?
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
if (xLeft <= xRight)
{
Left = xLeft;
}
else
{
Left = xRight;
}
if (yLeft <= yRight)
{
Top = yLeft;
}
else
{
Top = yRight;
}
SolidBrush brush = new SolidBrush(this.Parent.BackColor);
e.Graphics.FillRectangle(brush, 0, 0, this.Width, this.Height);
Pen pen = new Pen(_color);
if (xLeft < xRight & yLeft < yRight)
{
e.Graphics.DrawLine(pen, 0, 0, this.Width, this.Height);
}
else if (xLeft > xRight & yLeft < yRight)
{
e.Graphics.DrawLine(pen, this.Width, 0, 0, this.Height);
}
else if (xLeft > xRight & yLeft > yRight)
{
e.Graphics.DrawLine(pen, this.Width, this.Height, 0, 0);
}
else if (xLeft < xRight & yLeft > yRight)
{
e.Graphics.DrawLine(pen, 0, this.Height, this.Width, 0);
}
}
And when i'm debugging my program stopped with
An unhandled exception of type 'System.ArgumentException' occurred in
System.Windows.Forms.dll
Additional information: ArgumentException when i'm trying to add my ln to
Controls. I have no other idea what else?