Download - c# - How to Display Only Minimize and Close Button on Caption Bar - Stack Overflow

Transcript
  • 7/4/2015 c#HowtodisplayonlyMinimizeandClosebuttononcaptionbarStackOverflow

    http://stackoverflow.com/questions/4510250/howtodisplayonlyminimizeandclosebuttononcaptionbar 1/1

    signup login tour help stackoverflowcareers

    Takethe2minutetour StackOverflowisaquestionandanswersiteforprofessionalandenthusiastprogrammers.It's100%free,noregistrationrequired.

    HowtodisplayonlyMinimizeandClosebuttononcaptionbar

    IonlywanttodisplaytheMinimizeandClosebuttonsonthecaptionbar,withouttheMaximizebuttonusingC#.netinWinFormApplication.IfIputthis.MaximizeBox=false,theMaximizebuttonisstilldisplayedalthoughitwillbedisabled.Anyhelpwillbeappreciated.PleaseProvidemeyourexcellentideas

    ThanksinAdvance.

    c# windows winforms controls

    editedDec24'10at13:12 askedDec22'10at14:37SharpUrBrain1,843 1 21 41

    2Answers

    Whatyouneedtodoispaintyourownwindowchrome.SeethisSOquestionforhowtodoso:

    Customtitlebars/chromeinaWinFormsapp

    answeredDec22'10at14:41CodingGorilla12.9k 16 42

    Ifyoudon'tmindlosingtheminimizebutton,youcouldusetheformsFormBorderStyletoFixedToolWindoworSizableToolWindow.Therearesomesideeffectstothisapproachthough(fromMSDN):

    FixedToolWindow:Atoolwindowborderthatisnotresizable.AtoolwindowdoesnotappearinthetaskbarorinthewindowthatappearswhentheuserpressesALT+TAB.AlthoughformsthatspecifyFixedToolWindowtypicallyarenotshowninthetaskbar,youmustalsoensurethattheShowInTaskbarpropertyissettofalse,sinceitsdefaultvalueistrue.

    SizableToolWindow:Aresizabletoolwindowborder.AtoolwindowdoesnotappearinthetaskbarorinthewindowthatappearswhentheuserpressesALT+TAB.

    Youcouldsetthecontrolboxpropertyontheformtofalse(butthenyoulosetheclosebuttonaswellastheminimizebutton).

    ItlookslikeyoushouldalsobeabletousethewindowsAPI(inthislinktheguyishidingtheclosebuttonforawpfapp,butIwouldthinkyoucouldrepurposeit)http://winsharp93.wordpress.com/2009/07/21/wpfhidethewindowbuttonsminimizerestoreandcloseandtheiconofawindow/

    answeredDec22'10at16:19ChrisClarke11 2