473,382 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Graphics and resize problem

Hi guys,

I have a question to VB .NET: I add a Graphics object to a panel and use
a bunch of DrawLine methods etc (it's really nice and convenient).

But: As soon as I send my form (which contains the panel) to the task
bar and get it back, the graphics are gone.
I guess that I need to add an event handler to the pane (or the form?),
but which event do I have to handle? And which method do I call on the
panel to get it repainted? Panel.Invalidate?
I have the same problem if I resize the form containing the panel - If I
make it smaller such that some of the graphics disappear, they are gone
if I make it bigger again.

One more question: I would like my panel to resize itself if the form
whicht contains it gets resized (e.g. maximized). How can I do this? I'm
actually not sure if this is related to the problem above (maybe the
panel grows, but my graphics just don't get repainted :-)

Sorry if those questions are stupid, but I'm new to VB .NET and to UI
programming...

Thankx in advance,
Christian
Nov 20 '05 #1
2 3553
Hi,

If you want the panel to redraw the graphics draw your lines in the
paint event. To get your control to resize itself look at the panels anchor
property.

Ken
-----------------
"Christian Soltenborn" <no*****************@web.de> wrote in message
news:c5************@ID-36219.news.uni-berlin.de...
Hi guys,

I have a question to VB .NET: I add a Graphics object to a panel and use
a bunch of DrawLine methods etc (it's really nice and convenient).

But: As soon as I send my form (which contains the panel) to the task
bar and get it back, the graphics are gone.
I guess that I need to add an event handler to the pane (or the form?),
but which event do I have to handle? And which method do I call on the
panel to get it repainted? Panel.Invalidate?
I have the same problem if I resize the form containing the panel - If I
make it smaller such that some of the graphics disappear, they are gone
if I make it bigger again.

One more question: I would like my panel to resize itself if the form
whicht contains it gets resized (e.g. maximized). How can I do this? I'm
actually not sure if this is related to the problem above (maybe the
panel grows, but my graphics just don't get repainted :-)

Sorry if those questions are stupid, but I'm new to VB .NET and to UI
programming...

Thankx in advance,
Christian

Nov 20 '05 #2
Draw graphics in a bitmap and display that bitmap

Christian Soltenborn wrote:
Hi guys,

I have a question to VB .NET: I add a Graphics object to a panel and use
a bunch of DrawLine methods etc (it's really nice and convenient).

But: As soon as I send my form (which contains the panel) to the task
bar and get it back, the graphics are gone.
I guess that I need to add an event handler to the pane (or the form?),
but which event do I have to handle? And which method do I call on the
panel to get it repainted? Panel.Invalidate?
I have the same problem if I resize the form containing the panel - If I
make it smaller such that some of the graphics disappear, they are gone
if I make it bigger again.

One more question: I would like my panel to resize itself if the form
whicht contains it gets resized (e.g. maximized). How can I do this? I'm
actually not sure if this is related to the problem above (maybe the
panel grows, but my graphics just don't get repainted :-)

Sorry if those questions are stupid, but I'm new to VB .NET and to UI
programming...

Thankx in advance,
Christian


Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vin | last post by:
Hi, I am using the following code to draw whatever the user draws using x,y. // draws lines directly on a winform. CreateGraphics().DrawLine(APen, x, y, OldX, OldY); Now how do I save the...
2
by: queisser | last post by:
I need some basic graphics object functionality for my app. What I'd like to do is this: 1) Start with an empty graphics "surface" 2) Paste or insert-from-file metafiles or bitmaps 3a) Use the...
4
by: Dafü | last post by:
Hello! I have an application that paint graphics in VB.NET. Each graphic is painted after a long calculation process. My problem is when another windows pass over my graphics or I resize the...
6
by: SamSpade | last post by:
Public Function PicCreateGraphics() As Graphics 'Client should dispose this PicCreateGraphics = Graphics.FromImage(mDocumentImage) mPicCreateGraphicsSaved = PicCreateGraphics 'Saved so I can...
7
by: Delme Greening | last post by:
I have an empty project with a button on a form. What code do I need to put behind the button to draw a rectangle on my form when it is clicked?
3
by: Allen | last post by:
I've got a control that you can resize the contents of one of the text fields inside it. When the contents are resized to smaller than the text, I remove some of the end of the text and...
1
by: Nathan Laff | last post by:
I have a custom label, that as the width changes, the height will change to fit all the text in the label... I use to do this like this... int newHeight =...
9
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has...
0
by: RajaSS | last post by:
Hi, I have a windowed mode graphics application which uses OpenGL and Directx3D. Though the quality of the graphics and text I have is very good intially, once I lock and unloack my system it goes...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.