Click here to Skip to main content
15,914,066 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionprogrammatic gamma correction for dual monitors Pin
srboisvert28-Jul-06 0:42
srboisvert28-Jul-06 0:42 
AnswerRe: programmatic gamma correction for dual monitors Pin
Blake Miller1-Aug-06 12:56
Blake Miller1-Aug-06 12:56 
Questionquick network functionality ? Pin
ldsdbomber28-Jul-06 0:42
ldsdbomber28-Jul-06 0:42 
QuestionPrintable area Pin
Wim Engberts28-Jul-06 0:21
Wim Engberts28-Jul-06 0:21 
QuestionDraggable Circle when Mose is inside the Circle Area. Pin
uday kiran janaswamy27-Jul-06 23:57
uday kiran janaswamy27-Jul-06 23:57 
AnswerRe: Draggable Circle when Mose is inside the Circle Area. Pin
Wim Engberts28-Jul-06 0:26
Wim Engberts28-Jul-06 0:26 
GeneralRe: Draggable Circle when Mose is inside the Circle Area. Pin
uday kiran janaswamy28-Jul-06 0:58
uday kiran janaswamy28-Jul-06 0:58 
GeneralRe: Draggable Circle when Mose is inside the Circle Area. Pin
Wim Engberts28-Jul-06 1:26
Wim Engberts28-Jul-06 1:26 
Hi Uday,

I would be thinking along the following lines:

//=======================================================
// Existing variables:
CDC * m_pDC;
CDC m_CompatibleDC;
CBitmap * m_pBitmap;
RECT m_Rect;

// constructor initialization:

m_pDC = (CDC *)NULL;
m_pBitmap = (CBitmap *)NULL;

// OnLButtonDown (draw the first circle)
void CPaintingView::OnLButtonDown(UINT nFlags, CPoint point)
{

if (m_pDC == (CDC *)NULL) // first time?
{
m_pDC = GetDC (); // create the device context
m_CompatibleDC.CreateCompatibleDC (m_pDC); // and a helper context
}
GetClientRect (&m_Rect); // get the required size
if (m_pBitmap != (CBitmap *)NULL) // we want a fresh bitmap
delete m_pBitmap; // so delete any old stuff
m_pBitmap = new CBitmap; // and create the new one
m_pBitmap->CreateCompatibleBitmap (m_pDC, m_Rect.right, m_Rect.bottom);// create the helper bitmap with the correct size
m_CompatibleDC.SelectObject (m_pBitmap); // and select it into the DC
m_CompatibleDC.BitBlt (0,0,m_Rect.right,m_Rect.bottom,m_pDC, // copy the current screen content
0,
0,
SRCCOPY);

Anchor.x = point.x;
Anchor.y = point.y;

CScrollView::OnLButtonDown(nFlags, point);
}

void CPaintingView::OnMouseMove(UINT nFlags, CPoint point)
{

m_pDC->BitBlt (0,0,m_Rect.right,m_Rect.bottom, // restore original screen content
&m_CompatibleDC,
0,
0,
SRCCOPY);
m_pDC->Ellipse(Anchor.x, Anchor.y, point.x, point.y); // and redraw the circle
}

void CPaintingView::OnLButtonUp(UINT nFlags, CPoint point)
{
// Draw definitive circle
m_pDC->BitBlt (0,0,m_Rect.right,m_Rect.bottom, // restore original screen content
&m_CompatibleDC,
0,
0,
SRCCOPY);
DrawTo.x = point.x;
DrawTo.y = point.y;
m_pDC->Ellipse(Anchor.x, Anchor.y, DrawTo.x, DrawTo.y);
m_CompatibleDC.DeleteDC (); // remove helper DC
m_pBitmap->DeleteObject (); // and bitmap
}

//======================================================
GeneralRe: Draggable Circle when Mose is inside the Circle Area. Pin
uday kiran janaswamy28-Jul-06 1:32
uday kiran janaswamy28-Jul-06 1:32 
QuestionHow to add files into External dependencies fileview Pin
Vinod Moorkkan27-Jul-06 23:41
Vinod Moorkkan27-Jul-06 23:41 
AnswerRe: How to add files into External dependencies fileview Pin
toxcct27-Jul-06 23:47
toxcct27-Jul-06 23:47 
AnswerRe: How to add files into External dependencies fileview [modified] Pin
Naveen27-Jul-06 23:58
Naveen27-Jul-06 23:58 
GeneralRe: How to add files into External dependencies fileview Pin
Vinod Moorkkan28-Jul-06 0:41
Vinod Moorkkan28-Jul-06 0:41 
GeneralRe: How to add files into External dependencies fileview Pin
Naveen28-Jul-06 0:45
Naveen28-Jul-06 0:45 
QuestionIActiveDesktop error Pin
Sarath C27-Jul-06 23:32
Sarath C27-Jul-06 23:32 
AnswerRe: IActiveDesktop error Pin
Hamid_RT28-Jul-06 0:29
Hamid_RT28-Jul-06 0:29 
GeneralRe: IActiveDesktop error Pin
Sarath C28-Jul-06 0:43
Sarath C28-Jul-06 0:43 
GeneralRe: IActiveDesktop error Pin
Hamid_RT28-Jul-06 0:56
Hamid_RT28-Jul-06 0:56 
AnswerRe: IActiveDesktop error Pin
Stephen Hewitt28-Jul-06 1:10
Stephen Hewitt28-Jul-06 1:10 
QuestionAfxBeginThread Pin
tanarnelinistit27-Jul-06 23:22
tanarnelinistit27-Jul-06 23:22 
AnswerRe: AfxBeginThread Pin
Cedric Moonen27-Jul-06 23:26
Cedric Moonen27-Jul-06 23:26 
QuestionRe: AfxBeginThread Pin
tanarnelinistit27-Jul-06 23:38
tanarnelinistit27-Jul-06 23:38 
AnswerRe: AfxBeginThread Pin
Cedric Moonen27-Jul-06 23:42
Cedric Moonen27-Jul-06 23:42 
QuestionRe: AfxBeginThread Pin
tanarnelinistit28-Jul-06 0:37
tanarnelinistit28-Jul-06 0:37 
AnswerRe: AfxBeginThread Pin
Cedric Moonen28-Jul-06 0:45
Cedric Moonen28-Jul-06 0:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.