A simple tool to generate the official seal picture

Source: Internet
Author: User

The results of the operation of this example are shown below

I. Function and principle

Learning VC also not long, will I do this gadget and share with you. Its main function is to be able to customize the formation of official seal graphics and save for BMP pictures, I hope to be a bit of use for everyone. The following methods are implemented:

Step one: Generate dialog project, and add the corresponding control, the picture display using the pictures control;

Step two: Define the parameters needed to generate the graph;

Step three: Through the parameter definition, generate the corresponding bitmap, and then display the bitmap in the picture control, see the source program.

Step four: Save the generated bitmap as a bitmap file.

Second, the key point of the realization of the program

(i), need to understand logfont, logpen and logbrush structure, and flexible application, especially in the process of arranging fonts, the rotation angle of the font and positioning point settings.

//绘制图章基本图形
void CMakeSealDlg::DrawSeal(CDC * MemDC)
{
    int cx = 100;
    int cy = 100;
    POINT point;
    point.x = point.y = 5;
    LOGPEN logPen;
    logPen.lopnColor = ChooseColor(&m_nRadioColor);
    //绘制背景
    logPen.lopnStyle = PS_NULL;
    logPen.lopnWidth = point;
    (*MemDC).SelectObject(CreatePenIndirect(&logPen));
    (*MemDC).Rectangle(0,0,200,200);
    //设置绘笔
    logPen.lopnStyle = PS_SOLID;
    (*MemDC).SelectObject(CreatePenIndirect(&logPen));
    //设置填充
    LOGBRUSH logBrush;
    logBrush.lbStyle = BS_HOLLOW;
    logBrush.lbColor = RGB(255, 0, 0);
    (*MemDC).SelectObject(CreateBrushIndirect(&logBrush));
    //绘制外圆
    (*MemDC).Ellipse(cx - m_nRadius, cy - m_nRadius, cx + m_nRadius, cy + m_nRadius);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.