TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dmitrij Solov
NA
43
6.6k
multiple classes
Feb 22 2017 1:48 PM
Hello,
I want to build a multiple class aplication containing a picturebox.
I want to call OnPaint-Event in this application.
During the debugging-execution I get the error-message "StackOverflowException was not managed"(Form1.Designer.cs; this.ResumeLayout(false)).
my code is the following:
Form1.Designer.cs
namespace
WindowsFormsApplication1
{
partial
class
Form1
{
///
/// Erforderliche Designervariable.
///
private
System.ComponentModel.IContainer components =
null
;
private
void
InitializeComponent()
{
this
.pictureBox1 =
new
System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(
this
.pictureBox1)).BeginInit();
this
.SuspendLayout();
//
// pictureBox1
//
this
.pictureBox1.Location =
new
System.Drawing.Point(12, 25);
this
.pictureBox1.Name =
"pictureBox1"
;
this
.pictureBox1.Size =
new
System.Drawing.Size(268, 229);
this
.pictureBox1.TabIndex = 0;
this
.pictureBox1.TabStop =
false
;
//
// Form1
//
this
.AutoScaleDimensions =
new
System.Drawing.SizeF(6F, 13F);
this
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this
.ClientSize =
new
System.Drawing.Size(292, 266);
this
.Controls.Add(
this
.pictureBox1);
this
.Name =
"Form1"
;
((System.ComponentModel.ISupportInitialize)(
this
.pictureBox1)).EndInit();
this
.ResumeLayout(
false
);
}
public
System.Windows.Forms.PictureBox pictureBox1;
}
}
Form1.cs
using
System;
using
System.Drawing;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1
{
public
partial
class
Form1 : Form
{
Form2 itsme;
public
Form1()
{
InitializeComponent();
itsme =
new
Form2();
}
}
}
Form2.cs
using
System;
using
System.Drawing;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1
{
class
Form2 : Control
{
Form1 itsme2;
public
Form2()
{
itsme2 =
new
Form1();
itsme2.pictureBox1.Paint +=
new
System.Windows.Forms.PaintEventHandler(
this
.OnPaint);
}
private
void
OnPaint(
object
sender, PaintEventArgs e)
{
MessageBox.Show(
"Hi"
);
}
}
}
If you can help me, many thanks.
Reply
Answers (
1
)
select all check boxes in grid using another checkbox
panel moving in windows form