Delphi buttons show white border on Aero glass

后端 未结 4 1641
广开言路
广开言路 2021-02-06 00:19

I have been trying to find a good-looking design using Aero in Delphi 2010. One of the obvious uses one sees, is where the glass frame is extended to include the OK/Cancel butto

4条回答
  •  轮回少年
    2021-02-06 00:57

    if you are able to use win32 api, try exploiting NM_CUSTOMDRAW notification (not ownerdraw), as i do (yes, buttons DO send it, including radio and checkboxes. For these it is best to use WM_CTLCOLORSTATIC though.). This is how it is done in C++, but the idea is the same. While my idea is good, it so happens that my buttons do DISAPPEAR once per program execution from the window, when they are customdrawn and i need to hover mouse over them so they are visible again. That's why i'm still looking for comments for this. Note that it is really difficult to reproduce disappearing buttons in one-form applications. I hovewer am experiencing this behaviour in every project.

    case WM_NOTIFY:
      switch(((LPNMHDR)lParam)->code){
      case NM_CUSTOMDRAW:
        {
           NMHDR *nmh=(NMHDR*)lParam;
           //these 6000 through 6004 are button identifiers assigned by me
           if(nmh->idFrom >= 6000 && nmh->idFrom <= 6004){
             switch(((LPNMCUSTOMDRAW)nmh)->dwDrawStage){
               case CDDS_PREERASE:
                 //BackgroundBrush is a HBRUSH used also as window background
                 FillRect(((LPNMCUSTOMDRAW)nmh)->hdc, &((LPNMCUSTOMDRAW)nmh)->rc, BackgroundBrush);
                 break;
             }
        }
        break;
    }
    break;
    

提交回复
热议问题