Click here to Skip to main content
15,867,308 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: C++ Debug Error Pin
Richard MacCutchan9-Nov-15 22:37
mveRichard MacCutchan9-Nov-15 22:37 
GeneralRe: C++ Debug Error Pin
Member 120351389-Nov-15 22:40
Member 120351389-Nov-15 22:40 
GeneralRe: C++ Debug Error Pin
Richard MacCutchan9-Nov-15 22:53
mveRichard MacCutchan9-Nov-15 22:53 
GeneralRe: C++ Debug Error Pin
Member 120351389-Nov-15 22:58
Member 120351389-Nov-15 22:58 
GeneralRe: C++ Debug Error Pin
Member 120351389-Nov-15 23:03
Member 120351389-Nov-15 23:03 
GeneralRe: C++ Debug Error Pin
Richard MacCutchan9-Nov-15 23:06
mveRichard MacCutchan9-Nov-15 23:06 
GeneralRe: C++ Debug Error Pin
Member 120351389-Nov-15 23:08
Member 120351389-Nov-15 23:08 
GeneralRe: C++ Debug Error Pin
Richard MacCutchan9-Nov-15 23:39
mveRichard MacCutchan9-Nov-15 23:39 
AnswerRe: C++ Debug Error Pin
Jochen Arndt9-Nov-15 23:35
professionalJochen Arndt9-Nov-15 23:35 
GeneralRe: C++ Debug Error Pin
Member 1203513810-Nov-15 11:40
Member 1203513810-Nov-15 11:40 
NewsBug with unique_ptr and /clr code in Visual Studio 2015 Pin
John Schroedl7-Nov-15 16:22
professionalJohn Schroedl7-Nov-15 16:22 
QuestionRendering problems with DirectWrite Pin
paul116713-Oct-15 22:25
paul116713-Oct-15 22:25 
AnswerRe: Rendering problems with DirectWrite Pin
Richard MacCutchan13-Oct-15 22:48
mveRichard MacCutchan13-Oct-15 22:48 
GeneralRe: Rendering problems with DirectWrite Pin
paul116714-Oct-15 3:26
paul116714-Oct-15 3:26 
GeneralRe: Rendering problems with DirectWrite Pin
Richard MacCutchan14-Oct-15 4:57
mveRichard MacCutchan14-Oct-15 4:57 
GeneralRe: Rendering problems with DirectWrite Pin
paul116715-Oct-15 19:05
paul116715-Oct-15 19:05 
SuggestionRe: Rendering problems with DirectWrite Pin
Richard MacCutchan15-Oct-15 23:01
mveRichard MacCutchan15-Oct-15 23:01 
AnswerRe: Rendering problems with DirectWrite Pin
paul116715-Oct-15 23:44
paul116715-Oct-15 23:44 
GeneralRe: Rendering problems with DirectWrite Pin
Richard MacCutchan14-Oct-15 7:15
mveRichard MacCutchan14-Oct-15 7:15 
GeneralRe: Rendering problems with DirectWrite Pin
John Schroedl14-Oct-15 8:08
professionalJohn Schroedl14-Oct-15 8:08 
GeneralRe: Rendering problems with DirectWrite Pin
paul116714-Oct-15 19:47
paul116714-Oct-15 19:47 
GeneralRe: Rendering problems with DirectWrite Pin
paul116714-Oct-15 20:05
paul116714-Oct-15 20:05 
NewsRe: Rendering problems with DirectWrite Pin
paul116717-Oct-15 5:36
paul116717-Oct-15 5:36 
Questionflicker issue in Onpaint Pin
Amrit Agr8-Oct-15 0:53
Amrit Agr8-Oct-15 0:53 
Hi Guys,

I am getting flicker while painting a border on control, bannerbar(its derived from CWnd only). So the case if control is getting focus , border should get paint otherwise not.

I am handling OnsetFocus and OnKillfocus and calling Paintborder() in which I checked if banner got focus(by checking m_BannerHasFocus flag) i will call parent->InavlidateRect() here i passed banner rect as argument.

In Onpaint I am taking PS_DOT pen (if its have focus) and PS_NULL if don' have focus.

I am getting flicker while its getting/loosing focus Even i pass FALSE parameter in InvalidateRect, which will not erase background.

Please help me out. I pasted source code here. Thanks

void CBannerBar::OnSetFocus(CWnd* pOldWnd)
{
CBaseWnd::OnSetFocus(pOldWnd);
// TODO: Add your message handler code here
m_BannerHasFocus = true;
PaintBannerBorder();
}

void CBannerBar::OnKillFocus(CWnd* pNewWnd)
{
CBaseWnd::OnKillFocus(pNewWnd);
// TODO: Add your message handler code here
m_BannerHasFocus = false;
PaintBannerBorder();

}

void CBannerBar::PaintBannerBorder()
{
//Invalidate the control in order to hide the focus rectangle.
CRect rect;
GetWindowRect(&rect);
CWnd* pParent = GetParent();
if (!rect.IsRectEmpty() && pParent != NULL)
{
pParent->ScreenToClient(rect);
pParent->InvalidateRect(rect, FALSE);
}
}

void CBannerBar::OnPaint()
{
CPaintDC dc(this); // device context for painting
// create a brush of the background color and paint the window with it
CBrush  brush (BACK_COLOR);
dc.FillRect(&dc.m_ps.rcPaint, &brush);
brush.DeleteObject();

CDC* pDC = GetWindowDC();

CRect rect;
GetWindowRect(&rect);
rect.OffsetRect(-rect.left, -rect.top);
COLORREF dColour = GetSysColor(COLOR_HIGHLIGHT);
if (m_BannerHasFocus)
{
    dColour = RGB(255, 0, 0);
}

CPen pen(m_BannerHasFocus ? PS_DOT : PS_NULL, 1, dColour);
CPen* penOld = (CPen*)pDC->SelectObject(&pen);
pDC->SetBkMode(TRANSPARENT);

pDC->MoveTo(rect.left, rect.top);
pDC->LineTo(rect.right - 1, rect.top);
pDC->LineTo(rect.right - 1, rect.bottom - 1);
pDC->LineTo(rect.left, rect.bottom - 1);
pDC->LineTo(rect.left, rect.top);

pDC->SelectObject(penOld);

ReleaseDC(pDC);

// Do not call CBaseWnd::OnPaint() for painting messages

}
AnswerRe: flicker issue in Onpaint Pin
John Schroedl8-Oct-15 3:54
professionalJohn Schroedl8-Oct-15 3:54 

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.