. NET to solve the problem of redundant margin in TabControl page experience sharing

Source: Internet
Author: User

Here's how to fix it <span class="Apple-converted-space"></span> :


1. Create a new class directly, inherit TabControl, and then override DisplayRectangle method: <span class="Apple-converted-space"></span>


Copy Code code as follows:


///&lt;summary&gt;


///Solution TabControl redundant margin problem


///&lt;/summary&gt;


public class Fulltabcontrol:tabcontrol {





public override Rectangle DisplayRectangle {


get {


Rectangle rect = base. DisplayRectangle;  


Return to New Rectangle (rect. Left-4, Rect. Top-4, Rect. Width + 8, rect. Height + 7);  


}  


}  


}  


later use Fulltabcontrol on the line. (This method is simple) <span class="Apple-converted-space"></span>








2. See the following URL (vb.net) code: <span class="Apple-converted-space"></span>





http://www.blueshop.com.tw/board/FUM20050124191756KKC/BRD201112281018075B8.html





C # code is: <span class="Apple-converted-space"></span>





Copy Code code as follows:


public class Fulltabcontrol:nativewindow {


static int tcm_first = 0x1300;  


static int tcm_adjustrect = (Tcm_first + 40);  


struct rect{


public int left, top, right, Bottom;  


}  





protected override void WndProc (ref message m) {


if (m.msg = = tcm_adjustrect) { <span class="Apple-converted-space"></span>


RECT rc = (RECT) M.getlparam (typeof (RECT));  


RC. Left-= 4;  


RC. Right + 3;  


RC. Top-= 4;  


RC. Bottom + 3;  


marshal.structuretoptr (RC, m.LParam, True);  


}  





base. WndProc (ref m);  


}  


}  





Call Method: New Fulltabcontrol (). Assignhandle (Tabcontrol1.handle);//TabControl1 is the name of the TabControl control <span class="Apple-converted-space"></span> on the window





Copyright Statement Author: Xiarong


e-mail: Lyout (at) 163.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.