![]() ![]() HRGN hrgn_cptBtmBrdrRND = CreateRoundRectRgn(0, 0, RECTWIDTH(ClientRect), RECTHEIGHT(ClientRect), 16, 16) If (SUCCEEDED(DwmGetWindowAttribute(hWnd, DWMWA_CAPTION_BUTTON_BOUNDS, &rectCaptionButtonBounds, sizeof(rectCaptionButtonBounds)))) SetLayeredWindowAttributes(hWnd, RGB(0, 0, 0), 255, LWA_COLORKEY) RECT rect, rectCaptionButtonBounds, rectText,myRect,ContentRect,ClientRect,CaptionBorderBottom, rect_EXIT_BTN, rect_RESTORE_BTN, rect_MINIMIZE_BTN Hr = DwmExtendFrameIntoClientArea(hWnd, &margins) Extend the frame into the client area. GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED) HIcon = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(2), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR | LR_SHARED) HMODULE hDLL = LoadLibrary(L"Setupapi.dll") SetWindowPos(hWnd, NULL, rcClient.left, rcClient.top, RECTWIDTH(rcClient), RECTHEIGHT(rcClient), SWP_FRAMECHANGED) Inform the application of the frame change. LRESULT CustomCaptionProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool* pfCallDWP)īool fCallDWP = true // Pass on to DefWindowProc?įCallDWP = !DwmDefWindowProc(hWnd, message, wParam, lParam, &lRet) Graphics.FillEllipse(&DarkSolidBrush,rectX) SolidBrush DarkSolidBrush(Color(255, 0, 1, 0)) Rect1.Height = height- TOPEXTENDWIDTH-111 įillRoundRectangle(&graphics, &mySolidBrush, rect1, rad) SolidBrush mySolidBrush(Color(255, 255, 0, 0)) Graphics.SetPixelOffsetMode(PixelOffsetMode::PixelOffsetModeHighQuality) Graphics.SetCompositingQuality(CompositingQuality::CompositingQualityInvalid) Graphics.SetSmoothingMode(SmoothingMode::SmoothingModeHighQuality) VOID OnPaint(HDC hdc,int width, int height) Path.AddArc(rect.X, rect.Y, radius * 2, radius * 2, 180, 90) Path.AddLine(rect.X, rect.Y + rect.Height - (radius * 2), rect.X, rect.Y + radius) Path.AddArc(rect.X, rect.Y + rect.Height - (radius * 2), radius * 2, radius * 2, 90, 90) Path.AddLine(rect.X + rect.Width - (radius * 2), rect.Y + rect.Height, rect.X + radius, rect.Y + rect.Height) Path.AddArc(rect.X + rect.Width - (radius * 2), rect.Y + rect.Height - (radius * 2), radius * 2, radius * 2, 0, 90) Path.AddLine(rect.X + rect.Width, rect.Y + radius, rect.X + rect.Width, rect.Y + rect.Height - (radius * 2)) Path.AddArc(rect.X + rect.Width - (radius * 2), rect.Y, radius * 2, radius * 2, 270, 90) Path.AddLine(rect.X + radius, rect.Y, rect.X + rect.Width - (radius * 2), rect.Y) Void FillRoundRectangle(Gdiplus::Graphics* g, Brush* p, Gdiplus::Rect& rect, UINT8 radius) SystemParametersInfoA(SPI_SETDROPSHADOW,0,(const PVOID) false,SPIF_SENDWININICHANGE) If (!hWnd) return MessageBox(NULL, L"Cannot create window !", L"Error", MB_ICONERROR | MB_OK) HWND hWnd = CreateWindowEx(0, wcex.lpszClassName, TEXT("Test"), WS_OVERLAPPEDWINDOW, nX, nY, nWidth, nHeight, NULL, NULL, hInst, NULL) Int nX = (GetSystemMetrics(SM_CXSCREEN) - nWidth) / 2, nY = (GetSystemMetrics(SM_CYSCREEN) - nHeight) / 2 Return MessageBox(NULL, L"Cannot register class !", L"Error", MB_ICONERROR | MB_OK) LoadCursor(NULL, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), NULL, TEXT("WindowClass"), NULL, Sizeof(WNDCLASSEX), CS_HREDRAW | CS_VREDRAW, WndProc, 0, 0, hInst, LoadIcon(NULL, IDI_APPLICATION), GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL) Int WINAPI wWinMain( _In_opt_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_opt_ LPTSTR lpCmdLine, _In_opt_ int nCmdShow) ![]() LRESULT HitTestNCA(HWND hWnd, WPARAM wParam, LPARAM lParam) HBRUSH DARKEST_BRUSH = CreateSolidBrush(RGB(0, 0, 0)) HBRUSH LIGHTPURPLE_BRUSH_2 = CreateSolidBrush(RGB(255, 174, 201)) HBRUSH LIGHTPURPLE_BRUSH_1 = CreateSolidBrush(RGB(189, 106, 189)) HBRUSH PURPLE_BRUSH = CreateSolidBrush(RGB(163, 73, 164)) HBRUSH DARKBLUE_BRUSH = CreateSolidBrush(RGB(26, 31, 96)) HBRUSH RED_BRUSH = CreateSolidBrush(RGB(237, 28, 36)) #define RECTHEIGHT(rc) (rc.bottom - rc.top) #define RECTWIDTH(rc) (rc.right - rc.left) LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM) If you try it please use VS debugger as I did not put functional window buttons. However, It work as Anti Aliased with painted background (Solid) but not with TRANSPARENT background. The issue is I want to do something beatiful and I tried to render a Anti Aliased window border in client area with GDI. The reason I use layered window is, I want to make window's bottom border's corners rounded. My COLORKEY is RGB(0,0,0) SetLayeredWindowAttributes(hWnd, RGB(0, 0, 0), 255, LWA_COLORKEY) I also use layered window to render background transparent. hr = DwmExtendFrameIntoClientArea(hWnd, &margins) I use extended frame to render a custom caption and window border. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |