CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Posts
    109

    Printing a triangle

    Is there any easy way to print a small, right pointing triangle?
    I think wingdings has this type of triangle, but I cant get it to
    print correctly. Any chance any one has source code which shows
    how to get a wingding character into a CString? I can then
    print that.

    Please, any response any one can give me will be greatly
    appreciated.

    Sincerely,
    Danielle Brina (an overworked graduate student)

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Printing a triangle

    No . .you can't put a wingding-triangle in a CString, because a CString is just a string and wingding is font. So if you want to display a wingding, you need to use that font while displaying the content of the CString
    Last edited by Skizmo; May 28th, 2007 at 11:39 AM.

  3. #3
    Join Date
    May 2002
    Posts
    109

    Re: Printing a triangle

    If I go to this page:

    http://www.symbols.net/fontview/webdings/

    #4 is the triangle I am trying to print.

    How would I go about printing that? Any chance you have a snippet
    that you can share. Please, please, please.

    Sincerely,
    Danielle Brina (an overworked graduate student)

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Printing a triangle

    If you don't have the font (and obviously you don't) your code have to draw the triangle during the print operation. An alternative could be to draw a bitmap in the resource editor and load that bitmap during print but I think that is way more work.

    Check out the GDI function Polygon()

  5. #5
    Join Date
    Feb 2000
    Location
    Indore, India
    Posts
    1,046

    Re: Printing a triangle

    Hello,

    You can do that in many ways. Here are a few methods:

    1. If the pattern is available as part of a font, create the font (CreateFont or CreateFontIndirect), select it to the device context, write the string using TextOut or DrawText functions, deselct the font from device context and delete the font.

    2. Create a bitmap with the pattern. You can create the pattern from scratch or use the font and write the character using resource editor. Later display the bitmap on your display using BitBlt.

    3. Third method is to create the pattern using drawing / painting functions explicitely. Creating a polygon and painting the interior will be the best option.

    In each method, maximum you will have to write 5 or 6 lines of code. All are equally easy methods. Choice depends on your personal preference.

    Regards,
    Pravin.
    Let me know if I have helped by rating this post

    Recent FAQs

    Drag an image
    Area of a window exposed on desktop
    Display rotated bitmap

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured