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
G

gembob

@gembob
About
Posts
8
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Drawing a Polygon, at different angles (rotate). Compact Framework
    G gembob

    Thank you

    Mobile csharp ruby graphics question

  • Drawing a Polygon, at different angles (rotate). Compact Framework
    G gembob

    yup, thats what I'm trying to figure out

    Mobile csharp ruby graphics question

  • Drawing a Polygon, at different angles (rotate). Compact Framework
    G gembob

    Hi, I'm using C# and .net Compact Framework 2.0. I want to draw a polygon at various angles, in other words I want to rotate it. However, I don't know the maths to do this, transformation matix aren't part of the Cf so I've to figure it out for myself, any pointers? Thanks Gem

    Mobile csharp ruby graphics question

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

    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

    C# csharp php ios visual-studio graphics

  • PictureBox using too much memory
    G gembob

    Thanks for the useful information and checking my code for me. I've no peers to learn from or show my code to, (one man show here) so its great to get advice.

    Graphics csharp graphics performance help tutorial

  • PictureBox using too much memory
    G gembob

    Hi Luc, I've since gone off and done some reading on .net CF graphics, in the process I came across some code which I've implemented into my project. private Bitmap LoadBitmapResource(string strName) { Assembly assembly = Assembly.GetExecutingAssembly(); string strRes = "Rotate_Test.images.gauge." + strName; Stream stream = assembly.GetManifestResourceStream(strRes); Bitmap bmp = null; try { bmp = new Bitmap(stream); } catch { } stream.Close(); return bmp; } private void DisposeBitmap(ref Bitmap bmp) { if (bmp != null) { bmp.Dispose(); } bmp = null; } In the Panel Paint method I have the following. private void panel1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; DisposeBitmap(ref bmpDraw); //Get the Bitmap to draw bmpDraw = LoadBitmapResource("backTilt" + (strResNum) + ".bmp"); g.DrawImage(bmpDraw, 10, 10); } The above is still using up memory for every image which is displayed, it seems like nothing is being freed up. I haven't started looking at double buffering as for now I'm more concerned with relasing the memory used. Thanks for your suggestion regards Gemma

    Graphics csharp graphics performance help tutorial

  • PictureBox using too much memory
    G gembob

    Hi Luc, Thanks for your reply. I got overly excited when I saw 6 replies to my post :) as i've spent a lot of time trying to figure this out. I attempted what you suggested, however the Compact Framework has me limited in what I can do. The line of code I hoped to use for drawing in the panel is g = panel1.CreateGraphics(); however, CreateGraphics is not availble to my panel in the CF. I'll keep looking, I'm very new to c# (programming in general) so there may be a solution for me somewhere. Regards Gemma

    Graphics csharp graphics performance help tutorial

  • PictureBox using too much memory
    G gembob

    Hi, I have a windows CE device for which I am wrinting a C# .Net CF 2.0 application. This device has an inclinometer chip connected to it, which reads the angles my device is at, and sends me the X and Y tilt values of the inclinometer. Depending on those values, I want to display a picture. (.png). For now now I'm just using the X value (tiltX global variable) The image is being updated every 150ms So for a prototype I've being doing the following: //TiltX is being passed in to RotateGauge as an Int. private void RotateGauge(int side) { if (side > -5 & side < 5) { string number = Convert.ToString(side); Stream sidePic = _assembly.GetManifestResourceStream("Rotate_Test.images.gauge.sideTilt" + (number) + ".png"); Bitmap bmp = new Bitmap(sidePic); Graphics g = CreateGraphics(); g.DrawImage(bmp, 42,116); //draw image bmp.Dispose(); sidePic.Close(); g.Dispose(); } } The above function RotateGauge() gets called from a timer. (interival 150ms) The problem is its using up a lot of memory. I don't think I'm properly disposing of things. Any suggestions how to : Efficiently rewrite the above code so when something gets created on a timer_tick it also gets disposed of properly

    Graphics csharp graphics performance help tutorial
  • Login

  • Don't have an account? Register

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