Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

@#$%^&* ... Graphics!

Posted on 2004-10-10
8
Medium Priority
?
249 Views
Last Modified: 2011-10-03
Here's a small sample C# app which demonstrates the problem.
http://www.qpop.com/RokSizPap.zip

This is my first attempt at an OO graphics game using .NET .... This stuff is driving me NUTS!
How do I make a manually drawn image ...

     Persist when overlayed by another window (WITHOUT FLICKER)?
     Resize when needed?
     Scroll within a form if a certain minimum size (800x600) is reached?

I've tried everything I can think of.
    Using: the Form only, a Panel, a Picture box
    Using: Paint event and/or Resize event

BTW ...
I'm working on building an computerized version of this game for eventual on-line playing
http://www.qpop.com/RSP.zip

It's taken a LOT of help from the EE-Math & Science guys to get this far!

P.S. This is not "THE" Qpop project discussed in the lounge. This is just me ... relaxing and playing.
0
Comment
Question by:volking
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
8 Comments
 
LVL 10

Expert Comment

by:ptmcomp
ID: 12270577
The problem is that you set the control styles on the form but you draw on the panel. If you set the control styles on the panel it should be already much better.
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 12270589
And you should use the Graphics object obtained by the PaintEventArgs instead of creating your own.
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 12270647
You should not change the size of the panel inside the Paint event. This causes serious problems. You can override the OnResize method to resize the control.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:ptmcomp
ID: 12270883
Then try to seperate the calculations that are based on the resizing from the paint algorithm. Cache the calculations for the next paint event. And don't paint inside a constructor.
0
 
LVL 5

Author Comment

by:volking
ID: 12271724
@ ptmcomp - I'll try everything you suggest and let you know.  thanks for the advice.
0
 
LVL 10

Accepted Solution

by:
ptmcomp earned 2000 total points
ID: 12271863
To change the control styles of the panel you will need to derrive your own class from Panel and use it instead of the standard panel class. If you want to avoid this then remove the panel and paint directly on the Form.
0
 
LVL 5

Author Comment

by:volking
ID: 12271896
I did derive my own class from panel (as you advised) and I followed all the rest of your advice and .... SHAZAAAAM!

Worked like a beautiful thing ...

Many Thanks!
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 12271994
BTW: You can optimize more when your checking the e.ClipRectangle of the PaintEventArgs. If the object you are going to paint is completely outside of this Rectangle, it will not be drawn anyway and you can skip painting it. E.g. when part of your control was covered by a window and gets visible again, only that part is redrawn.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question