Originally posted by: Nitin S. Jadhav
Hi,
I was searching for a article on how to create non-rectangular window that can be resized and found the following pdf document.
http://www.ratedog.com/cpp/nonrect.pdf
You will definitely like this.
nitin
Originally posted by: B Srinivasa reddy
I am trying to set the Roundrect region for a CStatic control using SetWindowRgn() in order to set rounded bmp in the control. SetWindowRgn() works properly for the first time, but the second time when is call the same function again in the On Paint function the controls comes up with the orginal rect
Please let me know if there is any solution or work around
Thanks
BSreddy
Originally posted by: Jayachandran.C
How do i create a programme in Vc++ to create a Small Bitmap Sizing to the Thubnail Running Above my Task Bar. I got Some exe's from net That is a share ware. That A bird flying on my desktop or a Cat running above my taskbar that type i wan to make .
please help me to do this thanking you
Originally posted by: Alok Govil
How does the OS does it, ie, create non-rectangular windows.
ISSUE: When I hover the mouse on a window, the OS must determine on which window the mouse is currently on. So that the mouse-move message is put to the right window's queue. Same goes for all the messages, not excluding wm_paint.
For a rectangular window, this is easy. One needs say four comparisons to find out if the current mouse position is within a particular window.
How does the system do it for non-rectangular windows. For ellipitical windows, using the simple equation of an ellipse can do. But I have no idea if the OS does this.
For the regions created from bitmap, one way would be to check the bitmap again to see if the click was inside the window. But I have no idea if the OS does this.
Regards - Alok Govil
ReplyOriginally posted by: Brian Rosenthal
I cannot figure out how to persistently change the clipping region of a child window control.
I have a rich edit control (non-mfc... created with CreateWindowEx), and I want to change the visible area of the control dynamically. There seem to be three approaches, and I cannot seem to figure out how to get any of them to work:
1. Call SetWindowRgn() on the child window control: this weirdly enough seems to make the specified region invisible, rather than visible, and is not persistent (the next InvalidateRect call re-draws the region.
2. Call SelectClipRgn(): this isn't persistent after the display context is released. The following code for example completely ignores my call to SelectClipRgn():
hdc = GetDC(hwnd);
rgn1 = CreateRectRgn(0, 0, 50, 50);
(void)SelectClipRgn(hdc, rgn1);
(void)ReleaseDC(hwnd, hdc);
hdc = GetDC(hwnd);
(void)GetClipBox(hdc, &WinRect);
rgn1 = CreateRectRgnIndirect((const RECT *)(&WinRect));
hbr = (HBRUSH) GetStockObject(WHITE_BRUSH);
(void)FillRgn(hdc, rgn1, hbr);
...
3. Intercept the WM_PAINT message of the control, and change the clipping region before the control is painted. The problem here is that I don't know how to intercept the child window WM_PAINT message without completely re-writing the control, and that doesn't seem to be the right solution.
Thank you,
Brian
Brian Rosenthal
Chief Technology Officer
MyBestHealth, Inc.
brosenthal@mybesthealth.com
Originally posted by: Nilesh Karkhanis
It works great!! and shows the window with the specified
region but if the window is dragged then the phantom lines
which are shown while dragging shows the default rectangular
region rather then the windows visible region.
Can u suggest some way to solve it..
Thanks
Nilesh Karkhanis
ReplyOriginally posted by: Paul Bright
This works well and I put this in Initdialog() function and it changed the shape of that window.
ReplyOriginally posted by: YongHoon Lee
Visit to
/bitmap/bmp_to_rgn.shtml
You can find BitmapToRegion() function.
And visit to
/bitmap/index.shtml.
fixed bug.
Originally posted by: r. lake
Window Regions are nice, but isn't it only useful if you extend it so that the window is completely customized?
Reply
Originally posted by: Rik
// Declare the application class
// Create an instance of the application class
// Declare the main window class
// The InitInstance function is called each
// The constructor for the window class
CRgn MyRgn;
Don't work. Only caption displays. What am I doing wrong?
//hello.cpp
#include <afxwin.h>
class CHelloApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
CHelloApp HelloApp;
class CHelloWindow : public CFrameWnd
{
public:
CHelloWindow();
//~CHelloWindow();
};
// time the application first executes.
BOOL CHelloApp::InitInstance()
{
m_pMainWnd = new CHelloWindow();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
CHelloWindow::CHelloWindow()
{
// Create the window itself
Create(NULL,
"The Big Push",
WS_OVERLAPPEDWINDOW,
CRect(0,0,600,400)); // x,y top-left - x,y bottom-right corner
MyRgn.CreateEllipticRgn(0, 0, 100, 100);
SetWindowRgn(m_hWnd, (HRGN)MyRgn, TRUE);
}