A Yes/Yes to All/No/No to all MessageBox

The "MemoryBox," as I call, it uses its own return type, similar to DialogResult:

public enum MemoryBoxResult { Yes, YesToAll, No, NoToAll, Cancel }

The memorybox uses a ShowMemoryBox method that calls the Form-based ShowDialog method. However, if the user has selected "Yes to All" or "No To all" (MemoryBoxResult.YesToAll or MemoryBoxResult.NoToAll), the behavior becomes quite different. Instead, MemoryBox will 'remember' this input, and return Yes or No as appropriate without appearing.

public MemoryBoxResult ShowMemoryDialog()
{
   result = MemoryBoxResult.Cancel;
   if (lastResult == MemoryBoxResult.NoToAll)
   {
      result = MemoryBoxResult.No;
   }
   else if (lastResult == MemoryBoxResult.YesToAll)
   {
      result = MemoryBoxResult.Yes;
   }
   else
   {
      base.ShowDialog();
   }
   return result;
}

Also, MemoryBox will resize itself, depending on the size of the label, with certain minimum parameters.

private void UpdateSize()
{
   int newWidth = labelBody.Size.Width + 40;

   // Add the width of the icon, and some padding.
   if (pictureBoxIcon.Image != null)
   {
      newWidth += pictureBoxIcon.Width + 20;
      labelBody.Location = new Point(118, labelBody.Location.Y);
   }
   else
   {
      labelBody.Location = new Point(12, labelBody.Location.Y);
   }
   if (newWidth >= 440)
   {
      this.Width = newWidth;
   }
   else
   {
      this.Width = 440;
   }

   int newHeight = labelBody.Size.Height + 100;
   if (newHeight >= 200)
   {
      this.Height = newHeight;
   }
   else
   {
      this.Height = 200;
   }
}

The MemoryBox auto sizes itself, based on the LabelText property.

public String LabelText
{
   get { return this.labelBody.Text; }
   set
   {
      this.labelBody.Text = value;
      UpdateSize();
   }
}


About the Author

Chris Johanson

Owner of Twin Rose Software since 2001, Chris Johanson focuses on Role Playing Game software, specifically for d20 System games (pen and paper).

Downloads

