Author Topic: Possible Bug In VC19  (Read 9859 times)

0 Members and 1 Guest are viewing this topic.

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2003
    • www.zapsolution.com
Re: Possible Bug In VC19
« Reply #30 on: November 25, 2016, 01:43:11 PM »
About the transparent border section, i am using exactly the same concept when running WinLIFT with a composited Skin.
it is based on the use of transparent png components, and this allows me to create shadow or Hallo effects.

This is clearly visible on this WinLIFT screenshot



This is the reason why i have always considered the client size when skinning a window rather than its WindowRect, because i knew that it is changing from one OS to another.

Since VISTA i have always used DWM, and the Device Window Manager API allows me to create any Skin i could imagine with full variable opacity, as you can see on the caption of the screenshot.

WinLIFT has its own skGetSystemMetrics API to retrieve the correct size of its non-client parts.
And notice the use of SK_DWM_LEFT, SK_DWM_TOP, SK_DWM_RIGHT, SK_DWM_BOTTOM.

Code: [Select]
long skGetSystemMetrics (IN long nMeasure) { // dllexport

    if ((nMeasure > -1) || (nMeasure < SKMETRIC_UB)) {
        long xWidth, yHeight, CyCaption, CxFrameLeft, CxFrameRight, CyFrameBottom, CxFrame, CyMenu;
       
        switch (nMeasure) {
        case SK_CYCAPTION:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CYCAPTION"));
                if (g_nMetrics[nMeasure] == 0) {
                   skGetBitmapSize(g_CaptionM, xWidth, CyCaption);
                   g_nMetrics[nMeasure] = CyCaption;
                }
             }
             break;
        case SK_CYMENU:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                skGetBitmapSize(g_MenuBar, xWidth, CyMenu);
                g_nMetrics[nMeasure] = CyMenu;
             }
             break;
        case SK_CYSTATUS:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = 0;
                if (CheckStyle(skWindowStyle(0), SK_STATUSBAR)) {
                   g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CYSTATUS"));
                }
             }
             break;
        case SK_CXFRAMELEFT:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CXFRAMELEFT"));
                if (g_nMetrics[nMeasure] == 0) {
                   skGetBitmapSize(g_SideL, CxFrameLeft, yHeight);
                   g_nMetrics[nMeasure] = CxFrameLeft;
                }
             }
             break;
        case SK_CXFRAMERIGHT:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CXFRAMERIGHT"));
                if (g_nMetrics[nMeasure] == 0) {
                   skGetBitmapSize(g_SideR, CxFrameRight, yHeight);
                   g_nMetrics[nMeasure] = CxFrameRight;
                }
             }
             break;
        case SK_CYFRAMEBOTTOM:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CYFRAMEBOTTOM"));
                if (g_nMetrics[nMeasure] == 0) {
                   skGetBitmapSize(g_BottomM, xWidth, CyFrameBottom);
                   g_nMetrics[nMeasure] = CyFrameBottom;
                }
             }
             break;
        case SK_CXSIZE:     // Dimension of caption button in pixels
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CXSIZE"));
             }
        case SK_CYSIZE:     // Dimension of caption button in pixels
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CYSIZE"));
             }
             break;
        case SK_CXSYSBUT:   // Right X seed for system buttons
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CXSYSBUT"));
                if (g_nMetrics[nMeasure] == 0) {
                   skGetBitmapSize(g_SideL, CxFrame, yHeight);
                   g_nMetrics[nMeasure] = CxFrame;
                   if (g_nMetrics[nMeasure] == 0) { g_nMetrics[nMeasure] = 6; }
                }
             }
             break;
        case SK_CYSYSBUT:     // Right Y seed for system buttons
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CYSYSBUT"));
             }
             break;
        case SK_CXCAPTEXT:    // X coordinate for Caption text
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CXCAPTEXT"));
             }
             break;
        case SK_CYCAPTEXT:    // Y coordinate for Caption text
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CYCAPTEXT"));
             }
             break;
        case SK_XBUT3DBORDER: // Horizontal non stretched button border
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"XBUT3DBORDER"));
             }
             break;
        case SK_YBUT3DBORDER: // Vertical non stretched button border
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"YBUT3DBORDER"));
             }
             break;
        case SK_CXSYSICON:    // X seed for system icon
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CXSYSICON"));
             }
             break;
        case SK_CYSYSICON:    // Y seed for system icon
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CYSYSICON"));
             }
             break;
        case SK_CXSYSLED:     // X coordinate for Caption led
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CXSYSLED"));
             }
             break;
        case SK_CYSYSLED:     // Y coordinate for Caption led
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"CYSYSLED"));
             }
             break;
        case SK_TRANSLUCENCY: // Translucency
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"TRANSLUCENCY"));
                if (g_nMetrics[nMeasure] == 0) { g_nMetrics[nMeasure] = 50; }
             }
             break;
        case SK_MENUTRANSLUCENCY: // Menu translucency percentage
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"MENUTRANSLUCENCY"));
                if (g_nMetrics[nMeasure] == 0) { g_nMetrics[nMeasure] = 100; }
             }
             break;
        case SK_PAINT_BORDER:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"PAINT_BORDER"));
             }
             break;
        case SK_PAINT_BACKGROUND:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"PAINT_BACKGROUND"));
             }
             break;
        case SK_ICONSIZE:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = max(LongVAL(skLoadString(L"ICONSIZE")), 16);
             }
             break;
        case SK_OUTER_GLOW:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"OUTER_GLOW"));
             }
             break;
        case SK_SKIN_ICON:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"SKIN_ICON"));
             }
             break;
        case SK_DWM_AERO:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"DWM_AERO"));
                if (zDwmIsCompositionEnabled() == 0) { g_nMetrics[nMeasure] = 0; }
             }
             break;
        case SK_DWM_LEFT:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"DWM_LEFT"));
             }
             break;
        case SK_DWM_TOP:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"DWM_TOP"));
             }
             break;
        case SK_DWM_RIGHT:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"DWM_RIGHT"));
             }
             break;
        case SK_DWM_BOTTOM:
             if (g_nMetrics[nMeasure] == MESURE_UNDEFINED) {
                g_nMetrics[nMeasure] = LongVAL(skLoadString(L"DWM_BOTTOM"));
             }
             break;
        }
        return g_nMetrics[nMeasure]; }
    else {
        return 0;
    }
}
« Last Edit: November 25, 2016, 02:01:03 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Mike Lobanovsky

  • Jr. Member
  • **
  • Posts: 95
Re: Possible Bug In VC19
« Reply #31 on: November 25, 2016, 05:37:38 PM »
Patrice,

I told you more than once that for over a decade now (which is effectively forever) I've been, and still am, a dedicated admirer of your beautiful GUIs. :)

It's just that I can't go the same route for fear lest you might think I'm reverse-engineering your GDImage.dll. ;D

This is exactly why my skinning engine in fact suppresses entirely any Windows system drawing in the non-client area (Classic, Basic and Aero alike), reassigns to it a new window region of known skin-dependent size, intersects it with the window's existing client area region, and draws in this new non-client region fixing the hit-test flags as necessary to match my custom sizes and placement of caption buttons and system icon, as well as the size of caption and menu and the size, placement and spaces between the menu buttons, SDI and MDI. Naturally both the system and main menu panes are entirely owner-drawn as well.

Frankly, it takes so much effort that I've never been physically able to go beyond rebars, toolbars and statusbars and get down to simpler targets like buttons, checkboxes, option buttons, progressbars, and especially scrollbars. :)
Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)