Click here to Skip to main content
15,886,578 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Can't close .NET application Pin
The Limey22-May-03 16:43
The Limey22-May-03 16:43 
GeneralRe: Can't close .NET application Pin
Tomas Petricek22-May-03 12:55
Tomas Petricek22-May-03 12:55 
GeneralRe: Can't close .NET application Pin
Piotr Mizera22-May-03 14:20
Piotr Mizera22-May-03 14:20 
GeneralEvent log entries… Pin
Ray Cassick20-May-03 17:30
Ray Cassick20-May-03 17:30 
GeneralRe: Event log entries… Pin
Richard Deeming21-May-03 8:55
mveRichard Deeming21-May-03 8:55 
GeneralDeployment queries Pin
Smitha Nishant20-May-03 0:32
protectorSmitha Nishant20-May-03 0:32 
General.NET control in Access Pin
SHaroz19-May-03 8:33
SHaroz19-May-03 8:33 
GeneralSerious .NET Bug Pin
Mike_V19-May-03 3:18
Mike_V19-May-03 3:18 
Okay. So maybe it is not so serious, but it appears to be a glaring mistake. This explains why group boxes, tab pages, check boxes, or any control cannot be made transparent by setting BackColor to Color.Transparent.

Get Anakrino[^] and take a look inside System.Windows.Forms.dll.

Navigate to System.Windows.Forms.Control::OnPaintBackground and see that it will call PaintBackground. Go to that method (still in Control class) and look at its code. Its code should start off with:
if (this.RenderTransparent)
    this.PaintTransparentBackground(e, rectangle);


All the private property RenderTransparent does is check if the backcolor is Color.Transparent. Anyway, now we get to the core of the problem: PaintTransparentBackground. Here is its code:
internal void PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle) 
{
    Graphics local0;
    Control local1;
    POINT local2;
    PaintEventArgs local3;
    GraphicsState local4;
    int local5;

    local0 = e.Graphics;
    local1 = this.ParentInternal;
    if (local1 != null) 
    {
        // If we have a parent, copy its client area
        local2 = new POINT();
        local2.y = (local5 = 0);
        local2.x = local5;
        UnsafeNativeMethods.MapWindowPoints(new HandleRef(this, this.Handle), new HandleRef(local1, local1.Handle), local2, 1);
        rectangle.Offset(local2.x, local2.y);
        local3 = new PaintEventArgs(local0, rectangle);
        local4 = local0.Save();

        try 
        {
            local0.TranslateTransform((float) -local2.x, (float) -local2.y);
            this.InvokePaintBackground(local1, local3);
            local0.Restore(local4);
            local4 = local0.Save();
            local0.TranslateTransform((float) -local2.x, (float) -local2.y);
            this.InvokePaint(local1, local3);
        }
        finally
        {
            local0.Restore(local4);
        }
    }

    // Here it is:
    // What was Microsoft thinking???!!!
    // After all that work, this just paints over it all!
    local0.FillRectangle(SystemBrushes.Control, rectangle);
}


Is this a true bug, or am I missing something?
Mike_V



Tech Support: "Do you have any windows open?"
Customer: "Are you crazy woman, it's twenty below outside..."

GeneralRe: Serious .NET Bug Pin
mikasa19-May-03 6:45
mikasa19-May-03 6:45 
GeneralLicensing and wrapping control Pin
Patrick Lassalle17-May-03 0:46
Patrick Lassalle17-May-03 0:46 
GeneralRe: Licensing and wrapping control Pin
Roger Alsing25-May-03 22:54
Roger Alsing25-May-03 22:54 
GeneralRe: Licensing and wrapping control Pin
Patrick Lassalle26-May-03 1:18
Patrick Lassalle26-May-03 1:18 
GeneralRe: Licensing and wrapping control Pin
Roger Alsing26-May-03 1:22
Roger Alsing26-May-03 1:22 
GeneralMetafile Creation Pin
16-May-03 11:09
suss16-May-03 11:09 
General.NET deployment Project probs Pin
16-May-03 11:05
suss16-May-03 11:05 
GeneralLogging On Pin
Jamie Nordmeyer16-May-03 7:41
Jamie Nordmeyer16-May-03 7:41 
GeneralRe: Logging On Pin
Daniel Turini16-May-03 11:21
Daniel Turini16-May-03 11:21 
QuestionHidden form? Pin
solidstore16-May-03 1:49
solidstore16-May-03 1:49 
GeneralLogging On Pin
Jamie Nordmeyer15-May-03 6:56
Jamie Nordmeyer15-May-03 6:56 
GeneralRe: Logging On Pin
leppie17-May-03 2:30
leppie17-May-03 2:30 
GeneralOld C++ Code Pin
Ingo7914-May-03 23:29
Ingo7914-May-03 23:29 
GeneralRe: Old C++ Code Pin
leppie16-May-03 12:12
leppie16-May-03 12:12 
GeneralRe: Old C++ Code Pin
Ingo7918-May-03 6:26
Ingo7918-May-03 6:26 
GeneralInstalling a Windows Service Pin
Jamie Nordmeyer13-May-03 6:36
Jamie Nordmeyer13-May-03 6:36 
GeneralRe: Installing a Windows Service Pin
Jamie Nordmeyer13-May-03 6:40
Jamie Nordmeyer13-May-03 6:40 

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.