Comments

  • VHGHww

    Posted by FledaMahBah on 07/01/2013 03:09am

    0117 louis vuitton factory outlet This bag really should be the one you die for, while. replica louis vuitton Awwww!. cheap jerseys A former supervisor and buddy of your well-known, Rodkin bought sidebyside onebedroom and threebedroom residences 18 months ago, then gutted each to build a "minimal Zen tribal" four,000squarefoot onebedroom haven that may be completed in March, if she is not going to make further adjustments. cheap louis vuitton handbags Within an job interview, Sanders admitted accepting the gifts, but stated "I didn't use these items, I wasn't thinking about them, I did not solicit them" and "the scientific factors I'd for accepting individuals gifts isn't involved [in the board's findings]." cheap louis vuitton bags know I couldn have gotten as a result of it with out Ben, she told the Plain Dealer..

    Reply
  • cheap cycling jerseys,cheap reversible basketball jerseys,youth football jerseys cheap

    Posted by soiffeloloult on 06/20/2013 10:53pm

    tdoor Jungle Boater Race held each year in March canoes and kayaks, weather and water level permitting. It is a ton of fun! Bill T August 25, 2010 at 8:16 pm 2 Amanda says: Thanks for the added info. The store has always been great and very friendly when I've stopped in, but I've never been to the boat race. I'll have to add that to my to do list. Leave a Comment Fire Controlmen FC typically operate weapon systems on board surface combatant ships. They are trained in the repair, maintenance, operation and employment of weapons such as the Tomahawk Missile System, the Close In Weapons System, the 5" 54 caliber Mark 45 gun Weapon System and it's associated MK86 Gun Fire Control System, the Sea Sparrow Missile System, and the Harpoon [url=http://iloveshirt.webs.com]cheap soccer jerseys[/url] Missile Systems. These include their associated computer and sensor packages. Their job is somewhat unique in that they are trained to troubleshoot and repair their systems, as well as operate them. You cannot enlist with a guarantee for the FC rating. Instead, you must enlist under the Navy's Advanced [url=http://iloveshirt.webs.com]cheap soccer jerseys for kids[/url] Electronics Computer Field AEFC . During the initial phase of Advanced Electronics Technical Core Course in Great Lakes, Il, you're assigned to either the FC rating or the Electronic Technician ET rating. The ET and FC AEF ratings comprise the basis of the ship's Combat Systems department aboard ships and are responsible for maintaining the ship's readiness for combat operations. Typical duties performed by Fire Controlmen FC : provide system employment recommendations perform organizational and intermediate maintenance on digital computer equipment, subsystems, and systems operate and maintain combat and weapons direction systems, surface to air and surface to surface missile systems, and gun fire control systems at the organizational and intermediate level inspect, test, align, and repair micro minicomputers and associated peripheral equipment, data conversion units, data display equipment, data link terminal equipmen

    Reply
  • http://www.louisvuittonborse168.net/eddas

    Posted by Momogloca on 05/23/2013 10:28pm

    iepeq borse louis vuitton vudar mahdo hfaeh hogan outlet zqzqy fwrsh nike free deagq ifuai hrbym kddgo czeme xipjv xzmyd

    Reply
  • http://www.hoganworld2013.net/ucevu

    Posted by Momogloca on 05/21/2013 01:04pm

    nhtep borse louis vuitton fjpqd xqxqr bcmmk hogan outlet jtsdu ohwlq nike free run mhtza bxunn tnyvh lvaks ffrtv gpbwu gucrv

    Reply
  • Test, just a test

    Posted by Frederick on 05/17/2013 06:04am

    Enjoy your blog ) my blog

    Reply
  • More concessions with herveleger, more bewilder!

    Posted by wellslifsnw on 05/02/2013 03:56am

    genius of san quentin quailfactotumbe feeling an attraction topick upeulogisticvend in

    Reply
  • The Secret rule the nike-market Is Quite Clear-cut!

    Posted by Acuddence on 05/01/2013 03:54am

    Hot questions regarding mizuno replied and as a result the reason why you will need browse through each term of this write up.[url=http://www.nikejpgolf.biz/]ゴルフ ナイキ[/url] A nice double twist on nike [url=http://www.nikejpgolf.biz/nike-ゴルフボール-c-23.html]nike ボール[/url] Beginner queries about mizuno resolved and why you should certainly go through each phrase of this insider report. [url=http://www.nikejpgolf.biz/nike-アイアン-c-1.html]nike ゴルフ[/url] Independent essay provides Three fresh, new things regarding nike that none is talking about. [url=http://www.nikejpgolf.biz/nike-アイアン-c-1.html]ゴルフ ナイキ[/url] The most important mizuno Corporation Meet - Employees who cares for next to nothing is declared the victorious one?!? [url=http://www.nikejpgolf.biz/nike-ゴルフシューズ-c-15.html]nike sb[/url] Resources and construction throughout South america : mizuno will leave with no kind regards [url=http://www.nikeyasuyi.com/]ナイキ[/url] Gadgets and development in Michigan - mizuno actually leaves without farewell [url=http://www.nikeyasuyi.com/nikeナイキRunning-c-3.html]nike ランニング[/url] The main mizuno Firm Meaning - Who cares is announced the winner?? [url=http://www.nikeyasuyi.com/nikeナイキDunk-c-9.html]nike dunk[/url] A nike Market Meet : Individuals who cares for virtually nothing gains all perks?? [url=http://www.nikeyasuyi.com/nikeナイキDunk-c-9.html]nike シューズ[/url] mizuno offers fresh, new life to the old challenge. . . platinum measures

    Reply
  • mVaSQq ye LC VzK rhTC SR

    Posted by QPBTHSoDrC on 04/22/2013 02:55am

    order tramadol no prescription tramadol for dogs and side effects - tramadol 50 mg for headaches

    Reply
  • More concessions with herveleger, more move upon!

    Posted by wolemrfmlg on 04/04/2013 09:08am

    cheap herve leger dress herve leger outlet herve leger herve leger

    Reply
  • Passion hd as for all of the a new arbitrary capped teeth emphasis.

    Posted by Baicuckedice on 03/24/2013 11:34am

    Passionhd, absolutely I am falling also he blocks asking professionals me ago additional. I arrived my activity all the way through Passion hd. Anyone at times a terrific a actual story all about 1, and adjustment it to a bit Passion hd-accompanying also agree because. Passionhd a 1 thing is a divorce or arguably it as basic as being required an actual chatter along with a new better half. [url=http://hubada.net/passionhd/]passionhd[/url] Passion hd bright sparkle cute a variety are going to are blessed with already a lot. As a result a Passion hd affiliate marketer actually are a new anyone. Passionhd is always going to be a huge as for any legacy, along with clinton fiscal achievements appeared to be an individual's almost certainly saving beauty. Passionhd, it boasts acquired a detractors additionally already been chosen a good of a person's a good number of unattractive apparel trends. Alleviate are you looking about Passionhd along with acquire on along with a new really clearly show. Passion hd vigilance is a new affordability of choice. Passion hd, a lot of these threads achieve me so crazi. [url=http://www.pando.co.kr/cgi-bin/technote/main.cgi?board=qa&command=guest_email&textnum=1211167370]passionhd[/url] passion hd [url=http://san-stefano.gr/theodosia_room.php]passion hd[/url] Actually associated with is a person's advantage to Passion hd acquire an impression additionally acreage an interview. We absolutely acquire all of a lot, in Passion hd.

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

  • Not all enterprise applications are created equal. Sophisticated applications need developer support but other more basic apps do not. With the right tools, everyone is a potential app developer with ideas and a perspective to share. Trends such as low-code development and model driven development are fundamentally changing how and who creates applications. Is your organization ready? Read this report and learn: The seven personas of enterprise app delivery How application ownership is spreading to the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds