Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet365/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   361   362   363   364   365   366   367   368   ...   453
352

CHAPTER 16
ExtEnding ironPython Using C#
Defining the GetCurrentDisplayMode() Method
Sometimes you need to know whether the console is presented in a windowed or full-screen mode. A 
windowed console can get covered up and needs to share resources with other windows. In addition, 
the text in a windowed console can be small and hard to read. On a positive note, using a windowed 
console makes it easier to share data between applications. In most cases, the user will prefer that 
you use a windowed console to make it easier to multitask between applications. Listing 16-7 shows 
how to detect the current console display mode.
LISTINg 16-7: 
 Obtaining the current display mode
public OutputMode GetCurrentDisplayMode()
{
// Get the current display mode.
if (GetConsoleDisplayMode(ref DisplayMode))
// Determine if the console is in windowed mode.
if (DisplayMode == (UInt32)ConsoleDispMode.CONSOLE_WINDOWED)
return OutputMode.Windowed;
else
{
// If the console is fullscreen mode, determine which
// of the potential conditions are true.
switch (DisplayMode)
{
case (UInt32)ConsoleDispMode.CONSOLE_FULLSCREEN:
return OutputMode.Fullscreen;
case (UInt32)ConsoleDispMode.CONSOLE_FULLSCREEN_HARDWARE:
return OutputMode.HadwareAccess;
case (UInt32)ConsoleDispMode.CONSOLE_FULLSCREEN +
(UInt32)ConsoleDispMode.CONSOLE_FULLSCREEN_HARDWARE:
return OutputMode.FullscreenHardwareAccess;
}
}
// Return a default value.
return OutputMode.Unknown;
}
The code begins by calling 
GetConsoleDisplayMode()
to obtain the display mode as a numeric 
value. The information is returned in 
DisplayMode
, not as a return value from the function call. 
The function itself returns a success value that indicates the call was successful. The first 
if
state-
ment says that if the call is successful, then 
DisplayMode
will contain the console display mode, and 
that the application should proceed to process it. Because 
DisplayMode
provides a return value, you 
must include the 
ref
keyword when passing it to the Win32 API.
Now that the code has a display mode value, it needs to process it. If a console is in windowed 
mode, all the code has to do is return a value that says it’s windowed. However, full-screen mode 
548592c16.indd 352
2/24/10 12:49:27 PM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   361   362   363   364   365   366   367   368   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish