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
ugp
NA
11
0
Adding a Rectangle object to a Panel
May 25 2007 10:46 AM
I was able to add a button/label to a Panel like this; this.panel1.Controls.Add(this.button1); this.panel1.Controls.Add(this.label11); Works..OK! But, what I need is to add a Rectangle object to a Panel. I draw a Rectangle object; Graphics graph = this.CreateGraphics(); Pen penCurrent = new Pen(Color.Red); Rectangle Rect = new Rectangle(300, 50, 150, 75); graph.DrawRectangle(penCurrent, Rect); But when i do like this; this.panel1.Controls.Add(this.Rect); it gives an ERROR! ----- Says; Controls.Add() , works only for System.Windows.Forms.Control and CanNOT work with System.Drawing.Rectangle ----- So how can i achive this; add a Rectangle object to a Panel
Reply
Answers (
3
)
Resize a Rectangle at runtime
passing file name to a method; how do you create null values in a SQL server database via a C# program