Click here to Skip to main content
15,886,963 members
Home / Discussions / C#
   

C#

 
QuestionHow to get the selected ToolStripeItem Pin
neus8321-Jul-09 7:48
neus8321-Jul-09 7:48 
AnswerRe: How to get the selected ToolStripeItem Pin
DaveyM6921-Jul-09 9:43
professionalDaveyM6921-Jul-09 9:43 
GeneralRe: How to get the selected ToolStripeItem Pin
neus8321-Jul-09 21:45
neus8321-Jul-09 21:45 
GeneralRe: How to get the selected ToolStripeItem Pin
DaveyM6921-Jul-09 22:17
professionalDaveyM6921-Jul-09 22:17 
QuestionQ in query wizard Pin
mohammad alnoed21-Jul-09 5:59
mohammad alnoed21-Jul-09 5:59 
AnswerRe: Q in query wizard Pin
Christian Graus21-Jul-09 10:19
protectorChristian Graus21-Jul-09 10:19 
GeneralRe: Q in query wizard Pin
mohammad alnoed21-Jul-09 21:51
mohammad alnoed21-Jul-09 21:51 
Question[Solved] Clearing control of graphics before painting [modified] Pin
Jordanwb21-Jul-09 4:58
Jordanwb21-Jul-09 4:58 
I have a class called CardHolder which extends UserControl. I have overrode its OnPaint function like so:

protected override void OnPaint(PaintEventArgs e)<br />
{<br />
    base.OnPaint(e);<br />
<br />
    Graphics g = e.Graphics;<br />
<br />
    foreach (Card c in this.Controls)<br />
    {<br />
        g.DrawImage(c.Image, c.Location);<br />
    }<br />
}


Each image is tied to a Control which has been added to this control. Each image is a partially transparent image which is partially overlaid another image. However, each time the OnPaint function is called, it doesn't clear the Control of what was there before:

Good: http://img20.imageshack.us/i/goodw.jpg/[^]

Oh dear: http://img24.imageshack.us/i/ohdearz.jpg/[^]

I've hooked into the CardHolder's Resize event and call PositionCards in that function to position the Controls, which in turn calls OnPaint behind the scenes. I hope what I'm doing here makes sense to you guys. How do I clear the Control of the previously drawn images?

Card extends UserControl as well but is transparent and has no child controls.

modified on Tuesday, July 21, 2009 12:36 PM

AnswerRe: Clearing control of graphics before painting Pin
Nagy Vilmos21-Jul-09 5:22
professionalNagy Vilmos21-Jul-09 5:22 
GeneralRe: Clearing control of graphics before painting [modified] Pin
Jordanwb21-Jul-09 5:38
Jordanwb21-Jul-09 5:38 
QuestionHow to Pass Crystal Reports Parameter Pin
Ahmed Khallaf21-Jul-09 4:21
Ahmed Khallaf21-Jul-09 4:21 
AnswerRe: How to Pass Crystal Reports Parameter Pin
Nagy Vilmos21-Jul-09 5:18
professionalNagy Vilmos21-Jul-09 5:18 
GeneralRe: How to Pass Crystal Reports Parameter Pin
Ahmed Khallaf21-Jul-09 5:37
Ahmed Khallaf21-Jul-09 5:37 
QuestionInheritance Pin
loupceuxl21-Jul-09 4:11
loupceuxl21-Jul-09 4:11 
AnswerRe: Inheritance Pin
PIEBALDconsult21-Jul-09 4:16
mvePIEBALDconsult21-Jul-09 4:16 
QuestionCalculation of Efficiency using Microsoft Solver Foundation Pin
Anuj Chauhan from India21-Jul-09 3:47
Anuj Chauhan from India21-Jul-09 3:47 
QuestionGet file path hosted by an Excel process Pin
Muneeb Abdul Shakoor21-Jul-09 3:38
Muneeb Abdul Shakoor21-Jul-09 3:38 
AnswerRe: Get file path hosted by an Excel process Pin
Brij21-Jul-09 3:45
mentorBrij21-Jul-09 3:45 
GeneralRe: Get file path hosted by an Excel process Pin
Muneeb Abdul Shakoor21-Jul-09 3:57
Muneeb Abdul Shakoor21-Jul-09 3:57 
GeneralSystem.Timers.Timer doesn't stop with Stop() Pin
SimpleData21-Jul-09 2:24
SimpleData21-Jul-09 2:24 
GeneralRe: System.Timers.Timer doesn't stop with Stop() Pin
Abhishek Sur21-Jul-09 2:55
professionalAbhishek Sur21-Jul-09 2:55 
GeneralRe: System.Timers.Timer doesn't stop with Stop() Pin
SimpleData21-Jul-09 2:58
SimpleData21-Jul-09 2:58 
GeneralRe: System.Timers.Timer doesn't stop with Stop() Pin
stancrm21-Jul-09 3:18
stancrm21-Jul-09 3:18 
GeneralRe: System.Timers.Timer doesn't stop with Stop() Pin
DoctorMick21-Jul-09 3:18
DoctorMick21-Jul-09 3:18 
GeneralRe: System.Timers.Timer doesn't stop with Stop() Pin
SimpleData21-Jul-09 3:19
SimpleData21-Jul-09 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.