Click here to Skip to main content
15,886,519 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I inherit ComboBox to implement my function Pin
Ravi Bhavnani23-Feb-14 6:34
professionalRavi Bhavnani23-Feb-14 6:34 
GeneralRe: How do I inherit ComboBox to implement my function Pin
Richard MacCutchan23-Feb-14 21:59
mveRichard MacCutchan23-Feb-14 21:59 
GeneralRe: How do I inherit ComboBox to implement my function Pin
Member 1041329223-Feb-14 13:53
professionalMember 1041329223-Feb-14 13:53 
AnswerRe: How do I inherit ComboBox to implement my function Pin
BillWoodruff22-Feb-14 4:48
professionalBillWoodruff22-Feb-14 4:48 
GeneralRe: How do I inherit ComboBox to implement my function Pin
Member 1041329223-Feb-14 13:50
professionalMember 1041329223-Feb-14 13:50 
GeneralRe: How do I inherit ComboBox to implement my function Pin
BillWoodruff23-Feb-14 14:06
professionalBillWoodruff23-Feb-14 14:06 
Questionslow motion problem in picture box... Pin
Edalat_201121-Feb-14 21:36
Edalat_201121-Feb-14 21:36 
AnswerRe: slow motion problem in picture box... Pin
BillWoodruff22-Feb-14 9:11
professionalBillWoodruff22-Feb-14 9:11 
I assume this is a Windows Form project. ... yes ?

First, check these to see if they make any difference:

1. make sure your Form's 'DoubleBuffered Property is set to 'true

2. try taking out the calls to 'Refresh in your 'MouseEnter and 'MouseLeave EventHandlers.

Then, you might try this:
C#
// define variables to hold calculated
// sizes, and positions for PictureBox
private int pbSizeIncrement = 12;

private Size pbBaseSize;
private Size pbEnterSize;
private Point pbBaseLocation;
private Point pbEnterLocation;

// in your Form's Load EventHandler
// pre-calculate Size, and Location
// for your PictureBox
private void Form1_Load(object sender, EventArgs e)
{
    pbBaseSize = pictureBox1.Size;
    pbEnterSize = new Size(pbBaseSize.Width + pbSizeIncrement, pbBaseSize.Height + pbSizeIncrement);

    pbBaseLocation = pictureBox1.Location;
    pbEnterLocation = pbBaseLocation;
    pbEnterLocation.Offset(pbSizeIncrement / -2, pbSizeIncrement / -2);
}

// use calculated values in your EventHandlers
private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
    pictureBox1.Size = pbEnterSize;
    pictureBox1.Location = pbEnterLocation;
}

private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
    pictureBox1.Size = pbBaseSize;
    pictureBox1.Location = pbBaseLocation;
}
I might also experiment by having two PictureBoxes defined, holding the same Image, but one sized larger than the other, and then switching the visibility of the two. You could position the second, larger, PictureBox correctly, and set its initial 'Visible state to 'false. Then:
C#
private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
    pictureBox2.Visible = true;
    pictureBox1.Visible = false;
}

private void pictureBox2_MouseLeave(object sender, EventArgs e)
{
    pictureBox1.Visible = true;
    pictureBox2.Visible = false;
}
That would have the advantage of requiring no load-time calculation, and no run-time resizing/re-positioning of a PictureBox.

If none of these suggestions makes any real difference in run-time behavior, I'd certainly want to consider the nature of your hardware (cpu speed, amount of ram, etc.), and I'd want to take a close look at the sources of your images to see what their size, and formats were.
“The best hope is that one of these days the Ground will get disgusted enough just to walk away ~ leaving people with nothing more to stand ON than what they have so bloody well stood FOR up to now.” Kenneth Patchen, Poet

AnswerRe: slow motion problem in picture box... Pin
TnTinMn23-Feb-14 11:10
TnTinMn23-Feb-14 11:10 
QuestionAcroRd32.exe command line options and alternatives Pin
kranthi198821-Feb-14 10:58
kranthi198821-Feb-14 10:58 
AnswerRe: AcroRd32.exe command line options and alternatives Pin
Garth J Lancaster21-Feb-14 11:14
professionalGarth J Lancaster21-Feb-14 11:14 
Questionhow to use a key in md5 algorithm in c# Pin
rincy sivan21-Feb-14 0:22
rincy sivan21-Feb-14 0:22 
AnswerRe: how to use a key in md5 algorithm in c# PinPopular
Eddy Vluggen21-Feb-14 0:27
professionalEddy Vluggen21-Feb-14 0:27 
GeneralRe: how to use a key in md5 algorithm in c# Pin
OriginalGriff21-Feb-14 0:57
mveOriginalGriff21-Feb-14 0:57 
AnswerRe: how to use a key in md5 algorithm in c# PinPopular
OriginalGriff21-Feb-14 1:03
mveOriginalGriff21-Feb-14 1:03 
JokeRe: how to use a key in md5 algorithm in c# Pin
Marco Bertschi21-Feb-14 1:18
protectorMarco Bertschi21-Feb-14 1:18 
GeneralRe: how to use a key in md5 algorithm in c# Pin
OriginalGriff21-Feb-14 3:30
mveOriginalGriff21-Feb-14 3:30 
GeneralRe: how to use a key in md5 algorithm in c# Pin
harold aptroot21-Feb-14 1:44
harold aptroot21-Feb-14 1:44 
AnswerRe: how to use a key in md5 algorithm in c# Pin
AmitGajjar23-Feb-14 18:48
professionalAmitGajjar23-Feb-14 18:48 
Questionweb browser Pin
Member 1045906320-Feb-14 23:42
Member 1045906320-Feb-14 23:42 
AnswerRe: web browser Pin
OriginalGriff21-Feb-14 0:07
mveOriginalGriff21-Feb-14 0:07 
GeneralRe: web browser Pin
AmitGajjar23-Feb-14 18:53
professionalAmitGajjar23-Feb-14 18:53 
Questionweb browser Pin
Member 1045906320-Feb-14 23:41
Member 1045906320-Feb-14 23:41 
QuestionQuestion Pin
Member 1061429620-Feb-14 23:18
Member 1061429620-Feb-14 23:18 
AnswerRe: Question Pin
Richard MacCutchan20-Feb-14 23:22
mveRichard MacCutchan20-Feb-14 23:22 

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.