Click here to Skip to main content
15,905,325 members
Home / Discussions / C#
   

C#

 
GeneralRe: local database connection string Pin
Deresen11-Aug-08 10:41
Deresen11-Aug-08 10:41 
GeneralRe: local database connection string Pin
Ashfield12-Aug-08 19:58
Ashfield12-Aug-08 19:58 
GeneralRe: local database connection string Pin
Deresen12-Aug-08 22:29
Deresen12-Aug-08 22:29 
GeneralRe: local database connection string Pin
Ashfield13-Aug-08 1:50
Ashfield13-Aug-08 1:50 
Questionhow to store PDF document in local database Pin
laziale11-Aug-08 3:51
laziale11-Aug-08 3:51 
AnswerRe: how to store PDF document in local database Pin
Manas Bhardwaj11-Aug-08 4:00
professionalManas Bhardwaj11-Aug-08 4:00 
GeneralRe: how to store PDF document in local database Pin
laziale11-Aug-08 4:03
laziale11-Aug-08 4:03 
AnswerRe: how to store PDF document in local database Pin
Giorgi Dalakishvili11-Aug-08 4:01
mentorGiorgi Dalakishvili11-Aug-08 4:01 
GeneralRe: how to store PDF document in local database Pin
laziale11-Aug-08 4:13
laziale11-Aug-08 4:13 
GeneralRe: how to store PDF document in local database Pin
Giorgi Dalakishvili11-Aug-08 4:36
mentorGiorgi Dalakishvili11-Aug-08 4:36 
QuestionTo get hostname/IP Adress of data-recieving server Pin
Ahuja.bangalore11-Aug-08 3:41
Ahuja.bangalore11-Aug-08 3:41 
AnswerRe: To get hostname/IP Adress of data-recieving server Pin
vikas amin11-Aug-08 5:14
vikas amin11-Aug-08 5:14 
GeneralRe: To get hostname/IP Adress of data-recieving server Pin
Tony Richards11-Aug-08 10:19
Tony Richards11-Aug-08 10:19 
GeneralRe: To get hostname/IP Adress of data-recieving server Pin
Ahuja.bangalore11-Aug-08 20:53
Ahuja.bangalore11-Aug-08 20:53 
GeneralRe: To get hostname/IP Adress of data-recieving server Pin
Ahuja.bangalore11-Aug-08 20:53
Ahuja.bangalore11-Aug-08 20:53 
Questionhow to design form designer Pin
Abdul Rahman Hamidy11-Aug-08 2:28
Abdul Rahman Hamidy11-Aug-08 2:28 
AnswerRe: how to design form designer Pin
scottgp11-Aug-08 2:32
professionalscottgp11-Aug-08 2:32 
AnswerRe: how to design form designer Pin
Giorgi Dalakishvili11-Aug-08 2:40
mentorGiorgi Dalakishvili11-Aug-08 2:40 
AnswerRe: how to design form designer Pin
Alan Balkany11-Aug-08 4:17
Alan Balkany11-Aug-08 4:17 
GeneralRe: how to design form designer Pin
Abdul Rahman Hamidy11-Aug-08 22:08
Abdul Rahman Hamidy11-Aug-08 22:08 
GeneralRe: how to design form designer Pin
Alan Balkany12-Aug-08 3:19
Alan Balkany12-Aug-08 3:19 
QuestionCompact Framework. Dragging a control at runtime causes a smear of the control across the screen. Paint Problem? Pin
gembob11-Aug-08 2:25
gembob11-Aug-08 2:25 
Hi,

I've a .net Compact Framework 2.0 VS C# Project.

On it I have a control (a picture box) which at runtime I can drag left and right on my screen within set co-ordinates.

I update the picture with one of two images which are embedded images)

However, when I do drag this control at runtime, there is a delay in the refresh, so what I am getting is a smear of controls across the screen momentarily while I'm moving the control. I want the control to move seamlessly like that on the iPhone.

