Bruk avrundede hjørner i skrivebordsapper - Windows-apper (2023)

  • Artikkel

Avrundede hjørner er det mest merkbare trekk vedWindows 11 geometri. På Windows 11 runder systemet automatisk toppnivåvindushjørner for alle innboksapper, inkludert alle UWP-apper og de fleste andre apper. Noen Win32-apper er imidlertid kanskje ikke avrundet. Dette emnet beskriver hvordan du runder Win32-appens hovedvindushjørner hvis systemet ikke runder dem automatisk.

Merk

Designet er at apper ikke er avrundet når de maksimeres, snappes, kjøres i en virtuell maskin (VM), kjøres på et Windows Virtual Desktop (WVD) eller kjøres som et Windows Defender Application Guard (WDAG)-vindu.

Bruk avrundede hjørner i skrivebordsapper - Windows-apper (1)

Hvorfor er ikke appen min avrundet?

Hvis appens hovedvindu ikke mottar automatisk avrunding, er det fordi du har tilpasset rammen på en måte som forhindrer det. Apper faller inn i tre hovedkategorier fra perspektivet til Desktop Window Manager (DWM):

  1. Apper som er avrundet som standard.

    Dette inkluderer apper som vil ha en komplett systemlevert ramme og bildetekstkontroller (min/maks/lukke-knapper), som Notisblokk. Den inkluderer også apper som gir nok informasjon til systemet slik at det kan runde dem på riktig måte, for eksempel å angi WS_THICKFRAME- og WS_CAPTION-vindustilene eller gi en 1-piksel ikke-klientområdegrense som systemet kan bruke til å runde hjørnene.

  2. Apper som ikke er avrundet av policy, menkanvære avrundet.

    Apper i denne kategorien ønsker generelt å tilpasse mesteparten av vindusrammen, men vil fortsatt ha den systemtegnede kanten og skyggen, for eksempel Microsoft Office. Hvis appen din ikke er avrundet av retningslinjer, kan det være forårsaket av en av følgende ting:

    • Mangel på rammestiler
    • Tomt ikke-klientområde
    • Andre tilpasninger, for eksempel ekstra ikke-underordnede vinduer som brukes til egendefinerte skygger

    Å endre en av disse tingene vil bryte automatisk avrunding. Selv om vi prøvde å runde av så mange apper som mulig med systemheuristikkene våre, er det noen kombinasjoner av tilpasninger som vi ikke kan forutsi, så vi ga en manuell opt-in API for disse tilfellene. Hvis du løser disse problemene i appen din eller ringer til opt-in API, beskrevet i den følgende delen, er det mulig for systemet å runde appens vindu. Vær imidlertid oppmerksom på at API-en er et hint til systemet og garanterer ikke avrunding, avhengig av tilpasningene.

  3. Apper som aldri kan avrundes, selv om de kaller opt-in API.

    Disse appene har ingen ramme eller kanter, og har vanligvis sterkt tilpasset brukergrensesnitt. Hvis appen din gjør ett av følgende, kan den ikke avrundes:

    • Alfalaging per piksel
    • Vindusregioner

    For eksempel kan en app bruke per-piksel alfalag for å tegne gjennomsiktige piksler rundt hovedvinduet for å oppnå en egendefinert skyggeeffekt, som gjør at vinduet ikke lenger er et rektangel, og derfor kan systemet ikke runde det.

Slik velger du avrundede hjørner

Hvis appen din ikke er avrundet av retningslinjene, kan du eventuelt bruke disse API-ene for å la appen din registrere seg for avrundede hjørner. Du spesifiserer alternativet for hjørneavrunding du vil ha for appen din ved å sende en verdi avDWM_WINDOW_CORNER_PREFERENCEoppregning (vist i følgende tabell) tilDwmSetWindowAttributefunksjon.

Enum-verdiBeskrivelse
DWMWCP_DEFAULTLa systemet bestemme om vindushjørner skal rundes eller ikke.
DWMWCP_DONOTROUNDRund aldri vindushjørner.
DWMWCP_ROUNDRund hjørnene hvis det passer.
DWMWCP_ROUNDSMALLRund eventuelt hjørnene med en liten radius.

En peker til riktig verdi fra denne enumen sendes til den tredje parameteren tilDwmSetWindowAttribute. For den andre parameteren, som spesifiserer hvilket attributt du angir, passerer duDWMWA_WINDOW_CORNER_PREFERENCEverdi definert iDWMWINDOWATTRIBUToppregning.

For C#-apper

