473,785 Members | 2,317 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Invalidat e?
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 3572
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.Invalidat e?
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.Invalidat e?
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
20294
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 drawing on to a bmp file on my harddisk? C# code in this regard would be very helpful. I tried all forums but invain.
2
5870
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 mouse to move and resize, maybe rotate the inserted graphic object. 3b) Click on previously inserted objects and move/resize them as well 4) Save the entire thing as a bitmap
4
3178
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 window all graphs disapear. How can I maintain the graphics?
6
8593
by: SamSpade | last post by:
Public Function PicCreateGraphics() As Graphics 'Client should dispose this PicCreateGraphics = Graphics.FromImage(mDocumentImage) mPicCreateGraphicsSaved = PicCreateGraphics 'Saved so I can later check to see if it is still valid End Function
7
1743
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
2864
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 substitute ... at the end. This is where the wierdness sets in. Any time I remove or change some letters at the END of the text and draw, the spacing throughout the text string changes!!! So when I resize it in and out, the whole line looks like its...
1
8103
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 = (int)Math.Ceiling(g.MeasureString(this.Text, this.Font, this.Width - this.Padding.Left, StringFormat.GenericDefault).Height); Then override the onPaint and do this...
9
5067
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 passed. I'm struggling with making the delegate/invoke thing work, as I know GUI objects aren't thread-safe. I don't quite understand the concept I'm supposed to use to modify the GUI thread-safe. Below is my form and my Circle class. Currently,...
0
1052
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 for a toss. The Quality degrades. I can get back a better quality if I have a bigger window while locking and unlocking. But if I resize the quality degraded window to a bigger window, the quality is still worse. Any pointers to what all...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.