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. how flip the canvas vertically ?

how flip the canvas vertically ?

Scheduled Pinned Locked Moved C#
questionhelp
4 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.
  • L Offline
    L Offline
    Le rner
    wrote on last edited by
    #1

    hi all i draw a canvas on page in 2 row and 2 col format. now i want to flip vertically them, please help me how can i flip it on its same location. thanks in advance.

    OriginalGriffO L 2 Replies Last reply
    0
    • L Le rner

      hi all i draw a canvas on page in 2 row and 2 col format. now i want to flip vertically them, please help me how can i flip it on its same location. thanks in advance.

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

      What have you tried? Where are you stuck? What help do you need?

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

      "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

      L 1 Reply Last reply
      0
      • L Le rner

        hi all i draw a canvas on page in 2 row and 2 col format. now i want to flip vertically them, please help me how can i flip it on its same location. thanks in advance.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        "Move" row 1 to row 2; move 2 to 1. (by exchanging ".Top" properties).

        It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          What have you tried? Where are you stuck? What help do you need?

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

          L Offline
          L Offline
          Le rner
          wrote on last edited by
          #4

          bool Draw_Mirror_Image = checkBox_mirror_image.Checked;

                  bool Flip\_horz\_or\_vert = radioButton\_mirr\_img\_FV.Checked;
                  //Flip\_horz\_or\_vert     =   false for flip horizontal 
                  //                  and =   true for flip vertical
          
          
                  StringFormat stringFormat = new StringFormat();
                  stringFormat.Alignment = StringAlignment.Center;
                  stringFormat.LineAlignment = StringAlignment.Center;
          
                  stringFormat.FormatFlags = StringFormatFlags.LineLimit;
                  stringFormat.Trimming = StringTrimming.Word;
          
          
                  RectangleF rect2 = panel2.ClientRectangle;
                  float image\_draw\_wd = 200;
                  float image\_draw\_ht = 100;
          
                  int X = 0;
                  int Y = 0;
          
                  Brush myBrush = new SolidBrush(Color.FromArgb(128, Color.Blue));
                  
                  int ROW=3;
                  int COL=3;
                  Pen pen = new Pen(Color.Red, 4);
          
                  float Zoom\_Value = 100;
          
                  float X\_SF = 1;
                  float Y\_SF = 1;
          
                  string draw\_text = "35";
          
                  Font draw\_text\_Font = new Font("Microsoft Sans Serif", 18, FontStyle.Bold);
          
                  for (int r = 1; r <= ROW; r++)
                  {
                      X = 0;
          
                      for (int cl = 1; cl <= COL; cl++)
                      {
          
                          draw\_text = "ROW : " + r.ToString() + "\\nCOL : " + cl.ToString();
          
                          Rectangle dr\_rect = new Rectangle(new Point(X, Y), new Size((int)image\_draw\_wd, ((int)image\_draw\_ht)));
          
          
                          if (Draw\_Mirror\_Image)
                          {
                              if (Flip\_horz\_or\_vert == false)
                              {
                                 //flip horz
          
                                  pe.ScaleTransform(-X\_SF, Y\_SF);
                                  //pe.TranslateTransform(-((X + image\_draw\_wd) \* (float)(Zoom\_Value / 100f)), 0);
                                  pe.TranslateTransform(-((image\_draw\_wd) \* (float)(Zoom\_Value / 100f)), 0);
                              }
                              else
                              { 
                                  //flip vert
          
                                  pe.ScaleTransform(X\_SF, -Y\_SF);
                                  //pe.TranslateTransform(0, -((Y + image\_draw\_ht) \* (float)(Zoom\_Value / 100f)));
                                  pe.TranslateTransform(0, -((image\_draw\_ht) \* (float)(Zoom\_Value / 100f)));
                              }
                          }
          
                          pe.DrawString(draw\_text, draw
          
          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