Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys

Simple form with only one label on it that I want to rotate 180.

The following code has no errors that I can see yet it displayes nothing.

any ideas?

thank in advance

What I have tried:

Public Class Form1

Private Sub label1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles label1.Paint
label1.Text = ""
e.Graphics.TranslateTransform(lblPlayer1Chips.ClientSize.Width, lblPlayer1Chips.ClientSize.Height)
e.Graphics.RotateTransform(180)
e.Graphics.DrawString("upside down", label1.Font,
Brushes.Black, RectangleF.op_Implicit(label1.ClientRectangle))
End Sub
End Class
Posted
Updated 28-Feb-16 21:56pm
Comments
Peter_in_2780 28-Feb-16 23:17pm    
My guess is that you're drawing the text outside of the clipping region. Check what happens to the label's extents after the transaltion and rotation.
tgebrael 29-Feb-16 12:31pm    
Ty you were right I had to mess with the height and width properties but subtracting pixels to get it placed where I want it.

1 solution

Perhaps you rotate not the right area. Try the width and the Height of the Control for TranslateTransform ...

... and finally do a ResetTransform before finishing the Paint-Method ...
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900