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
  1. Home
  2. General Programming
  3. C#
  4. fonts are Changing alone in a strange way - Windows CE , i update my first question

fonts are Changing alone in a strange way - Windows CE , i update my first question

Scheduled Pinned Locked Moved C#
questionhelptutorialannouncement
5 Posts 3 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
    goldsoft
    wrote on last edited by
    #1

    i have Windows-Mobile program that work with weight Connecting through rs232. its work excellent, but If the program works in a period of time - fonts are Changing alone from big to small font I noticed that the problem is in the first part 1 - if i mark this part1 The fonts will not change. (I have no idea why this is happening....) my code: //PART 1 port = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One); port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(Recepcion); private SerialPort port; StringBuilder SB; private void Recepcion(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { try { SB = new StringBuilder(1000); Application.DoEvents(); System.Threading.Thread.Sleep(122); SB.Append(port.ReadExisting()); port.DiscardInBuffer(); this.Invoke(new EventHandler(Actualizar)); } catch { } } //PART2 string MOMO1, MOMO2; string[] WI; string ALL; private void Actualizar(object s, EventArgs e) { ALL = SB.ToString().Trim(); WI = ALL.Split(','); ALL = WI[2].ToString().Trim(); MOMO1 = ALL.Replace("+", "").Replace("g", "").Replace("ST", "").Replace("GS", "").Replace("US", ""); if (MOMO1 != "") { MOMO2 = MOMO1; } lblMSG.Font = new Font("Ariel", 48, FontStyle.Bold); lblMSG.Text = MOMO2; Check_Weight(); GC.Collect(); // <-- is it OK ? } Can anyone advise me why and how to solve it ?

    OriginalGriffO P 2 Replies Last reply
    0
    • G goldsoft

      i have Windows-Mobile program that work with weight Connecting through rs232. its work excellent, but If the program works in a period of time - fonts are Changing alone from big to small font I noticed that the problem is in the first part 1 - if i mark this part1 The fonts will not change. (I have no idea why this is happening....) my code: //PART 1 port = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One); port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(Recepcion); private SerialPort port; StringBuilder SB; private void Recepcion(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { try { SB = new StringBuilder(1000); Application.DoEvents(); System.Threading.Thread.Sleep(122); SB.Append(port.ReadExisting()); port.DiscardInBuffer(); this.Invoke(new EventHandler(Actualizar)); } catch { } } //PART2 string MOMO1, MOMO2; string[] WI; string ALL; private void Actualizar(object s, EventArgs e) { ALL = SB.ToString().Trim(); WI = ALL.Split(','); ALL = WI[2].ToString().Trim(); MOMO1 = ALL.Replace("+", "").Replace("g", "").Replace("ST", "").Replace("GS", "").Replace("US", ""); if (MOMO1 != "") { MOMO2 = MOMO1; } lblMSG.Font = new Font("Ariel", 48, FontStyle.Bold); lblMSG.Text = MOMO2; Check_Weight(); GC.Collect(); // <-- is it OK ? } Can anyone advise me why and how to solve it ?

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      I refer the gentleman to my reply to his question earlier today[^] - which I see he has ignored completely... Is there any point in asking questions if you are going to ignore the answers?

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      G 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        I refer the gentleman to my reply to his question earlier today[^] - which I see he has ignored completely... Is there any point in asking questions if you are going to ignore the answers?

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

        G Offline
        G Offline
        goldsoft
        wrote on last edited by
        #3

        I tried to do everything offered, but not helped yet

        OriginalGriffO 1 Reply Last reply
        0
        • G goldsoft

          I tried to do everything offered, but not helped yet

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Clearly, you haven't tried very hard - given that over 5 hours later, the code is still exactly the same...

          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          1 Reply Last reply
          0
          • G goldsoft

            i have Windows-Mobile program that work with weight Connecting through rs232. its work excellent, but If the program works in a period of time - fonts are Changing alone from big to small font I noticed that the problem is in the first part 1 - if i mark this part1 The fonts will not change. (I have no idea why this is happening....) my code: //PART 1 port = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One); port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(Recepcion); private SerialPort port; StringBuilder SB; private void Recepcion(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { try { SB = new StringBuilder(1000); Application.DoEvents(); System.Threading.Thread.Sleep(122); SB.Append(port.ReadExisting()); port.DiscardInBuffer(); this.Invoke(new EventHandler(Actualizar)); } catch { } } //PART2 string MOMO1, MOMO2; string[] WI; string ALL; private void Actualizar(object s, EventArgs e) { ALL = SB.ToString().Trim(); WI = ALL.Split(','); ALL = WI[2].ToString().Trim(); MOMO1 = ALL.Replace("+", "").Replace("g", "").Replace("ST", "").Replace("GS", "").Replace("US", ""); if (MOMO1 != "") { MOMO2 = MOMO1; } lblMSG.Font = new Font("Ariel", 48, FontStyle.Bold); lblMSG.Text = MOMO2; Check_Weight(); GC.Collect(); // <-- is it OK ? } Can anyone advise me why and how to solve it ?

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            This is still bad code - it looks to be exactly the same as the one you posted earlier. To add to OG's earlier comments - Application.DoEvents followed by a Thread.Sleep - this tells me you are trying to force it to wait for data and hoping that you will magically sync with the data. Oh, and you shouldn't have an empty catch statement - you have no idea what exceptions you are catching and throwing away.

            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