Click here to Skip to main content
15,894,646 members
Home / Discussions / C#
   

C#

 
AnswerRe: Deleting multiple values from the grid view and database table using windows form in C#. Pin
Mycroft Holmes21-Jul-09 14:57
professionalMycroft Holmes21-Jul-09 14:57 
Questionhow use the clear Pin
neha_rai21-Jul-09 10:31
neha_rai21-Jul-09 10:31 
AnswerRe: how use the clear Pin
Blue_Boy21-Jul-09 10:42
Blue_Boy21-Jul-09 10:42 
GeneralRe: how use the clear Pin
neha_rai21-Jul-09 10:49
neha_rai21-Jul-09 10:49 
GeneralRe: how use the clear Pin
0x3c021-Jul-09 11:01
0x3c021-Jul-09 11:01 
GeneralRe: how use the clear Pin
neha_rai21-Jul-09 11:49
neha_rai21-Jul-09 11:49 
GeneralRe: how use the clear Pin
Christian Graus21-Jul-09 11:01
protectorChristian Graus21-Jul-09 11:01 
GeneralRe: how use the clear Pin
neha_rai21-Jul-09 11:46
neha_rai21-Jul-09 11:46 
GeneralRe: how use the clear Pin
Christian Graus21-Jul-09 13:01
protectorChristian Graus21-Jul-09 13:01 
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 

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.