C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Graphics »

Mathematics SET in Graphics view


Posted Date: 17 Aug 2009    Resource Type: Code Snippets    Category: Graphics
Author: Shunmuganathan MMember Level: Diamond    
Rating: 1 out of 5Points: 10



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



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Mathematics SET in Graphics view  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Rotate the string
Previous Resource: One movement with ControlPaint
Return to Discussion Resource Index
Post New Resource
Category: Graphics


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use