Rotating Controls

DiGiTGOD

New member
Joined
Jul 15, 2007
Messages
3
Programming Experience
1-3
Hi,

I need some desperate help... I've been trying to do this for a couple of weeks... and I just need to get it done before my head implodes...

I have a series of text documents...

I want to be able to view these on a second screen... I want them to be maximised, fitted to the page (i.e. no scrolling necessary.) and the big thing is... rotated by 90 degrees (this is because the second monitor will be widescreen and on it's side soo more text can be viewed).

I have sorted the maximising of the control, and outputting it to the second screen...

The things I am struggling with are, resizing the font so that all the Text appears on the page, and rotating it.

I've tried a few things... using a RichTextBox or using a PDF control. Neither of these I can rotate. Although the PDF control gives me the ability fit everything 1 page as it saved that way...

As a last resort I can always save them as images... and Rotate them that way... but I don't want to do that, as I'm sure there is a way to do it this way...

Can anyone point me in the direction of a solution???

Kind Regards,
Martin
 
Rotation when screen is tilted is a setting of the graphics adapter, if the driver supports it - which most have been supporting for many years because it is easy to do with flat panels. That way all applications will be displayed properly when screen is in that mode. For example for NVidia cards there is the NVRotate page in the display settings for that screen where the tilt options is set.
 
Thanks for the reply...

I want to be able to do it in code... purely for the reason that I don't want the user to be have to do any messing with the graphics adapter...

I may well have to do go about it through that route...

With that in mind... if it is not going to be possible to rotate it "On-The-Fly"... How about fitting the text to screen???

I was thinking of possibly getting the total amount of lines and then working out the height of the screen... and doing some maths to work out what the font height should be...

problem being I can't seem to set the font height correctly... I can only seem to find the property for the font size and this doesn't relate to pixels like I need...
 
If the monitor is tilted and display output is not, then it is misconfigured, simple as that and not an issue of "messing with the configuration". You do not expect to tell a user to lay the screen on its side to read this textbox, if that is not how the screen is normally used and configured to do?
 
You are right... and it is probably just me being petty... just something that I want to do....

At the end of the day... I'm going to be setting up the program on the 1 or 2 machines it will be used on anyway...

Setting up the graphics adapter looks like the best way...

still need to work out this fitting to 1 screen though...
 
I was thinking of possibly getting the total amount of lines and then working out the height of the screen... and doing some maths to work out what the font height should be...

problem being I can't seem to set the font height correctly... I can only seem to find the property for the font size and this doesn't relate to pixels like I need...

If you want to zoom the text to best fit height try this:
VB.NET:
    Sub zoomRTBheight(ByVal rtb As RichTextBox)
        Dim ratio As Single = rtb.ClientSize.Height / (rtb.Font.GetHeight * (rtb.Lines.Length + 1))
        RichTextBox1.ZoomFactor = ratio
    End Sub
To max form set WindowState=Maximized, to max RTB in form set its Dock=Fill.
 
Back
Top