PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : C# Bildschirm drehen?



pc17
01.07.2010, 14:43
Hallo Leute,

weiß jemand wie man mit C# den Bildschirm/Desktop auf den Kopf stellen kann? Oder wie man die Maus verzerht nachziehen kann ich finde einfach nichts passendes dafür.

Mfg PC17

EBFE
01.07.2010, 15:02
müsste die ChangeDisplaySettingsEx API sein mit "dmDisplayOrientation" Member:
Change Display Settings Programmatically - C#, ASP.Net, VB.Net (http://www.dotnetspark.com/kb/1948-change-display-settings-programmatically.aspx)
ist auch ein Beispiel dabei
http://www.dotnetspark.com/Attachment/elsheimy_634090370563870000_Display%20Settings%20S ample.zip

pc17
02.07.2010, 16:59
Danke für den Link.

Da ist auch ein super Bespiel wie man den Desktop drehen kann aber bei mir kommt immer eine Fehlermeldung! Der Code ist fast ganz am Ende.

Das ist die Methode vom Code:

public static void RotateScreen(bool clockwise)
{
// Retrieving current settings
// ...

// Rotating the screen
if (clockwise)
if (newMode.dmDisplayOrientation DMDO_DEFAULT)
{
newMode.dmDisplayOrientation--;
}
//else
//newMode.dmDisplayOrientation = DMDO_270;

// Swapping width and height;
uint temp = newMode.dmPelsWidth;
newMode.dmPelsWidth = newMode.dmPelsHeight;
newMode.dmPelsHeight = temp;

// Capturing the operation result
// ...
}

Die Meldungen kommen bei DMDO_DEFAULT.
Fehlermeldung:
Fehler 1 ) erwartet.
Fehler 2 ; erwartet.
Fehler 3 Ungültiger Ausdruck ")".
Fehler 4 ; erwartet.

Wieso passt ihm das nicht?
Bei einer if Anweisung gehört ja kein ";" .

inmate
02.07.2010, 17:04
public static void RotateScreen(bool clockwise)
{
// Retrieving current settings
// ...

// Rotating the screen
if (clockwise) { // <- ?
if (newMode.dmDisplayOrientation DMDO_DEFAULT)
{
newMode.dmDisplayOrientation--;
}
//else
//newMode.dmDisplayOrientation = DMDO_270;

// Swapping width and height;
uint temp = newMode.dmPelsWidth;
newMode.dmPelsWidth = newMode.dmPelsHeight;
newMode.dmPelsHeight = temp;

// Capturing the operation result
// ...
}

pc17
03.07.2010, 17:57
Das Prog wir bei mir nicht unterstützt, ich kann den Bildschirm nicht drehen.

MfG PC17