Click here to Skip to main content
15,896,207 members
Home / Discussions / C#
   

C#

 
QuestionWrite wizard in my project using Panel - Question Pin
Yanshof21-Jun-07 4:56
Yanshof21-Jun-07 4:56 
AnswerPlease - Someone can help me with this ? Pin
Yanshof21-Jun-07 18:00
Yanshof21-Jun-07 18:00 
Questionstruct and const Pin
lune1221-Jun-07 4:33
lune1221-Jun-07 4:33 
AnswerRe: struct and const Pin
Colin Angus Mackay21-Jun-07 4:37
Colin Angus Mackay21-Jun-07 4:37 
GeneralRe: struct and const Pin
lune1221-Jun-07 5:01
lune1221-Jun-07 5:01 
GeneralRe: struct and const Pin
Colin Angus Mackay21-Jun-07 8:05
Colin Angus Mackay21-Jun-07 8:05 
AnswerRe: struct and const Pin
Luc Pattyn21-Jun-07 5:08
sitebuilderLuc Pattyn21-Jun-07 5:08 
AnswerRe: struct and const Pin
PIEBALDconsult21-Jun-07 9:05
mvePIEBALDconsult21-Jun-07 9:05 
If your goal is to have a Point type, just use the built-in one: System.Drawing.Point.

If your goal is to create a type that works like System.Drawing.Point, then look at how System.Drawing.Point is defined.

If your goal is to create a type that works the way you described (which I don't recommend)...

C#
public struct Point
{

// _z will hold two flag bits to hold whether or not the values have been set
private int _x,_y,_z;

public int
x
{
    get
    {
        if ( _z%2 == 1 )
        {
            return ( _x ) ;
        }
        else
        {
            // throw something
        }
    }

    set
    {
        if ( _z%2 == 0 )
        {
            _x = value ;
            _z |= 1 ;
        }
        else
        {
            // throw something
        }
    }
}

public int
y
{
    get
    {
        if ( _z > 1 )
        {
            return ( _y ) ;
        }
        else
        {
            // throw something
        }
    }

    set
    {
        if ( _z < 2 )
        {
            _y = value ;
            _z |= 2 ;
        }
        else
        {
            // throw something
        }
    }
}


Then
<br />
public Point my_Point;<br />
my_Point.x = 2;<br />
my_Point.y = 4;<br />
<br />
my_Point.x = 5; // The "throw something" will happen<br />

JokeRe: struct and const Pin
Luc Pattyn21-Jun-07 10:41
sitebuilderLuc Pattyn21-Jun-07 10:41 
GeneralRe: struct and const Pin
PIEBALDconsult21-Jun-07 11:00
mvePIEBALDconsult21-Jun-07 11:00 
JokeRe: struct and const Pin
Colin Angus Mackay21-Jun-07 14:07
Colin Angus Mackay21-Jun-07 14:07 
GeneralRe: struct and const Pin
PIEBALDconsult21-Jun-07 14:51
mvePIEBALDconsult21-Jun-07 14:51 
GeneralRe: struct and const Pin
Luc Pattyn21-Jun-07 14:54
sitebuilderLuc Pattyn21-Jun-07 14:54 
GeneralRe: struct and const Pin
PIEBALDconsult21-Jun-07 11:09
mvePIEBALDconsult21-Jun-07 11:09 
QuestionHow to refresh a form Pin
kaushal65421-Jun-07 3:43
kaushal65421-Jun-07 3:43 
AnswerRe: How to refresh a form Pin
Ylno21-Jun-07 14:30
Ylno21-Jun-07 14:30 
Questionhow can we find a *.dmp in a directory in c# Pin
cancerion21-Jun-07 3:40
cancerion21-Jun-07 3:40 
AnswerRe: how can we find a *.dmp in a directory in c# Pin
Wjousts21-Jun-07 3:42
Wjousts21-Jun-07 3:42 
GeneralRe: how can we find a *.dmp in a directory in c# Pin
Giorgi Dalakishvili21-Jun-07 4:00
mentorGiorgi Dalakishvili21-Jun-07 4:00 
GeneralRe: how can we find a *.dmp in a directory in c# Pin
Wjousts21-Jun-07 6:54
Wjousts21-Jun-07 6:54 
Questionhow to add value and text in combo box in c# windows application Pin
monuSaini21-Jun-07 2:45
monuSaini21-Jun-07 2:45 
AnswerRe: how to add value and text in combo box in c# windows application Pin
Luc Pattyn21-Jun-07 2:49
sitebuilderLuc Pattyn21-Jun-07 2:49 
GeneralRe: how to add value and text in combo box in c# windows application Pin
monuSaini21-Jun-07 2:54
monuSaini21-Jun-07 2:54 
GeneralRe: how to add value and text in combo box in c# windows application Pin
Luc Pattyn21-Jun-07 2:59
sitebuilderLuc Pattyn21-Jun-07 2:59 
GeneralRe: how to add value and text in combo box in c# windows application Pin
monuSaini21-Jun-07 3:04
monuSaini21-Jun-07 3:04 

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.