Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 11254243

@User 11254243
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Drawing border to dialog using GDI+
    U User 11254243

    Hi, Thanks for your solution. I used AddLine and the same vertex. Still it was not working. Then i decreased 1 from right and bottom, now its working. Is it something like i need to use offset or something. I dont want to hardcode. GraphicsPath gp; Point point[5]; point[0] = Point(vertex[0].x,vertex[0].y); point[1] = Point(vertex[1].x-1,vertex[1].y); point[2] = Point(vertex[2].x-1,vertex[2].y-1); point[3] = Point(vertex[3].x,vertex[3].y-1); point[4] = Point(vertex[0].x,vertex[0].y); gp.AddLines(point,5); Pen pen(Color(255, 255, 0, 0)); graphics.DrawPath(&pen, &gp);

    C / C++ / MFC graphics winforms help

  • MFC: flickering issue with GDI+
    U User 11254243

    I create a sample dialog application which has a circle drawn. Also on mouse move the circle will be re-drawn. I am providing my code below. Its also compilable. I tried using double buffering and erasebackground, i was not getting the flickering issue, but i observed that the drawining is not erased properly. So to erase, in OnPaint i wrote the erasing code. Again i am facing the flickering issue. CPaintDC dc(this); GetClientRect(&clientRect); circle = clientRect; circle.DeflateRect(100,100); dc.SelectStockObject(NULL_BRUSH); dc.SelectStockObject(NULL_PEN); dc.FillSolidRect(circle, ::GetSysColor(COLOR_BTNFACE)); Bitmap buffer(circle.right, circle.bottom); Graphics graphicsbuf(&buffer); Graphics graphics(dc.m_hDC); graphicsbuf.SetSmoothingMode(SmoothingModeHighQuality); SolidBrush brush(Color(255,71,71,71)); Pen bluePen(Color(255, 0, 0, 255),1); graphicsbuf.DrawEllipse(&bluePen,Rect(circle.left,circle.top,circle.Width(),circle.Height())); graphicsbuf.SetSmoothingMode(SmoothingModeHighQuality); graphics.DrawImage(&buffer, 0, 0); } void CPOCDlg::OnMouseMove(UINT nFlags, CPoint point) { m_point = point; InvalidateRect(circle,FALSE); CDialogEx::OnMouseMove(nFlags, point); } BOOL CPOCDlg::OnEraseBkgnd(CDC* pDC) { return TRUE; } Please let me know if i am doing any mistake.

    C / C++ / MFC graphics c++ winforms help

  • Drawing border to dialog using GDI+
    U User 11254243

    I modified my dialog to a polygon region dialog. Then i am trying to frame/draw the border.Using device context the CRgn::FrameRgn, i am bale to draw the border around the dialog. But i want to achieve this using Gdi+. I did as below, but the border is appearing only on left and top of the dialog. Can someone please help on this.

    CPoint vertex[4];
    BOOL CPolygonDlg::OnInitDialog()
    {
    CDialogEx::OnInitDialog();

    ModifyStyle(WS\_CAPTION,0);
    ModifyStyle(WS\_BORDER,0);
    
     CRect rect(400,200,900,700);
     CRect wr = rect;
    AdjustWindowRect( wr, 0, FALSE );
    MoveWindow(wr); 
    
    GetClientRect( rect );
    CRect csr = rect;
    ClientToScreen( csr );
    
    
    
    vertex\[0\] = CPoint(rect.left,rect.top);
    vertex\[1\] = CPoint(rect.right,rect.top);
    vertex\[2\] = CPoint(rect.right,rect.bottom);
    vertex\[3\] = CPoint(rect.left,rect.bottom);
    
    
     m\_rgnShape.CreatePolygonRgn( vertex, 4, ALTERNATE );
    m\_rgnShape.OffsetRgn( CPoint( csr.TopLeft() - wr.TopLeft() ) );
    SetWindowRgn( (HRGN)m\_rgnShape.Detach(), TRUE );
    m\_rgnShape.CreatePolygonRgn( vertex, 4, ALTERNATE );
    
    
    
    
    return TRUE;  // return TRUE  unless you set the focus to a control
    

    }

    void CPolygonDlg::OnPaint()
    {
    Graphics graphics(dc.m_hDC);
    CRect rect;
    GetClientRect(rect);
    GraphicsPath gp;
    Point point[4];
    point[0] = Point(rect.left,rect.top);
    point[1] = Point(rect.right,rect.top);
    point[2] = Point(rect.right,rect.bottom);
    point[3] = Point(rect.left,rect.bottom);
    gp.AddPolygon(point,4);
    Pen pen(Color(255, 255, 0, 0));
    graphics.DrawPath(&pen, &gp);
    }

    C / C++ / MFC graphics winforms help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups