Click here to Skip to main content
15,888,454 members
Home / Discussions / C#
   

C#

 
Questionone object's private variable affecting another object's, but it shouldn't [modified] Pin
dfn10-Sep-07 16:23
dfn10-Sep-07 16:23 
Questioncreating a mp3 scratching program [modified] Pin
dman1000110-Sep-07 12:50
dman1000110-Sep-07 12:50 
AnswerRe: creating a mp3 scratching program Pin
VirtualVoid.NET10-Sep-07 21:46
VirtualVoid.NET10-Sep-07 21:46 
QuestionArray of Regions. Elements seem to disappear. [modified] Pin
hain10-Sep-07 11:18
hain10-Sep-07 11:18 
AnswerRe: Array of Regions. Elements seem to disappear. Pin
Giorgi Dalakishvili10-Sep-07 11:24
mentorGiorgi Dalakishvili10-Sep-07 11:24 
GeneralRe: Simple code example [modified] Pin
hain10-Sep-07 12:28
hain10-Sep-07 12:28 
GeneralRe: Simple code example Pin
Patrick Etc.10-Sep-07 12:49
Patrick Etc.10-Sep-07 12:49 
GeneralRe: Simple code example Pin
hain10-Sep-07 16:12
hain10-Sep-07 16:12 
Wow... thanks, Patrick.

Hmm, this is not the behaviour one would expect, but who
says life should be predictable Sigh | :sigh: .

My workaround was:

-----------------------------
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace RegionTest
{
public partial class Form1 : Form
{
RegionData[] regionData = new RegionData[2];
int currRegionIndex = 0;
MyControl myControl = new MyControl();
public Form1()
{
InitializeComponent();
GraphicsPath gp0 = new GraphicsPath();
gp0.AddEllipse(myControl.ClientRectangle);
regionData[0] = (new Region(gp0)).GetRegionData();
GraphicsPath gp1 = new GraphicsPath();
gp1.AddRectangle(myControl.ClientRectangle);
regionData[1] = (new Region(gp1)).GetRegionData();
myControl.Region = new Region(region[0]);
Controls.Add(myControl);
}

private void button1_Click(object sender, EventArgs e)
{
currRegionIndex = (currRegionIndex + 1) % 2;
myControl.Region = new Region(regionData[currRegionIndex]);
myControl.Refresh();
}
}
}
-----------------------------

which in the end is similar to yours in efficiency (I guess)
but yours is more elegant.

Tom
QuestionModal Dialog [modified] Pin
kamalesh8210-Sep-07 9:34
kamalesh8210-Sep-07 9:34 
AnswerRe: Modal Dialog Pin
Christian Graus10-Sep-07 9:52
protectorChristian Graus10-Sep-07 9:52 
GeneralRe: Modal Dialog Pin
kamalesh8210-Sep-07 9:58
kamalesh8210-Sep-07 9:58 
GeneralRe: Modal Dialog Pin
Christian Graus10-Sep-07 10:00
protectorChristian Graus10-Sep-07 10:00 
QuestionPicture Box created by code not showing up Pin
Jordanwb10-Sep-07 9:09
Jordanwb10-Sep-07 9:09 
AnswerRe: Picture Box created by code not showing up Pin
Ermak8610-Sep-07 9:38
Ermak8610-Sep-07 9:38 
GeneralRe: Picture Box created by code not showing up Pin
Jordanwb10-Sep-07 9:53
Jordanwb10-Sep-07 9:53 
GeneralRe: Picture Box created by code not showing up Pin
Christian Graus10-Sep-07 9:55
protectorChristian Graus10-Sep-07 9:55 
GeneralRe: Picture Box created by code not showing up Pin
Jordanwb10-Sep-07 9:58
Jordanwb10-Sep-07 9:58 
GeneralRe: Picture Box created by code not showing up Pin
Ermak8610-Sep-07 10:02
Ermak8610-Sep-07 10:02 
GeneralRe: Picture Box created by code not showing up Pin
Jordanwb10-Sep-07 10:04
Jordanwb10-Sep-07 10:04 
GeneralRe: Picture Box created by code not showing up Pin
Ermak8610-Sep-07 10:13
Ermak8610-Sep-07 10:13 
GeneralRe: Picture Box created by code not showing up Pin
Jordanwb10-Sep-07 10:18
Jordanwb10-Sep-07 10:18 
GeneralRe: Picture Box created by code not showing up Pin
Skippums10-Sep-07 10:34
Skippums10-Sep-07 10:34 
GeneralRe: Picture Box created by code not showing up Pin
Jordanwb10-Sep-07 10:42
Jordanwb10-Sep-07 10:42 
GeneralRe: Picture Box created by code not showing up Pin
Skippums10-Sep-07 10:48
Skippums10-Sep-07 10:48 
GeneralRe: Picture Box created by code not showing up Pin
Ermak8610-Sep-07 10:47
Ermak8610-Sep-07 10:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.