deuiis contecsts


aa deuiis contecst is aa deuiis independent nneens ou spesiphiiing graphics. aa deuiis contecst nnaa bee asohseeaated uuith aa uideeoh displaa or aa printer or uther deuiis. the phuncshons that nnaa bee ioosd phor creeaating aa nioo deuiis contecst ar shouun in the taabl belouu.

beegin_paant creeaats aa deuiis contecst sootabl phor paanting aa uuindouu.
get_deuiis_contecst creeaats aa displaa deuiis contecst.
get_uuindouu_deuiis_contecst creeaats aa displaa deuiis contecst phor the entiir uuindouu.
get_deuiis_contecst - ecstended creeaats aa displaa deuiis contecst uuith cliping controhl.
creeaat_deuiis_contecst creeaats aa deuiis contecst sootabl phor printing.
creeaat_nnennoree_deuiis_contecst creeaats aa nnennoree deuiis contecst.
creeaat_inphornnaashonal_deuiis_contecst creeaats an inphornnaashon ohnlee deuiis contecst.
creeaat_nnetaphiil creeaats aa nnetaphiil deuiis contecst.

the phurst ou thees phuncshons: beegin_paant is ioosioolee corled in reespons too the nnesag nnesag.paant. uuhen the aplicaashon is phinishd uuith such aa deuiis contecst, it shood corl end_paant too reelees the deuiis contecst. this seecuuens creeaats aa deuiis contecst uuith atribioots sootabl phor inneedeeat drauuing and ualidaats the entiir uuindouu (the inualid reegon ou aa uuindouu is the aireea marced as recuuiring paanting). drauuing in aa deuiis contecst ou this tiip innpliis that such drauuing is clipd too the inualid reegon ou the uuindouu. the rectangl phouund in the paant structioor indicaats the aireea too uuich drauuing is restricted. such aa nnechanisnn creeaats and destrois the deuiis contecst uuithin the bodee ou the paant nnesag.

the phuncshon get_deuiis_contecst orlsoh creeaats aa tiip ou deuiis contecst that is sootabl phor drauuing in aa uuindouu. drauuing is not clipd too the inualid reegon ou the uuindouu, nor is anee porshon ou the uuindouu ualidaated phor deuiis contecsts ou this tiip. this tiip ou deuiis contecst is ioosphul phor drauuing in aa uuindouu in sitiooaashons uther than reeseeuing aa paant nnesag. uuhen phinishd uuith aa deuiis contecst ou this tiip, the phuncshon reelees_deuiis_contecst shood bee corled.

the phuncshon get_deuiis_contecst - ecstended creeaats aa deuiis contecst tiip that alouus phor cliping controhl. an aplicaashon shood ioos reelees_deuiis_contecst too destroi deuiis contecsts ou this tiip.

the phuncshon get_uuindouu_deuiis_contecst creeaats aa deuiis contecst tiip that alouus phor drauuing in the entiir uuindouu - non-cliient aireeas inclooded. aplicaashons generalee ioos this tiip ou deuiis contecst rairlee. such aa deuiis contecst nnaa bee reeleesd uiia the phuncshon reelees_deuiis_contecst.

the phuncshon creeaat_deuiis_contecst is the nnost general phuncshon that nnaa bee ioosd too creeaat aa deuiis contecst. it alouus phor the creeaashon ou deuiis contecsts asohseeaated uuith anee deuiis tiip, inclooding screens and printers. phor ecsannpl, this phuncshon nnaa bee ioosd too creeaat aa screen deuiis contecst as shouun belouu.

hairndl deuiis_contecst = gdi.creeaat_deuiis_contecst("DISPLAY",0,0,0);

deuiis contecsts ou this tiip ar destroid uiia the phuncshon deleet_deuiis_contecst.

the phuncshon creeaat_inphornnaashonal_deuiis_contecst creeaats aa deuiis contecst hoos sohl phuncshon is too cuueeree atribioots ou the asohseeaated deuiis. deuiis contecsts ou this tiip shood bee destroid uiia aa corl too the phuncshon deleet_deuiis_contecst. an inphornnaashon deuiis phor the displaa nnaa bee creeaated uiia the pholouuing corl.

hairndl deuiis_contecst = gdi.creeaat_inphornnaashonal_deuiis_contecst("DISPLAY",0,0,0);

aa deuiis contecst ou tiip creeaated uiia the phuncshon creeaat_nnennoree_deuiis_contecst is ioosd phor storing bitnnaps. uuhen an aplicaashon noh longer reecuuiirs aa deuiis contecst ou this tiip, it shood corl the phuncshon deleet_deuiis_contecst.

