473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

rotate control

Hi,

Is it possible to rotate a control on a form ? (e.g. Button, customcontrol)

thnx
Christian
Nov 21 '05 #1
4 6906
Chris,

The most simple format is to set the width larger than the height, however I
assume that you want to rotate it completly.

Normally you should find information about this on the pages from Bob Powell
which are
www.bobpowell.net

The newsgroup where he is very active it not in your crossposting

microsoft.public.dotnet.framework.drawing

What I have seen in this newsgroups is, that after they had implemented GDI+
for this, people where disapointed because there programs became slow. So
keep that in mind.

I hope this helps something?

Cor
"Chris" <ch********@pandora.be> schreef in bericht
news:WM******************@phobos.telenet-ops.be...
Hi,

Is it possible to rotate a control on a form ? (e.g. Button,
customcontrol)

thnx
Christian

Nov 21 '05 #2
"Chris" <ch********@pandora.be> schrieb:
Is it possible to rotate a control on a form ? (e.g. Button,
customcontrol)


No.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #3
Christian,
In addition to the other comments.

If you handle all the painting of the control yourself (as Cor suggested).
You can use Graphics.RotateTransform to rotate the painting surface before
you do any drawing. You may also need to use Graphics.TranslateTransform to
move the origin...

You would need to override the Paint event if they allow it.

Something like:

Imports System.ComponentModel
Imports System.Windows.Forms

Public Class RotatedLabel
Inherits Label

Private m_angle As Integer

Public Sub New()
' Stop the flicker
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.DoubleBuffer, True)
'Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.UpdateStyles()
End Sub

<Description("Amount to rotate the text"), _
Category("Appearance"), _
DefaultValue(0)> _
Public Property Angle() As Integer
Get
Return m_angle
End Get
Set(ByVal value As Integer)
m_angle = value
Invalidate()
End Set
End Property

Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
With e.Graphics
.TranslateTransform(MyBase.ClientSize.Width / 2.0F,
MyBase.ClientSize.Height / 2.0F)
.RotateTransform(m_angle)
.Clear(MyBase.BackColor)
Dim brush As New SolidBrush(MyBase.ForeColor)
.DrawString(MyBase.Text, MyBase.Font, brush, 0, 0)
brush.Dispose()
End With
End Sub

End Class

Some controls, such as the TabControl have limited built-in support for
"rotation" for example see TablControl.Alignment.

In addition to Bob Powell's web site the Cor reference, Charles Petzold's
book "Programming Microsoft Windows with Microsoft Visual Basic .NET"
provides a wealth of information on using GDI+.

Hope this helps
Jay

"Chris" <ch********@pandora.be> wrote in message
news:WM******************@phobos.telenet-ops.be...
Hi,

Is it possible to rotate a control on a form ? (e.g. Button,
customcontrol)

thnx
Christian

Nov 21 '05 #4
Hi Chris.

If you want to rotate everything you draw on the control's client area the
other posters gave you the solutions.
If you want to rotate the controls in a fashion where the caption, menus,
caret, buttons are rotated and all the mouse clicks take's into acount
this. I'd say it is impossible.

--
HTH
Stoitcho Goutsev (100) [C# MVP]
"Chris" <ch********@pandora.be> wrote in message
news:WM******************@phobos.telenet-ops.be...
Hi,

Is it possible to rotate a control on a form ? (e.g. Button,
customcontrol)

thnx
Christian

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: taccea | last post by:
Hello, I need to rotate some text vertically on an Access report. Is that something difficult to do? Any pointers appreciated. Taccea
3
by: Chris | last post by:
Hi, Is it possible to rotate a control on a form ? (e.g. Button, customcontrol) thnx Christian
1
by: Jay | last post by:
I'm wondering if anyone has even encountered a control or other scripting that will automatically rotate the rows of a datagrid... I am in the process of building an asp.net application that will...
1
by: Rohan | last post by:
Hi There, Is it possible to rotate or resize pictureboxes, labels, textboxes at runtime? And I even wanted to make textbox and label controls Transperent ?
8
by: lovecreatesbeauty | last post by:
I write a function to rotate a matrix by 90 degrees clockwise, this function works on a matrix of specific size, for example, it rotates a 4*4 matrix of integers in the following code. The function...
1
by: iwdu15 | last post by:
hi, i need to rotate a string (ex, make it upside down and if it was on the top, make it on the bottom of my control). the string is drawn on using GDI, so i looked at the Transform property, the...
3
by: moondaddy | last post by:
I'm working in a WPF windows application and am wondering if it's possible to rotate a Canvas or user control derived from Canvas. I created a user control which derives from Canvas and I need to...
3
by: Diego F. | last post by:
Hi all. I have a listview with images and my application must be able to rotate one image. I need a method to rotate 90 degrees rigth (i.e.). Is that possible? -- Regards, Diego F.
8
by: =?Utf-8?B?RGFu?= | last post by:
I would like to draw an ellipse on a windows form and through mouse drags stretch, rotate and relocate the ellipse. Thanks in advance - Dan
13
by: =?Utf-8?B?dmlubw==?= | last post by:
Hello, I have created my proper control and i would to rotate it. In the paint event of my object, i have written : Dim graph As Graphics = myObject.CreateGraphics myMatrix = New...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.