Click here to Skip to main content
15,898,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: uniquely identifies a computer Pin
AndieDu14-Feb-10 16:45
AndieDu14-Feb-10 16:45 
GeneralRe: uniquely identifies a computer Pin
#realJSOP15-Feb-10 1:41
professional#realJSOP15-Feb-10 1:41 
QuestionHow to prevent from open the same form Pin
nuttynibbles11-Feb-10 19:03
nuttynibbles11-Feb-10 19:03 
AnswerRe: How to prevent from open the same form Pin
i gr811-Feb-10 20:06
i gr811-Feb-10 20:06 
AnswerRe: How to prevent from open the same form Pin
thatraja11-Feb-10 20:22
professionalthatraja11-Feb-10 20:22 
GeneralRe: How to prevent from open the same form Pin
nuttynibbles11-Feb-10 23:42
nuttynibbles11-Feb-10 23:42 
GeneralRe: How to prevent from open the same form Pin
OriginalGriff11-Feb-10 23:58
mveOriginalGriff11-Feb-10 23:58 
QuestionMultiple Resize events, how to prevent them. Pin
Douglas Kirk11-Feb-10 18:59
Douglas Kirk11-Feb-10 18:59 
Hello I have a simple Panel class object that has a Button and Label on it.
I use the button to display an image and the label to display info on it.

It is used as a "Media Selection Tool"

The problem that I am having is when I resize the object there are cases when I will modify the object's size again.

When this is done, the code will recall the resize event again and again till its happy then exit.

Can I not prevent the resizing event till all the width and height stuff is done?

if (mode == 0)
{
    this.Width = ImageButton.Width;
    InfoTextBox.Visible = false;
}


For example when the above occurs, there is no infomation to be displayed therefore my object only needs to be the size of the Button to display the image.

But when "this.Width = " is executed the whole resize event gets called again.

Thank you in advance.

PS is this just sloppy code? Smile | :)



private void Initialize_Components()
{
    this.SuspendLayout();
    this.Width = 200;
    this.Height = 200;
    ImageButton = new Button();
    InfoTextBox = new Label();
    ImageButton.BackgroundImageLayout = ImageLayout.Stretch;

    this.Click += new System.EventHandler(MediaIconButtonClick);
    ImageButton.Click += new System.EventHandler(MediaIconButtonClick);
    InfoTextBox.Click += new System.EventHandler(MediaIconButtonClick);

    this.BorderStyle = BorderStyle.Fixed3D;
    this.Controls.Add(ImageButton);
    this.Controls.Add(InfoTextBox);
    this.Resize += new System.EventHandler(this.MediaIconClass_Resize);
    this.ResumeLayout(false);
    this.PerformLayout();
}

public MediaIcon()
{
    Initialize_Components();
}

private void MediaIconClass_Resize(object sender, EventArgs e)
{
    this.SuspendLayout();
    InfoTextBox.Height = this.Height;
    ImageButton.Height = this.Height;
    if (ImageHeight != 0)
    {
        ImageButton.Width = ImageButton.Height * ImageWidth / ImageHeight;
        InfoTextBox.Left = ImageButton.Right;
     }
    else
    {
        ImageButton.Width = this.Width / 2;
        InfoTextBox.Left = ImageButton.Right;
    }
    if (mode == 0)
    {
        this.Width = ImageButton.Width;
        InfoTextBox.Visible = false;
    }
    else
    {
        InfoTextBox.Visible = true;
    }
    this.ResumeLayout(false);
    this.PerformLayout();
}

AnswerRe: Multiple Resize events, how to prevent them. Pin
OriginalGriff11-Feb-10 21:59
mveOriginalGriff11-Feb-10 21:59 
QuestionNightmare with Regular Expression Pin
newproger11-Feb-10 16:19
newproger11-Feb-10 16:19 
JokeRe: Nightmare with Regular Expression Pin
Dan Mos11-Feb-10 16:23
Dan Mos11-Feb-10 16:23 
AnswerRe: Nightmare with Regular Expression Pin
AspDotNetDev11-Feb-10 16:28
protectorAspDotNetDev11-Feb-10 16:28 
GeneralRe: Nightmare with Regular Expression Pin
newproger11-Feb-10 16:37
newproger11-Feb-10 16:37 
AnswerRe: Nightmare with Regular Expression Pin
Dan Mos11-Feb-10 17:56
Dan Mos11-Feb-10 17:56 
Questioncreating dynamic array Pin
nuttynibbles11-Feb-10 15:32
nuttynibbles11-Feb-10 15:32 
AnswerRe: creating dynamic array Pin
Dan Mos11-Feb-10 16:00
Dan Mos11-Feb-10 16:00 
GeneralRe: creating dynamic array Pin
nuttynibbles11-Feb-10 16:22
nuttynibbles11-Feb-10 16:22 
GeneralRe: creating dynamic array Pin
Dave Kreskowiak11-Feb-10 18:14
mveDave Kreskowiak11-Feb-10 18:14 
GeneralRe: creating dynamic array Pin
nuttynibbles11-Feb-10 19:03
nuttynibbles11-Feb-10 19:03 
GeneralRe: creating dynamic array Pin
i gr811-Feb-10 20:09
i gr811-Feb-10 20:09 
GeneralRe: creating dynamic array Pin
Dave Kreskowiak12-Feb-10 1:15
mveDave Kreskowiak12-Feb-10 1:15 
GeneralRe: creating dynamic array Pin
Dave Doknjas12-Feb-10 11:35
Dave Doknjas12-Feb-10 11:35 
GeneralRe: creating dynamic array Pin
Dave Kreskowiak13-Feb-10 4:16
mveDave Kreskowiak13-Feb-10 4:16 
QuestionI need critique on this code Pin
Sundeepan Sen11-Feb-10 14:23
Sundeepan Sen11-Feb-10 14:23 
AnswerRe: I need critique on this code Pin
PIEBALDconsult11-Feb-10 14:37
mvePIEBALDconsult11-Feb-10 14:37 

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.