473,395 Members | 1,456 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,395 software developers and data experts.

Rotate screen

I have a tablet PC and I write a application on this tablet PC, I would like to rotate the screen from portrait<->landscape mode(or 90/180/270 degree), what should I do?

I only find the code for pocket PC 2003 upgrade.

private void SetOrientation(ScreenOrientation so)
{

// Set the requested orientation.
SystemSettings.ScreenOrientation.Angle0 = so;
this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString();
}
Nov 16 '05 #1
3 14975
Hi steve,

Try this:

private void Form1_Load(object sender, System.EventArgs e)
{
int scrRectHeight = Screen.PrimaryScreen.Bounds.Height;
int scrRectWidth = Screen.PrimaryScreen.Bounds.Width;

if (scrRectHeight > scrRectWidth)
{
MessageBox.Show("Run in portrait.");
}
else
{
MessageBox.Show("Run in landscape.");
}

Reference:
http://msdn.microsoft.com/library/de...reenorient.asp

Hope it helps. Correct me if i am wrong.
--
Regards,
Chua Wen Ching :)
"steve" wrote:
I have a tablet PC and I write a application on this tablet PC, I would like to rotate the screen from portrait<->landscape mode(or 90/180/270 degree), what should I do?

I only find the code for pocket PC 2003 upgrade.

private void SetOrientation(ScreenOrientation so)
{

// Set the requested orientation.
SystemSettings.ScreenOrientation.Angle0 = so;
this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString();
}

Nov 16 '05 #2
Chua Wen,

Thanks for the quick response, my question is how to rotate the tablet pc screen,
not detect the screen is portrait or landscape.

B. RGDS
Steve

"Chua Wen Ching" wrote:
Hi steve,

Try this:

private void Form1_Load(object sender, System.EventArgs e)
{
int scrRectHeight = Screen.PrimaryScreen.Bounds.Height;
int scrRectWidth = Screen.PrimaryScreen.Bounds.Width;

if (scrRectHeight > scrRectWidth)
{
MessageBox.Show("Run in portrait.");
}
else
{
MessageBox.Show("Run in landscape.");
}

Reference:
http://msdn.microsoft.com/library/de...reenorient.asp

Hope it helps. Correct me if i am wrong.
--
Regards,
Chua Wen Ching :)
"steve" wrote:
I have a tablet PC and I write a application on this tablet PC, I would like to rotate the screen from portrait<->landscape mode(or 90/180/270 degree), what should I do?

I only find the code for pocket PC 2003 upgrade.

private void SetOrientation(ScreenOrientation so)
{

// Set the requested orientation.
SystemSettings.ScreenOrientation.Angle0 = so;
this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString();
}

Nov 16 '05 #3
Hi steve,

Well since you already have the values of scrRectHeight and scrRectWidth, you can assume it as x an y.

There is a button, when you click, it actually execute this code:

private void button1_Click(object sender, System.EventArgs e)
{
this.ClientSize = new System.Drawing.Size(scrRectWidth, scrRectWidth);
}

You can switch between both, maybe 1 button or separate buttons.

Hope this is what you want! Good Luck again!
--
Regards,
Chua Wen Ching :)
"steve" wrote:
Chua Wen,

Thanks for the quick response, my question is how to rotate the tablet pc screen,
not detect the screen is portrait or landscape.

B. RGDS
Steve

"Chua Wen Ching" wrote:
Hi steve,

Try this:

private void Form1_Load(object sender, System.EventArgs e)
{
int scrRectHeight = Screen.PrimaryScreen.Bounds.Height;
int scrRectWidth = Screen.PrimaryScreen.Bounds.Width;

if (scrRectHeight > scrRectWidth)
{
MessageBox.Show("Run in portrait.");
}
else
{
MessageBox.Show("Run in landscape.");
}

Reference:
http://msdn.microsoft.com/library/de...reenorient.asp

Hope it helps. Correct me if i am wrong.
--
Regards,
Chua Wen Ching :)
"steve" wrote:
I have a tablet PC and I write a application on this tablet PC, I would like to rotate the screen from portrait<->landscape mode(or 90/180/270 degree), what should I do?

I only find the code for pocket PC 2003 upgrade.

private void SetOrientation(ScreenOrientation so)
{

// Set the requested orientation.
SystemSettings.ScreenOrientation.Angle0 = so;
this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString();
}

Nov 16 '05 #4

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

Similar topics

10
by: Apostolis K. | last post by:
I include an AdRotator component but the component doesn't rotate the ads _index.asp_ <% Set objAd=Server.CreateObject("MSWC.AdRotator") vAdRotation=objAd.GetAdvertisement("ads.txt") ...
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...
3
by: byrd48 | last post by:
Hi, I am developing a web site which allows users to upload and share photos. I have a datalist which lists the photos and has the usual edit, update commands. Within the edititemtemplate, I...
17
by: santel_helvis | last post by:
Hi All, Could anyone tell me how to rotate the image in javascript. Which concepts I should concentrate to rotate the image
4
by: jor | last post by:
I want to rotate screen, but i don't know how to start. Have anyone even programed about this or known to refer to some information? Thanks.
0
by: iwdu15 | last post by:
hi, im drawing about 6 GDI drawn objects on the screen. How can i make each one rotate individually in different directions, speeds, etc? ive looked everywhere and cant seem to figure it out --...
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...
10
by: Joey_Stacks | last post by:
Does anyone know of a scipt that will rotate random div layers on page refresh? I have a primary content area front and center on my site homepage, and I'd like to rotate various chunks of html...
0
by: Alexey Zalivin | last post by:
Hi, I'm not sure, but reference MSDN ChangeDisplaySettingsEx can rotate screen if video driver support it. I try the third part products like IRotate and Pivot Pro and find that it really works....
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.