Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Compact Framework. Dragging a control at runtime causes a smear of the control across the screen. Paint Problem?

Compact Framework. Dragging a control at runtime causes a smear of the control across the screen. Paint Problem?

Scheduled Pinned Locked Moved C#
csharpphpiosvisual-studiographics
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gembob
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups