Mo custom symbol 2 (displays the point as the pool symbol)

Source: Internet
Author: User

We have already talked about the User-Defined symbol method in VC. Here we will talk about another application of user-defined symbols in VB, that is, displaying the vertex as a pool, as shown in

Otherwise, paste the Code directly:

Option explicit

Implements afcustom. icustommarker

'Data members
Private m_pen as long
Private m_oldpen as long
Private m_size as long
Private m_style as wsnodestyle

'Win32 API functions
Private declare function SelectObject lib "GDI32" (byval HDC as long, byval hobject as long) as long
Private declare function createpen lib "GDI32" (byval npenstyle as long, byval nwidth as long, byval crcolor as long) as long
Private declare function deleteobject lib "GDI32" (byval hobject as long) as long

Private declare function lineto lib "GDI32" (byval HDC as long, byval X as long, byval y as long) as long
Private declare function movetoex lib "GDI32" (byval HDC as long, byval X as long, byval y as long, lppoint as long) as long
Private declare function ellipse lib "GDI32" (byval HDC as long, byval X1 as long, byval Y1 as long, byval X2 as long, byval Y2 as long) as long

Private sub class_initialize ()
M_style = wswatertanknode
End sub

Public property let symbolstyle (byval vdata as wsnodestyle)
M_style = vdata
End Property

Public property get symbolstyle () as wsnodestyle
Symbolstyle = m_style
End Property

Public sub icustommarker_draw (byval HDC as long, byval X as long, byval y as long)
Select case m_style
Case wswatertanknode 'pool
Movetoex HDC, X-m_size, Y-m_size, 0
Lineto HDC, X-m_size, y
Lineto HDC, x + m_size, y
Lineto HDC, x + m_size, Y-m_size
Movetoex HDC, X-m_size, INT (Y-m_size * 2/5), 0
Lineto HDC, x + m_size, INT (Y-m_size * 2/5)
Case else
Ellipse HDC, X-m_size, Y-m_size, x + m_size, Y + m_size
End select
End sub

Public sub icustommarker_resetdc (byval HDC as long)
SelectObject HDC, m_oldpen
Deleteobject m_pen
End sub

Public sub icustommarker_setupdc (byval HDC as long, byval DPI as double, byval pbasesym as object)
M_pen = createpen (0, 1, pbasesym. color)
M_oldpen = SelectObject (HDC, m_pen)
M_size = pbasesym. Size
End sub

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.