DwmSetWindowAttributeer en innebygd Win32 API og er ikke eksponert direkte for .NET-kode. Du må bruke språkets implementering avP/påkallefor å erklære funksjonen (C#-koden er gitt i eksemplet nedenfor). Alle standard WinForms- og WPF-apper avrundes automatisk, men hvis du tilpasser vindusrammen eller bruker et tredjepartsrammeverk, må du kanskje velge avrundede hjørner. Se Eksempler-delen for ytterligere detaljer.

Eksempler

Følgende eksempler viser hvordan du kan ringeDwmSetWindowAttributeellerDwmGetWindowAttributefor å kontrollere appens avrundingsopplevelse hvis appen din ikke er avrundet av retningslinjer.

Merk

Feilhåndtering er utelatt fra disse eksemplene for korthet og klarhet.

Eksempel 1 - Avrunding av hovedvinduet til en app i C# - WPF

Dette eksemplet viser hvordan du kaller DwmSetWindowAttribute fra C# ved å bruke[DllImport]Egenskap. Merk at denne definisjonen er spesifikk for avrundede hjørner; DwmSetWindowAttribute-funksjonen er utformet for å ta forskjellige parametere avhengig av flaggene som er oppgitt, så dette er ikke en generell signatur. Eksemplet inkluderer også kopier av de relevante enums fra dwmapi.h header-filen. Fordi Win32 API tar en peker for den tredje parameteren, sørg for å brukerefnøkkelord slik at du kan sende adressen til en variabel når du kaller funksjonen. Du kan gjøre dette i MainWindow-klassen din i MainWindow.xaml.cs.

ved å bruke System.Runtime.InteropServices;using System.Windows.Interop;public partial class MainWindow : Window{ // Enum-flagget for DwmSetWindowAttributes andre parameter, som forteller funksjonen hvilket attributt som skal settes. // Kopiert fra dwmapi.h public enum DWMWINDOWATTRIBUTE { DWMWA_WINDOW_CORNER_PREFERENCE = 33 } // DWM_WINDOW_CORNER_PREFERENCE-enumet for DwmSetWindowAttribute sin tredje parameter, som forteller funksjonen // hvilken verdi av ent. // Kopiert fra dwmapi.h public enum DWM_WINDOW_CORNER_PREFERENCE { DWMWCP_DEFAULT = 0, DWMWCP_DONOTROUND = 1, DWMWCP_ROUND = 2, DWMWCP_ROUNDSMALL = 3 } // Importer dwmapi.dll og definer Dwmapi.dll-funksjonen i C#mttribuette. [DllImport("dwmapi.dll", CharSet = CharSet.Unicode, PreserveSig = false)] intern statisk ekstern void DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE-attributt, ref DWM_WINDOW_CORNER_PREFERENCE, uint ctribute); // ... // Ulike andre definisjoner // ...}

Deretter, i MainWindow-konstruktøren, etter kallet til InitializeComponent, oppretter du en ny forekomst avWindowInteropHelperklasse for å få en peker til den underliggende HWND (vindushåndtak). Sørg for å brukeSørg for Håndtakmetode for å tvinge systemet til å lage en HWND for vinduet før det vises, fordi systemet vanligvis bare gjør det etter å ha avsluttet konstruktøren.

public MainWindow(){ InitializeComponent(); IntPtr hWnd = new WindowInteropHelper(GetWindow(this)).EnsureHandle(); var attributt = DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE; var preferanse = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND; DwmSetWindowAttribute(hWnd, attributt, ref preferanse, sizeof(uint)); // ... // Utfør alt annet arbeid som er nødvendig // ...}

Eksempel 2 - Avrunding av hovedvinduet til en app i C# - WinForms

Som med WPF, for en WinForms-app må du først importere dwmapi.dll og DwmSetWindowAttribute-funksjonssignaturen med P/Invoke. Du kan gjøre dette i din primære Form-klasse.

using System;using System.Runtime.InteropServices;public partial class Form1 : Form{ // Enum-flagget for DwmSetWindowAttributes andre parameter, som forteller funksjonen hvilket attributt som skal settes. // Kopiert fra dwmapi.h public enum DWMWINDOWATTRIBUTE { DWMWA_WINDOW_CORNER_PREFERENCE = 33 } // DWM_WINDOW_CORNER_PREFERENCE-enumet for DwmSetWindowAttribute sin tredje parameter, som forteller funksjonen // hvilken verdi av ent. // Kopiert fra dwmapi.h public enum DWM_WINDOW_CORNER_PREFERENCE { DWMWCP_DEFAULT = 0, DWMWCP_DONOTROUND = 1, DWMWCP_ROUND = 2, DWMWCP_ROUNDSMALL = 3 } // Importer dwmapi.dll og definer Dwmapi.dll-funksjonen i C#mttribuette. [DllImport("dwmapi.dll", CharSet = CharSet.Unicode, PreserveSig = false)] intern statisk ekstern void DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE-attributt, ref DWM_WINDOW_CORNER_PREFERENCE, uint ctribute); // ... // Ulike andre definisjoner // ...}

Å kalle DwmSetWindowAttribute er også det samme som med en WPF-app, men du trenger ikke å bruke en hjelpeklasse for å få HWND fordi det rett og slett er en egenskap for skjemaet. Kall det fra skjemakonstruktøren din, etter kallet til InitializeComponent.

public Form1(){ InitializeComponent(); var attributt = DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE; var preferanse = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND; DwmSetWindowAttribute(this.Handle, attribute, ref preferanse, sizeof(uint)); // ... // Utfør alt annet arbeid som er nødvendig // ...}

Eksempel 3 – Avrunding av hovedvinduet til en app i C++

For en innebygd C++-app kan du ringe DwmSetWindowAttribute i meldingsbehandlingsfunksjonen etter at vinduet er opprettet for å be systemet om å runde deg.

LRESULT EksempelWndProc(HWND hWnd, UINT-melding, WPARAM wParam, LPARAM lParam) { switch (melding) { // ... // Håndtere ulike vindusmeldinger... // ... case WM_CREATE: // ... // Utfør initialisering av appressurs etter vindusoppretting // ... if(hWnd) { DWM_WINDOW_CORNER_PREFERENCE-preferanse = DWMWCP_ROUND; DwmSetWindowAttribute(hWnd, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preferanse)); } gå i stykker; // ... // Håndter diverse andre vindusmeldinger... // ... } return 0;}

Eksempel 4 – Avrunding av hjørnene på en meny med en liten radius - C++

Som standard er menyene popup-vinduer som ikke blir avrundet. Hvis appen din oppretter en egendefinert meny og du vil at den skal følge avrundingspolicyen til andre standardmenyer, kan du ringe API-en for å fortelle systemet at dette vinduet skal avrundes, selv om det ikke ser ut til å samsvare med standardavrundingen Politikk.

HWND CreateCustomMenu(){// Ring en appspesifikk hjelper for å lage vinduet ved å bruke tradisjonelle APIer. HWND hWnd = CreateMenuWindowHelper(); if (hWnd) { // Sørg for at vi runder vinduet ved å bruke den lille radiusen // fordi menyene er hjelpegrensesnitt. DWM_WINDOW_CORNER_PREFERENCE preferanse = DWMWCP_ROUNDSMALL; DwmSetWindowAttribute(hWnd, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preferanse)); } returner hWnd;}

FAQs

How do I see all open apps in Windows? ›

Select Start , select All apps, and then scroll through the alphabetical list on the left.

Where can I find all programs? ›

List Installed Programs Using Settings. Press Windows key + I to open Settings and click Apps > Apps & features.

Where is all programs in Start menu Windows 10? ›

Open File Explorer, Settings, and other apps you use often from the left side of the Start menu. Scroll down the app list to see all apps and programs alphabetically, from A to Xbox.

How do I see everything open on my computer? ›

To open Task view, click the Task view button near the bottom-left corner of the taskbar. Alternative, you can press Windows key+Tab on your keyboard. All of your open windows will appear, and you can click to choose any window you want.

How do I find a window that is off screen? ›

Right-click the program on the taskbar, and then click Move. Move the mouse pointer to the middle of the screen. Use the ARROW keys on the keyboard to move the program window to a viewable area on the screen. Press ENTER.

How do I find hidden programs? ›

Select View > Show > Hidden items.
  1. Open File Explorer from the taskbar.
  2. Select View > Options > Change folder and search options.
  3. Select the View tab and, in Advanced settings, select Show hidden files, folders, and drives and OK.

Where can I see what programs are running in the background? ›

Select Start , then select Settings > Privacy > Background apps.

Where you can see all the programs installed in a computer? ›

Click Start. In the Start menu, click All programs or Programs. All programs installed on the computer are displayed.

What is Cortona? ›

Cortana is Microsoft's personal productivity assistant that helps you save time and focus attention on what matters most. To get started, select the Cortana icon on the taskbar. If you're not sure what to say, try asking, "What can you do?"

Where is the app data folder? ›

AppData is a hidden folder located in C:\Users\<username>\AppData. The AppData folder contains custom settings and other information needed by applications. For example, you might find the following in your AppData folder: Web browser bookmarks and cache. Application configuration files.

Where is AppData located? ›

That's where AppData comes in. It's a hidden folder that resides under each user folder. It's located in C:\Users\<username>\AppData and contains program-specific information that may not relate to the program's ability to run, such as user configurations.

How do I show all apps on my default Start menu? ›

To choose whether your Start menu settings show all your apps or only the most used ones, select Start > Settings > Personalization > Start and adjust each setting you want to change.

What is the difference between Start button and Start menu? ›

In Windows 11, Start is located in the middle of the taskbar. Clicking Start opens the Start menu (except in Windows 8) that gives you access to all the installed programs, and other Windows features. Below is a visual example of the Start button and its location in Windows 7.

How do I restore all open windows? ›

Restore All Windows using Show Desktop

+ D keys. Click/tap on the Show Desktop button on the right end of the task bar.

What is the main workspace of a windows computer? ›

Desktop. The desktop is the main workspace of your computer. From here, you can access files, folders, and more. You can also customize the desktop by choosing a desktop background image, also known as a wallpaper.

What is hidden window app? ›

Hidden Window is an interactive video experiment - become part of the story by using personalized information to create the experience. As a user, you upload content such as a video or photo and that becomes integrated with the story told through a series of short films.

How do I get my computer screen back to normal? ›

Change the screen resolution
  1. Stay in, or open, Display settings. Open your Display settings.
  2. Scroll to Scale and layout.
  3. Find Display resolution, and then choose an option. It's usually best to stick with the one that's marked (Recommended).

What does Alt Space M do? ›

Alt+Space in Microsoft Windows

In addition to using the arrow keys in the window menu, you can also use its shortcuts, indicated by underline letters. For example, once displayed, R = Restore, M = Move, S = Size, N = Minimize, X = Maximize, and C = Close.

Where can I unhide hidden apps? ›

Q2. How to unhide apps on Android 12?
  • Click on Settings.
  • Click on Home Screen.
  • Select Hide Apps.
  • Click on the apps you want to unhide.
Oct 24, 2022

What apps are running in the background on this device? ›

To open Quick Settings, from the top of the screen, swipe down twice. To see the number of active apps running in the background: At the bottom left, tap # active apps. Or, at the bottom right, tap the number next to Settings and Power .

Is a program that runs in the background without you knowing it? ›

Spyware is a type of malicious software -- or malware -- that is installed on a computing device without the end user's knowledge.

How to check apps running in background Android programmatically? ›

To see what apps are running in the background, go to Settings > Developer Options > Running Services.

Where are installed programs stored? ›

Open the File Explorer using the icon on the Start menu or by pressing Win + E. Navigate to This PC and click on the drive where Windows is installed (typically the C Drive). Navigate to Program Files > Program Files (x86) and then scroll the list of folders until you find one with the program name you're looking for.

What is installation of application software? ›

Installation refers to the particular configuration of a software or hardware with a view to making it usable with the computer. A soft or digital copy of the piece of software (program) is needed to install it. There are different processes of installing a piece of software (program).

What the heck is Cortana? ›

Cortana is a cloud-based digital assistant that works across your devices and other Microsoft services. Depending on the capabilities of your device and the version of Cortana you're using, Cortana can provide a range of features, some of which are personalized.

Which operating system would I be using if I am using Cortana? ›

Cortana is integrated across the Microsoft 365 product suite for use with Windows OSes version 2004 and later and the Microsoft Edge browser.

What is the Cortana key? ›

You can start it by clicking the Cortana icon in the taskbar just to the right of the search box, pressing the Windows key + C, or saying “Cortana.”

How do I find hidden Users on Windows 10? ›

Step 1: Right-click on This PC and select Manage from the context menu to open Computer Management. Step 2: Expand System Tools > Local Users and Groups, and then select the Users folder, so that it will list all user accounts existing on your Windows 10, including the disabled or hidden accounts.

What can I delete in AppData? ›

If you're looking at C:\Users\<user_name>\AppData\Local\Temp , everything can be deleted, unless you're in the middle of some operation. Look at the files, to be sure, but otherwise, delete ll to the Recycle Bin, if it fits (or if too much, delete permanently).

What is app data on Android? ›

App data is the data that is downloaded or generated as part of a device's content - for instance, downloaded books or music, while cache files are temporary files many programs generate while in use, such as saved portions of websites you visit in a browser.

What is AppData local packages? ›

AppData folders store per-user information for applications, so if you delete files from an application's applications data directory, it will likely have to recreate that data from default values.

What is the difference between AppData local and AppData roaming? ›

A roaming profile has all the functionality of a local profile but can be transferred from one PC to another. Essentially, the user's profile and files are downloaded to any computer that they log onto. When the user logs off, the changes in a roaming profile are synchronized with the server copy of the profile.

How do I access the startup options menu? ›

You can access the menu by turning on your computer and pressing the F8 key before Windows starts. Some options, such as safe mode, start Windows in a limited state, where only the bare essentials are started.

What is the all programs auto expander? ›

All Programs Auto-Expander is a tiny utility designed for Windows 7 to automatically expand the All Programs section of the Start menu as soon as the Start menu is opened.

How do I show hidden apps on Android? ›

Find Hidden Apps on Android using App Drawer.
  1. Visit your app drawer section.
  2. Tap on the three dots that are present at the upper-right of the device screen.
  3. Click on the home screen settings. It will navigate you to the Hide apps menu; tap on it.
  4. Here, you will see the hidden apps that are not showing in the app list.

How do I know if my husband has hidden apps on his phone? ›

How to Find Hidden Apps in the App Drawer
  • From the app drawer, tap the three dots in the upper-right corner of the screen.
  • Tap Hide apps.
  • The list of apps that are hidden from the app list displays. If this screen is blank or the Hide apps option is missing, no apps are hidden.
Jan 24, 2023

What is Start button option related to? ›

The Start menu provides access to every program installed on the computer. To open the Start menu, click the the Start menu button at the bottom-left corner of the screen or press the Windows key on the keyboard.

What are the three tools in a Start menu? ›

The Start Menu actually has three parts: The Menu, the All Apps list, and the Tiles area.

What is the purpose of the Start button? ›

Clicking the Start button opens up what is called the Start menu. The Start menu is used to access your programs, settings, printers, and more. Place the mouse pointer on the My Computer option in the Start menu and click once. This will show you the details of your computer.

How do I display all open apps? ›

Swipe up from the bottom of your screen to the top. If you get All Apps , tap it.

How do I see recently opened apps? ›

From the Home screen, tap the Recents icon to the left of the Home button. All of your active or opened apps will be listed. If you've customized your Navigation bar, Recents may be located on the right, unless you're using full screen gestures. To open an app, simply tap it.

Which shows the icons of all open windows and application? ›

The main Taskbar--displays icons for all open applications and files.

How do I find apps that are not showing on my screen? ›

Navigate to Settings > Apps & Notifications > See all apps.

You'll see a drop-down tab named 'All apps' at the top of the screen. Tap it and select 'Disabled apps'. If the missing app is among the disabled, tap it and click 'Enable' below the screen.

Can you see recently deleted apps? ›

Navigate to the green dropdown menu at the top left of the screen and tap it. This will bring up two options, installed and uninstalled. Tap uninstalled. This will bring up a list of every app you've ever installed, including those you've deleted.

How do I hide recent apps on Android? ›

Open Settings. Tap Display and select Home screen. Tap Hide apps. Select the apps you want to hide from your home screen and tap Done.

What are the three system icons in Windows? ›

These icons are created automatically by windows during its installation. Example of some system icons are My Computer, Recycle Bin, My Documents, Internet Explorer etc.

Where are ICO files stored? ›

Most Icons Windows 10 uses are actually located in C:\Windows\System32... Plus a few in C:\Windows\System32\imagesp1. dll and C:\Windows\System32\filemgmt.

What graphic indicates open apps on a desktop? ›

Windows uses icons to graphically represent items, such as programs and folders. This is part of Windows GUI, or graphical user interface. Icons appear everywhere throughout Windows, and are really just pictures that depict the type of items they represent. The Windows desktop contains a range of desktop icons.

References

Top Articles
Latest Posts
Article information

Author: Moshe Kshlerin

Last Updated: 12/26/2023

Views: 5779

Rating: 4.7 / 5 (77 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Moshe Kshlerin

Birthday: 1994-01-25

Address: Suite 609 315 Lupita Unions, Ronnieburgh, MI 62697

Phone: +2424755286529

Job: District Education Designer

Hobby: Yoga, Gunsmithing, Singing, 3D printing, Nordic skating, Soapmaking, Juggling

Introduction: My name is Moshe Kshlerin, I am a gleaming, attractive, outstanding, pleasant, delightful, outstanding, famous person who loves writing and wants to share my knowledge and understanding with you.