Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Rotating a linklabel control

Posted on 2004-10-19
3
Medium Priority
?
206 Views
Last Modified: 2010-04-24
I think the title says it all really. I need to have a linklabel control rotate to 90 degrees. I have read hints about overloading the onpaint method of the control but I'm new to .Net and i'm not sure if this is the best way, or how to go about it.

Thanks for your time,
Dan
0
Comment
Question by:zomby_dog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 500 total points
ID: 12345729
Hi Zomby_dog,

When the problem really isn't the rotating of the label because that is simple,

    Private Sub LinkLabel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles LinkLabel1.Paint
        Dim fg As New Font(LinkLabel1.Font, FontStyle.Underline)
        Dim g As New StringFormat

        g.FormatFlags = StringFormatFlags.DirectionVertical
        e.Graphics.FillRectangle(New SolidBrush(LinkLabel1.BackColor), LinkLabel1.DisplayRectangle)
        e.Graphics.DrawString(LinkLabel1.Text, fg, New SolidBrush(Color.Blue), 0, 0, g)
    End Sub

the real problem is that you loose all the functionality of the linklabel class, which means you have to write your own class to accomodate the things like color change and mouse pointer changes.

0
 

Author Comment

by:zomby_dog
ID: 12345857
Cheers, I have got the text to rotate. The cursor does change when the mouse hovers over the control but only part of it, any ideas?

I have also added code much the same as yours above to the mousedown and mouseup events to change the colour, but only the part of the label which doesn't change the mouse cursor changes colour. Again any ideas?
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12346006
Hi Zomby_dog,

Like I said in my previous comment that that is the problem with overwriting the paint, you will have to write your own linklabel control to accomodate that. Which could mean a lot of work.

Just a small question is there only one link in the label or are there more ?

If there is only one maybe I can write a quick workaround.

The reason you only get the mousepointer in a small area is the fact that it only takes into account the original text which was horizontal, so you only get the linkmousepointer in the original text, the same goes for the color
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question