Results 1 to 3 of 3

Thread: changing shape in label

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2008
    Posts
    327

    changing shape in label

    label are rectangular in shape.. and i need a label that is slanting from the sides.. currently i am using a shape which has a label inside.. i only can get a round shape,oval ,rectangular or square... how would i cut the shape of label such that is is slanting from the sides..
    Code:
      -----------------
     '  this is the    \
     ' shape i want     \
     '-------------------
    Last edited by pannam; Apr 5th, 2009 at 02:34 AM.

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: changing shape in label

    pananam, insted of a lable, you should talke a look at SetWorldTransform() api & TextOut() Api

    a c++ example http://www.codeproject.com/KB/cpp/oblique_txt.aspx
    Last edited by Fazi; Apr 5th, 2009 at 03:46 AM.

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: changing shape in label

    How about this... You can then place your text in that shape

    vb Code:
    1. Private Declare Function CreatePolygonRgn Lib "gdi32" _
    2. (lpPoint As Any, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
    3. Private Declare Function Polygon Lib "gdi32" _
    4. (ByVal hdc As Long, lpPoint As Any, ByVal nCount As Long) As Long
    5. Private Declare Function FillRgn Lib "gdi32" _
    6. (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long
    7. Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
    8. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
    9.  
    10. Const ALTERNATE = 1
    11. '~~> Constants for FillMode.
    12. Const WINDING = 2
    13. '~~> Constant for brush type.
    14. Const BLACKBRUSH = 4
    15.  
    16. Private Type COORD
    17.     x As Long
    18.     y As Long
    19. End Type
    20. Private Sub Form_Paint()
    21.     Dim poly(1 To 4) As COORD, NumCoords As Long, hBrush As Long, hRgn As Long
    22.     Me.Cls
    23.    
    24.     '~~> Number of vertices in polygon.
    25.     NumCoords = 4
    26.     '~~> Set scalemode to pixels to set up points of triangle.
    27.     Me.ScaleMode = vbPixels
    28.     '~~> Assign values to points.
    29.     poly(1).x = 30
    30.     poly(1).y = 30
    31.     poly(2).x = 30
    32.     poly(2).y = 0
    33.     poly(3).x = 370
    34.     poly(3).y = 0
    35.     poly(4).x = 400
    36.     poly(4).y = 30
    37.     '~~> Polygon function creates unfilled polygon on screen.
    38.     '~~> Comment FillRgn statement to see results.
    39.     Polygon Me.hdc, poly(1), NumCoords
    40.     '~~> Gets stock black brush.
    41.     hBrush = GetStockObject(BLACKBRUSH)
    42.     '~~> Creates region to fill with color.
    43.     hRgn = CreatePolygonRgn(poly(1), NumCoords, ALTERNATE)
    44.     '~~> If the creation of the region was successful then color.
    45.     If hRgn Then FillRgn Me.hdc, hRgn, hBrush
    46.     DeleteObject hRgn
    47. End Sub
    48. Private Sub Form_Resize()
    49.     Form_Paint
    50. End Sub

    Hope this helps...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

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