Description : Normally We are using following the words in SET Mathematics
1. Replace 2. Intersect 3. Union 4. Xor 5. Exclude 6. Complement
Following is the namespace used
using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms;
The following code will explain the SET Mathematics clearly
namespace WindowsApplication1 { public partial class Form1 : Form { string stringCaption = "CombineMode = "; MenuItem MenuCombineMode; protected override void OnPaint(PaintEventArgs pea) { DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height); } public Form1() { InitializeComponent(); ResizeRedraw = true; Menu = new MainMenu(); Menu.MenuItems.Add("&CombineMode"); EventHandler ehClick = new EventHandler(MenuCombineModeOnClick); for (int i = 0; i < 6; i++) { MenuItem MyMI = new MenuItem("&" + (CombineMode)i); MyMI.Click += ehClick; MyMI.RadioCheck = true; Menu.MenuItems[0].MenuItems.Add(MyMI); } MenuCombineMode = Menu.MenuItems[0].MenuItems[0]; MenuCombineMode.Checked = true; } void MenuCombineModeOnClick(object obj, EventArgs ea) { MenuCombineMode.Checked = false; MenuCombineMode = (MenuItem) obj; MenuCombineMode.Checked = true; Text = stringCaption + (CombineMode)MenuCombineMode.Index; Invalidate(); } protected void DoPage(Graphics grfx, Color clr, int cx, int cy) { GraphicsPath path = new GraphicsPath(); path.AddEllipse(0, 0, 2 * cx / 3, cy); grfx.SetClip(path); path.Reset(); path.AddEllipse(cx / 3, 0, 2 * cx / 3, cy); grfx.SetClip(path, (CombineMode)MenuCombineMode.Index); grfx.FillRectangle(Brushes.Red, 0, 0, cx, cy); } } }
By Nathan
|
No responses found. Be the first to respond and make money from revenue sharing program.
|