I've included my code below.

I've googled this problem and came across the following. http://www.pcreview.co.uk/forums/thread-1301356.php I've attempted to implement this but am not sure if the programmer intends on dragging the panel about the screen, or if the panel is refreshing the form itself. Either way, my implementation of this code has a permanent spear of my control across the screen, and also the background of the form has become invisible

I understand Double buffering isn't available in .net CF. I don't have the experience myself to implement an alternative to double buffering. I've tried adding a pixel count to the code, to stop the control from being drawn unless a the control has moved a certain amout of pixels, this make the control movement jumpy and I still have a smear as the control moves.

If anyone has any idea how to reduce this effect I'd greatly appreciate it

best Regards

Gemma


//Variables


private Boolean dragInProgress = false;

int MouseDownX = 0;

int MouseDownY = 0;

int pixelcount = 0;

Point temp = new Point();

int percentage_light;

Bitmap lights_on, lights_off;



//Embedded images are loaded when the form loads

private void Form1_Load(object sender, EventArgs e)

{

lights_on = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("DeviceApplication1.images.light_intensity_slider_h.png"));

lights_off = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("DeviceApplication1.images.light_intensity_slider.png"));

}



#region Button Slider bit

private void picCameraDimmer_MouseDown(object sender, MouseEventArgs e)

{

if (!this.dragInProgress)

{

this.dragInProgress = true;

this.MouseDownX = e.X;

this.MouseDownY = e.Y;

}

return;

}

private void picCameraDimmer_MouseMove(object sender, MouseEventArgs e)

{

pixelcount += 1;

if (dragInProgress)

{

temp.X = this.picCameraDimmer.Location.X + (e.X - MouseDownX);

temp.Y = 168; // Set the x co-ordinate so button can't move sideways

this.picCameraDimmer.Location = temp;

int x_size = Convert.ToInt16(temp.X);


percentage_light = (int)((x_size - 33) / 3.91);


if (temp.X < 36) // Set button to it OFF Location

{

temp.X = 36;

this.picCameraDimmer.Location = temp;

picCameraDimmer.Image = lights_off;

picCameraLight.Size = new System.Drawing.Size(5, 5);

}

else if (temp.X >= (36) && temp.X <= (428)) // Button is between its OFF and MAX points

{

picCameraLight.Size = new System.Drawing.Size(x_size, 5);

picCameraDimmer.Image = lights_on;

this.picCameraDimmer.Location = temp;

Invalidate();


}

else if (temp.X > 428) // Set button to its MAX location

{

temp.X = 428;

this.picCameraDimmer.Location = temp;

picCameraDimmer.Image = lights_on;

picCameraLight.Size = new System.Drawing.Size(428, 5);

}

return;

}

}

private void picCameraDimmer_MouseUp(object sender, MouseEventArgs e)

{


if (e.Button == MouseButtons.Left)

{

this.dragInProgress = false;

if (temp.X == 36) // Button is at its OFF location

{

// Send 0 for light intensity

// s_data[4] = (byte)(0);

// sound.Play();



}

else if (temp.X == 428) // Button is at its MAX location

{

// s_data[4] = 100;

// sound.Play();

}

else if (temp.X > 36 && temp.X < 428) // Button is between OFF and MAX points

{

this.picCameraDimmer.Location = temp;

// s_data[4] = (byte)(percentage_light);

}

}

return;

}

#endregion
QuestionConvert HTML file to PDF Pin
selvakkumar11-Aug-08 1:47
selvakkumar11-Aug-08 1:47 
AnswerRe: Convert HTML file to PDF Pin
Giorgi Dalakishvili11-Aug-08 1:52
mentorGiorgi Dalakishvili11-Aug-08 1:52 
AnswerRe: Convert HTML file to PDF Pin
blackjack215011-Aug-08 3:13
blackjack215011-Aug-08 3:13 

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.