Click here to Skip to main content
14,268,470 members

Managed C++/CLI

 
SuggestionRe: Rendering problems with DirectWrite Pin
Richard MacCutchan15-Oct-15 23:01
protectorRichard MacCutchan15-Oct-15 23:01 
AnswerRe: Rendering problems with DirectWrite Pin
paul116715-Oct-15 23:44
memberpaul116715-Oct-15 23:44 
GeneralRe: Rendering problems with DirectWrite Pin
Richard MacCutchan14-Oct-15 7:15
protectorRichard 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
memberpaul116714-Oct-15 19:47 
GeneralRe: Rendering problems with DirectWrite Pin
paul116714-Oct-15 20:05
memberpaul116714-Oct-15 20:05 
NewsRe: Rendering problems with DirectWrite Pin
paul116717-Oct-15 5:36
memberpaul116717-Oct-15 5:36 
Questionflicker issue in Onpaint Pin
Amrit Agr8-Oct-15 0:53
memberAmrit 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 
NewsDebug Visualizers coming for C++/CLI! Pin
John Schroedl2-Oct-15 2:05
professionalJohn Schroedl2-Oct-15 2:05 
QuestionI have spy ware on this computer I tracked it...... Pin
Member 1198386422-Sep-15 8:54
memberMember 1198386422-Sep-15 8:54 
AnswerRe: I have spy ware on this computer I tracked it...... Pin
Richard Andrew x6422-Sep-15 10:42
professionalRichard Andrew x6422-Sep-15 10:42 
GeneralRe: I have spy ware on this computer I tracked it...... Pin
Member 1198386423-Sep-15 10:22
memberMember 1198386423-Sep-15 10:22 
GeneralRe: I have spy ware on this computer I tracked it...... Pin
Richard MacCutchan23-Sep-15 21:42
protectorRichard MacCutchan23-Sep-15 21:42 
AnswerRe: I have spy ware on this computer I tracked it...... Pin
Richard MacCutchan22-Sep-15 21:13
protectorRichard MacCutchan22-Sep-15 21:13 
QuestionRe: I have spy ware on this computer I tracked it...... Pin
Paul Conrad13-Oct-15 7:17
professionalPaul Conrad13-Oct-15 7:17 
AnswerRe: I have spy ware on this computer I tracked it...... Pin
Richard MacCutchan13-Oct-15 8:03
protectorRichard MacCutchan13-Oct-15 8:03 
GeneralRe: I have spy ware on this computer I tracked it...... Pin
Paul Conrad13-Oct-15 8:13
professionalPaul Conrad13-Oct-15 8:13 
QuestionSet a Byte Array to a SqlServer database on C++\Cli Pin
betedesvosges24-Aug-15 3:40
memberbetedesvosges24-Aug-15 3:40 
SuggestionRe: Set a Byte Array to a SqlServer database on C++\Cli Pin
Richard Deeming24-Aug-15 5:08
mveRichard Deeming24-Aug-15 5:08 
Questionsending a opencv Mat to a shared library generated by matlab Pin
Member 1156211423-Aug-15 9:35
memberMember 1156211423-Aug-15 9:35 
Questioncan anyone help me it this Pin
Alaa Radwan21-Aug-15 18:18
memberAlaa Radwan21-Aug-15 18:18 
GeneralRe: can anyone help me it this Pin
Richard MacCutchan21-Aug-15 22:05
protectorRichard MacCutchan21-Aug-15 22:05 
QuestionUpdating my projects to retarget to .NET 4.6 Pin
John Schroedl18-Aug-15 2:24
professionalJohn Schroedl18-Aug-15 2:24 
AnswerRe: Updating my projects to retarget to .NET 4.6 Pin
John Schroedl20-Aug-15 7:29
professionalJohn Schroedl20-Aug-15 7:29 

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.