dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/samples radiobuttons.cs,1.1,1.2


From: Richard Baumann <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/samples radiobuttons.cs,1.1,1.2
Date: Mon, 25 Aug 2003 23:45:27 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/samples
In directory subversions:/tmp/cvs-serv22951/samples

Modified Files:
        radiobuttons.cs 
Log Message:
Apply patches #1797 and #1805. Add and implement group box drawing code 
to theme painters and add group box examples to samples/radiobuttons.cs.


Index: radiobuttons.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/samples/radiobuttons.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** radiobuttons.cs     3 Aug 2003 19:21:17 -0000       1.1
--- radiobuttons.cs     26 Aug 2003 03:45:24 -0000      1.2
***************
*** 3,6 ****
--- 3,7 ----
   *
   * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
+  * Copyright (C) 2003  Free Software Foundation, Inc.
   *
   * This program is free software, you can redistribute it and/or modify
***************
*** 27,31 ****
  {
        private RadioButton[] buttons = new RadioButton[6];
!       
        private RadioButtons()
        {
--- 28,33 ----
  {
        private RadioButton[] buttons = new RadioButton[6];
!       private GroupBox[] boxes = new GroupBox[4];
! 
        private RadioButtons()
        {
***************
*** 33,79 ****
                SetStyle(ControlStyles.ResizeRedraw, true);
  
!               buttons[0] = new RadioButton();
!               buttons[0].Location = new Point(10,10);
!               buttons[0].Size = new Size(300,20);
!               buttons[0].Text = "Appearance Normal , No FlatStyle";
                Controls.Add(buttons[0]);
  
!               buttons[1] = new RadioButton();
!               buttons[1].Location = new Point(10,40);
!               buttons[1].Size = new Size(300,20);
!               buttons[1].Text = "Apearance Normal , FlatStyle.Popup";
!               buttons[1].FlatStyle=FlatStyle.Popup;
                Controls.Add(buttons[1]);
  
!               buttons[2] = new RadioButton();
!               buttons[2].Location = new Point(10,70);
!               buttons[2].Size = new Size(300,20);
!               buttons[2].Text = "Appearance Normal , FlatStyle.Flat";
!               buttons[2].FlatStyle=FlatStyle.Flat;
                Controls.Add(buttons[2]);
  
!               buttons[3] = new RadioButton();
!               buttons[3].Location = new Point(10,100);
!               buttons[3].Size = new Size(300,20);
!               buttons[3].Text = "Apearance Button , FlatStyle.Popup";
!               buttons[3].Appearance=Appearance.Button;
!               buttons[3].FlatStyle=FlatStyle.Popup;
                Controls.Add(buttons[3]);
  
!               buttons[4] = new RadioButton();
!               buttons[4].Location = new Point(10,130);
!               buttons[4].Size = new Size(300,20);
!               buttons[4].Text = "Appearance Button , FlatStyle.Flat";
!               buttons[4].Appearance=Appearance.Button;
!               buttons[4].FlatStyle=FlatStyle.Flat;
                Controls.Add(buttons[4]);
  
!               buttons[5] = new RadioButton();
!               buttons[5].Location = new Point(10,160);
!               buttons[5].Size = new Size(300,20);
!               buttons[5].Text = "Appearance Button , FlatStyle.Standard";
!               buttons[5].Appearance=Appearance.Button;
!               buttons[5].FlatStyle=FlatStyle.Standard;
                Controls.Add(buttons[5]);
        }
  
--- 35,177 ----
                SetStyle(ControlStyles.ResizeRedraw, true);
  
!               int x = 10;
!               int y = 10;
!               Size size = new Size(300, 20);
!               String text;
!               FlatStyle style;
! 
!               Appearance app = (Appearance)0;
! 
!               // First Button
!               style = (FlatStyle)0;
!               text = "Appearance Normal , No FlatStyle";
!               buttons[0] = MakeButton(x, y, size, text, style, false, app, 
false);
                Controls.Add(buttons[0]);
+               y += 30;
  
!               // Second Button
!               style = FlatStyle.Popup;
!               text = "Apearance Normal , FlatStyle.Popup";
!               buttons[1] = MakeButton(x, y, size, text, style, true, app, 
false);
                Controls.Add(buttons[1]);
+               y += 30;
  
!               // Third Button
!               style = FlatStyle.Flat;
!               text = "Appearance Normal , FlatStyle.Flat";
!               buttons[2] = MakeButton(x, y, size, text, style, true, app, 
false);
                Controls.Add(buttons[2]);
+               y += 30;
+ 
+               // switch to button appearance
+               app = Appearance.Button;
  
!               // Fourth Button
!               style = FlatStyle.Popup;
!               text = "Apearance Button , FlatStyle.Popup";
!               buttons[3] = MakeButton(x, y, size, text, style, true, app, 
true);
                Controls.Add(buttons[3]);
+               y += 30;
  
!               // Fifth Button
!               style = FlatStyle.Flat;
!               text = "Appearance Button , FlatStyle.Flat";
!               buttons[4] = MakeButton(x, y, size, text, style, true, app, 
true);
                Controls.Add(buttons[4]);
+               y += 30;
  
!               // Sixth Button
!               style = FlatStyle.Standard;
!               text = "Appearance Button , FlatStyle.Standard";
!               buttons[5] = MakeButton(x, y, size, text, style, true, app, 
true);
                Controls.Add(buttons[5]);
+               y += 30;
+ 
+ 
+ 
+               String[] msgs;
+               size = new Size(200, 20);
+ 
+               // First Group
+               msgs = new String[] { "These", "are", "grouped." };
+               style = FlatStyle.Standard;
+               text = "FlatStyle.Standard";
+               boxes[0] = MakeGroup(x, y, text, style, size, msgs);
+               Controls.Add(boxes[0]);
+ 
+               // Calculate the rest of the position information
+               int x2 = x + boxes[0].Size.Width + 10;
+               int y2 = y + boxes[0].Size.Height + 10;
+ 
+               // Second Group
+               msgs = new String[] { "As", "are", "these." };
+               style = FlatStyle.Flat;
+               text = "FlatStyle.Flat";
+               boxes[1] = MakeGroup(x2, y, text, style, size, msgs);
+               Controls.Add(boxes[1]);
+ 
+               // Third Group
+               msgs = new String[] { "Here's", "another", "group." };
+               style = FlatStyle.Popup;
+               text = "FlatStyle.Popup";
+               boxes[2] = MakeGroup(x, y2, text, style, size, msgs);
+               Controls.Add(boxes[2]);
+ 
+               // Fourth Group
+               msgs = new String[] { "Here's", "another", "group." };
+               style = FlatStyle.System;
+               text = "FlatStyle.System";
+               boxes[3] = MakeGroup(x2, y2, text, style, size, msgs);
+               Controls.Add(boxes[3]);
+       }
+ 
+       private static RadioButton MakeButton
+               (int x, int y, Size size, String text, FlatStyle style,
+                bool setStyle, Appearance appearance, bool setAppearance)
+       {
+               RadioButton b = new RadioButton();
+               b.Location = new Point(x, y);
+               b.Size = size;
+               b.Text = text;
+               if(setAppearance)
+               {
+                       b.Appearance = appearance;
+               }
+               if(setStyle)
+               {
+                       b.FlatStyle = style;
+               }
+ 
+               return b;
+       }
+ 
+       private static GroupBox MakeGroup
+               (int x, int y, String text, FlatStyle style,
+                Size buttonSize, String[] buttonStrings)
+       {
+               int bHeight = buttonSize.Height;
+               int width = buttonSize.Width + 20;
+               int height = ((bHeight+10)*buttonStrings.Length) + 40;
+ 
+               GroupBox box = new GroupBox();
+               box.Size = new Size(width, height);
+               box.Location = new Point(x, y);
+               box.Text = text;
+               box.FlatStyle = style;
+ 
+               x += 10;
+               y += 40;
+ 
+               FlatStyle sNone = (FlatStyle)0;
+               Appearance aNone = (Appearance)0;
+ 
+               for(int i = 0; i < buttonStrings.Length; ++i)
+               {
+                       box.Controls.Add(MakeButton(x, y, buttonSize, 
buttonStrings[i],
+                                                   sNone, false, aNone, 
false));
+                       y += bHeight+10;
+               }
+ 
+               return box;
        }
  
***************
*** 81,86 ****
        {
                RadioButtons form = new RadioButtons();
!               form.Width = 400;
!               form.Height = 200;
                form.Text = "RadioButtons example";
                Application.Run(form);
--- 179,184 ----
        {
                RadioButtons form = new RadioButtons();
!               form.Width = 470;
!               form.Height = 470;
                form.Text = "RadioButtons example";
                Application.Run(form);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]