久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='seRy0'><tr id='seRy0'><dt id='seRy0'><q id='seRy0'><span id='seRy0'><b id='seRy0'><form id='seRy0'><ins id='seRy0'></ins><ul id='seRy0'></ul><sub id='seRy0'></sub></form><legend id='seRy0'></legend><bdo id='seRy0'><pre id='seRy0'><center id='seRy0'></center></pre></bdo></b><th id='seRy0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='seRy0'><tfoot id='seRy0'></tfoot><dl id='seRy0'><fieldset id='seRy0'></fieldset></dl></div>

      <bdo id='seRy0'></bdo><ul id='seRy0'></ul>

    1. <small id='seRy0'></small><noframes id='seRy0'>

    2. <legend id='seRy0'><style id='seRy0'><dir id='seRy0'><q id='seRy0'></q></dir></style></legend>
      1. <tfoot id='seRy0'></tfoot>

        C# 在 FlowLayoutPanels 中拖放標簽

        C# Drag and Drop labels within FlowLayoutPanels(C# 在 FlowLayoutPanels 中拖放標簽)

          <legend id='dJ2I2'><style id='dJ2I2'><dir id='dJ2I2'><q id='dJ2I2'></q></dir></style></legend>
            1. <i id='dJ2I2'><tr id='dJ2I2'><dt id='dJ2I2'><q id='dJ2I2'><span id='dJ2I2'><b id='dJ2I2'><form id='dJ2I2'><ins id='dJ2I2'></ins><ul id='dJ2I2'></ul><sub id='dJ2I2'></sub></form><legend id='dJ2I2'></legend><bdo id='dJ2I2'><pre id='dJ2I2'><center id='dJ2I2'></center></pre></bdo></b><th id='dJ2I2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dJ2I2'><tfoot id='dJ2I2'></tfoot><dl id='dJ2I2'><fieldset id='dJ2I2'></fieldset></dl></div>

            2. <small id='dJ2I2'></small><noframes id='dJ2I2'>

              • <bdo id='dJ2I2'></bdo><ul id='dJ2I2'></ul>
                <tfoot id='dJ2I2'></tfoot>

                  <tbody id='dJ2I2'></tbody>
                  本文介紹了C# 在 FlowLayoutPanels 中拖放標簽的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個小問題.我想要制作可以在多個 FlowLayoutPanel 之間拖動生成的標簽的程序.但最近幾天我試圖讓拖放工作.我嘗試了許多教程、示例等,但總是有些不同,我無法僅提取基本代碼.

                  I have small problem. I want make program where I can drag generated labels between multiple FlowLayoutPanels. But last few days I have tried to make drag and drop working. I tried many tutorials, examples etc. but it is always something bit diferent and I am not able extract only basic code.

                  類似于 這個程序 但它在 Visual Basic 中,我需要它在 C# 中.我知道這可能很簡單,但我是新手.

                  It is similar to this program but it is in Visual Basic and I need it in C#. I know it is maybe very simple, but I am newbie.

                  感謝您的幫助.

                  推薦答案

                  真正的 Drag&Drop 在應用程序之間最有用,也許在 Forms 之間也是最有用的.

                  Real Drag&Drop ist most useful between applications and maybe also between Forms.

                  假設您想在同一 Form 上的 FLPs 之間拖動 Labels,下面的代碼應該可以幫助您進行操作..

                  Assuming you want to drag Labels between FLPs on the same Form, the code below should get you going..

                  它需要兩個 FlowLayoutPanels,分別稱為 FLP1FLP2,并首先使用一些 Labels 對其進行初始化.

                  It takes two FlowLayoutPanels called FLP1 and FLP2 and starts by initializing them with a few Labels.

                  注意我添加到每個 Label 以模擬 Drag&Drop 動作的三個 鼠標事件

                  Note the three mouse events I add to each Label to emulate a Drag&Drop action!

                  private void Form1_Load(object sender, EventArgs e)
                  {
                      // create a few Label with varying Colors for testing..
                      fillFLP(FLP1, 88);
                      fillFLP(FLP2, 111);
                  }
                  
                  void fillFLP(FlowLayoutPanel FLP, int cc)
                  {
                      for (int i = 0; i < 24; i++)
                      {
                          Label l = new Label();
                          // the next 3 lines optional and only are there for testing!
                          l.AutoSize = false;      
                          l.Text = FLP.Name + " " +  i.ToString("00");
                          l.BackColor = Color.FromArgb(255, cc * 2 - i, 255 - 5 * i, cc + 5 * i); 
                          // add controls and set mouse events:
                          FLP.Controls.Add(l);
                          l.MouseDown += l_MouseDown;
                          l.MouseMove += l_MouseMove;
                          l.MouseUp += l_MouseUp;
                      }
                  }
                  
                  
                  // the currently moved Label:
                  Label mvLabel = null;
                  
                  void l_MouseDown(object sender, MouseEventArgs e)
                  {
                      // keep reference
                      mvLabel = (Label)sender;
                  }
                  
                  void l_MouseMove(object sender, MouseEventArgs e)
                  {
                      // if we are dragging a label:
                      if (mvLabel != null)
                      {
                          // mouse pos in window coords
                          Point  mvPoint = this.PointToClient(Control.MousePosition);
                          // the label is still in the FLP, so we start the drg action:
                          if (mvLabel.Parent != this)
                          {
                              mvLabel.Parent = this;
                              mvLabel.Location = mvPoint;
                              mvLabel.BringToFront();
                          }
                          else
                          {   
                              // we are already in the form, so we just move
                              mvLabel.Location = mvPoint;
                          }
                      }
                  }
                  
                  void l_MouseUp(object sender, MouseEventArgs e)
                  {
                      // are we over a FLP? and if so which?
                      Point MP = Control.MousePosition;
                      FlowLayoutPanel FLP = null;
                  
                      Point mLoc1 = FLP1.PointToClient(MP);
                      Point mLoc2 = FLP2.PointToClient(MP);
                  
                      if (FLP1.ClientRectangle.Contains(mLoc1)) FLP = FLP1;
                      else if (FLP2.ClientRectangle.Contains(mLoc2)) FLP = FLP2;
                      else return;  // no! nothing we can do..
                  
                      // yes, now find out if we are over a label..
                      // ..or over an empty area
                      mvLabel.SendToBack();
                      Control cc = FLP.GetChildAtPoint(FLP.PointToClient(MP));
                      // if we are over the FLP we can insert at the beginning or the end:
                      // int mvIndex = 0; // to the beginning
                      int mvIndex = FLP.Controls.Count; // to the end
                      // we are over a Label, so we insert before it:
                      if (cc != null) mvIndex = FLP.Controls.IndexOf(cc);
                  
                      // move the Label into the FLP
                      FLP.Controls.Add(mvLabel);
                      // move it to the right position:
                      FLP.Controls.SetChildIndex(mvLabel, mvIndex);
                      // let go of the reference
                      mvLabel = null;
                  
                  }
                  

                  這使您可以在兩個 FLP 之間以及通過將 onto 拖放到 FLP 內來回拖放 Lablesstrong> 標簽.

                  This lets you drag and drop Lables to and fro between two FLPs and also within the FLPs by dropping onto Labels.

                  請注意,如果您想允許在 Labels 之間放置 Labels 并仍然定位在那里,則需要多行幾行.

                  Note that you will need a few extra lines if you want to allow dropping between Labels and still position there..

                  這篇關于C# 在 FlowLayoutPanels 中拖放標簽的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Ignore whitespace while reading XML(讀取 XML 時忽略空格)
                  XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                  Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標簽的 XML)
                  Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                  delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                  Parse malformed XML(解析格式錯誤的 XML)

                  <small id='SorJ4'></small><noframes id='SorJ4'>

                        <bdo id='SorJ4'></bdo><ul id='SorJ4'></ul>
                        • <tfoot id='SorJ4'></tfoot>
                        • <i id='SorJ4'><tr id='SorJ4'><dt id='SorJ4'><q id='SorJ4'><span id='SorJ4'><b id='SorJ4'><form id='SorJ4'><ins id='SorJ4'></ins><ul id='SorJ4'></ul><sub id='SorJ4'></sub></form><legend id='SorJ4'></legend><bdo id='SorJ4'><pre id='SorJ4'><center id='SorJ4'></center></pre></bdo></b><th id='SorJ4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SorJ4'><tfoot id='SorJ4'></tfoot><dl id='SorJ4'><fieldset id='SorJ4'></fieldset></dl></div>

                          1. <legend id='SorJ4'><style id='SorJ4'><dir id='SorJ4'><q id='SorJ4'></q></dir></style></legend>

                              <tbody id='SorJ4'></tbody>
                            主站蜘蛛池模板: 国产精品va | 四虎精品在线 | 国产在线一区二区三区 | 看一级黄色片 | 欧美久久久久久久久久 | 久草视频观看 | 黄视频网站在线观看 | 在线视频a | 成人黄色在线 | 黄色小视频免费 | 久久精品毛片 | 日韩女优在线 | 91在线视频观看 | 日韩精品视频一区二区三区 | 三级网站在线 | 国产精品福利在线观看 | av一二三区 | 国产伦精品一区二区三区照片 | 久久精品导航 | 伊人成人在线视频 | 日日夜夜综合网 | 人人干人人爽 | 欧美日韩免费一区二区三区 | 99视频在线精品免费观看2 | 国内av在线 | 日韩三级精品 | 亚洲精品1区| 97在线视频免费观看 | 国产91在线视频 | av影片在线观看 | 久久精品黄色 | 精品少妇一区二区三区免费观 | 99在线精品视频 | 国产精品二区一区二区aⅴ污介绍 | 女人高潮特级毛片 | 亚洲乱码一区二区 | 一区二区三区在线看 | 激情福利视频 | 日韩中文字幕视频 | 午夜激情福利视频 | 日韩av综合网 |