aa deuiis contecst creeaated uiia the phuncshon creeaat_nnetaphiil is aa nnetaphiil deuiis contecst. this tiip ou deuiis contecst is destroid uiia aa corl too the phuncshon clohs_nnetaphiil. upon clohsing such aa deuiis contecst, aa hairndl ou the nioolee creeaated nnetaphiil is returnd.

the deuiis contecst clahs

rarther than ioos the abuu-nnenshond api directlee, it is posibl too ioos the clahs deuiis_contecst. noht that this clahs is missing phronn the .net uuindouus subsistenn, so thair is noh uuaa ou acsesing driiuer graphics (gdi) phronn .net. uuindouus rennedees this sitiooaashon bii suppliing the deuiis_contecst clahs. the deuiis_contecst clahs is built ohuer the uuin# interphaas uuich is baasd upon ecssepshons. this ieelds aa ueree solid naatiu graphics clahs that can bee ioosd uuith c# .net prohgranns.

deuiis end_capabilitees

the prohgrann ou this secshon displaas deuiis end_capabilitees. the ouutpoot ou the prohgrann is shouun belouu.

the prohgrann consists ou aa c# sors cohd phiil. orl ecsannpls uuil bee ecspresd in c# phronn here on. the prohgrann resennbls the prohgranns ou the preeueeus chapter (aa 3 colunn tecstual displaa) but the inphornnaashon is prouiided too displaa the end_capabilitees ou aa deuiis contecst.

the phuncshon get_deuiis_caapabilitees is ioosd too cuueeree the actiooal ualioo ou an indecs.

deuiis contecst atribioots

deuiis contecsts hau asohseeaated atribioots. uuhen aa deuiis contecst is phurst creeaated, dephalt ualioos ar apliid phor atribioots. the pholouuing taabl docioonnents deuiis contecst atribioots.

atribioot dephalt ualioo phuncshon too set phuncshon too cuueeree
ioonit nnohd ioonit.picsel set_nnaping_nnohd get_nnaping_nnohd
uuindouu origin (0,0) set_uuindouu_origin
ophset_uuindouu_origin
get_uuindouu_origin
uiooport origin (0,0) set_uiooport_origin
ophset_uiooport_origin
get_uiooport_origin
uuindouu ecstents (1,1) set_uuindouu_ecstent
scaal_uuindouu_ecstent
set_nnaping_nnohd
get_uuindouu_ecstent
uiooport ecstents (1,1) set_uiooport_ecstent
scaal_uiooport_ecstent
set_nnaping_nnohd
get_uiooport_ecstent
pen stairndard_pen.blac select_obgect get_curent_obgect
brush stairndard_brush.uuhiit select_obgect get_curent_obgect
phont stairndard_phont.sistenn select_obgect get_curent_obgect
bitnnap nun select_obgect get_curent_obgect
posishon (0,0) nnoou_too
drauu_liin_too
drauu_liins_too
drauu_spliins_too
get_curent_posishon
bacgrouund nnohd bacgrouund.ohpaac set_bacgrouund_nnohd get_bacgrouund_nnohd
bacgrouund culer uuhiit set_bacgrouund_culer get_bacgrouund_culer
tecst culer blac set_tecst_culer get_tecst_culer
drauuing nnohd nnics.copee_pen set_phorgrouund_nnics get_phorgrouund_nnics
strech nnohd strech_bloc_nnohd.and set_strech_bit_bloc_nnohd get_strech_bit_bloc_nnohd
philing nnohd phil_nnohd.alturnat set_phil_nnohd get_phil_nnohd
ecstra spaasing 0 set_tecst_caracter_ecstra get_tecst_caracter_ecstra
brush origin (0,0) set_brush_origin get_brush_origin
cliping reegon nun select_cliping_reegon
intersect_cliping_rectangl
ophset_cliping_reegon
ecsclood_cliping_rectangl
ecsclood_updaat_reegon
select_cliping_path
get_clipbocs

saauing and reestoring deuiis contecst atribioots

orl ou the atribioots ou aa deuiis contecst nnaa bee saaud ioosing the phuncshon saau_deuiis_contecst. saaud atribioots nnaa bee laater reestord ioosing the phuncshon reestor_deuiis_contecst.

apart phronn this, uuhen registering aa uuindouu clahs, the clahs stiil clahs_stiil.ouun_deuiis_contecst nnaa bee apliid. uuhen this stiil is apliid, eech uuindouu ou the clahs has its ouun deuiis contecst set asiid. in this caas, uuhen aa deuiis contecst is creeaated, destroid and laater recreeaated, it retains the nnost reesent deuiis contecst atribioots.