Graphics disappearing
Graphics disappearing
Graphics disappearing
Graphics disappearing
Graphics disappearing
Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing
Graphics disappearing Graphics disappearing
Graphics disappearing
Go Back  Xtreme Visual Basic Talk > > > Graphics disappearing


Reply
 
Thread Tools Display Modes
  #1  
Old 09-12-2012, 05:33 AM
gnappi gnappi is offline
Freshman
 
Join Date: Mar 2006
Posts: 33
Default Graphics disappearing


I wrote a series of VGA test patterns for projectors and it works flawlessly, however my problem is (not a big one) that the last screen has test patterns made of graphic elements that are "erased" if any window like the calculator is opened on top of the test window. All of the text or buttons stay put.

I can live with the issue but I would really prefer to keep the graphic elements nailed to the screen. Any ideas?

Here's a snippet of what is disappearing, it's a segment of a graduated greyscale


Dim Brush As New SolidBrush(Color.FromArgb(opacity, fill_color + 32, fill_color + 32, fill_color + 32))
myGraphics.FillRectangle(Brush, 160, 30, rectangle_width, rectangle_height)

Last edited by gnappi; 09-12-2012 at 05:48 AM.
Reply With Quote
  #2  
Old 09-12-2012, 06:25 AM
AtmaWeapon's Avatar
AtmaWeaponGraphics disappearing AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

I'm going to make a psychic guess. Do you call CreateGraphics() at all? Show us your Paint event handler and I bet the answer will be clear.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 09-12-2012, 06:34 AM
DrPunk's Avatar
DrPunkGraphics disappearing DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

That's a tad cryptic AtmaWeapon.

What I think AtmaWeapon is alluding to is that it's important where you do your drawing. Ideally you want to be drawing in a Paint event. I think AtmaWeapon would like to know where you do your drawing.

On a different point entirely, you mention Graduated but are using a SolidBrush (I assume you draw more than once with different coloured SolidBrushes to get the gradient). Have you considered using the Drawing2D.LinearGradientBrush? Because that does grading itself (you give it two colours, the area to paint to and it does the rest).
__________________
There are no computers in heaven!
Reply With Quote
  #4  
Old 09-12-2012, 08:02 AM
passel's Avatar
passelGraphics disappearing passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

Quote:
Originally Posted by DrPunk View Post
That's a tad cryptic AtmaWeapon.
...
Yes, it may be, but I understand the sentiment, since this is the #1 question in most .Net Graphics related FAQs.

I'm pretty sure if the person did a search on "Graphics Disappearing" instead of posting yet another common question, the issue could have been resolved quicker and quieter.

What comes to mind when I hear this question for the umpteenth time is something along the lines of "I guess 2 + 2 = 5, but all the rest of my math is having issues."
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.

Last edited by passel; 09-12-2012 at 08:11 AM.
Reply With Quote
  #5  
Old 09-12-2012, 11:52 AM
AtmaWeapon's Avatar
AtmaWeaponGraphics disappearing AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

I didn't want to explain the problem without knowing more than a couple of lines of drawing code that gives me no context information.

The short answer is if you're using CreateGraphics() to create myGraphics, it's almost certainly the wrong thing except in some very specific scenarios. It is almost always the right thing to draw from the Paint event using the Graphics that gives you. In fact, if you're using CreateGraphics(), the solution to "stuff disappears sometimes" is "handle the Paint event" so it's best to start there.

But I'd like to see more of what you're doing so someone can make a more specific example. There's lots to think about when painting, and the more we know the better the answer can be.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Graphics disappearing
Graphics disappearing
Graphics disappearing Graphics disappearing
Graphics disappearing
Graphics disappearing
Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing Graphics disappearing
Graphics disappearing
Graphics disappearing
 
Graphics disappearing
Graphics disappearing
 
-->