123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.ComponentLibrary
- {
-
-
-
- public partial class BaseContentsFormRelease : BaseForm360
- {
-
-
-
-
- public BaseContentsFormRelease()
- {
- InitializeComponent();
- this.btnAppFormMenu.MouseClick += new MouseEventHandler(btnAppFormMenu_MouseClick);
-
-
- this.plExMainContainer.Resize += new EventHandler(plExMainContainer_Resize);
- this.plFormMainContent.Resize+=new EventHandler(plFormMainContent_Resize);
- this.Resize += new EventHandler(BaseContentsFormRelease_Resize);
- this.Shown += new EventHandler(BaseContentsFormRelease_Shown);
-
- }
-
-
-
- int PanlOffset = 0;
-
-
-
-
-
- void BaseContentsFormRelease_Shown(object sender, EventArgs e)
- {
- if (IsCustomScrollBar)
- {
- PanlOffset = 20;
- }
- SetplExMainContainerSize(PanlOffset);
- SetScrollBarAttr();
- InitializeScrollBar();
- }
-
-
-
-
-
- void BaseContentsFormRelease_Resize(object sender, EventArgs e)
- {
-
- SetplExMainContainerSize(PanlOffset);
- SetScrollBarAttr();
- InitializeScrollBar();
- }
-
-
-
-
-
- void plFormMainContent_Resize(object sender, EventArgs e)
- {
-
- SetplExMainContainerSize(PanlOffset);
- SetScrollBarAttr();
- InitializeScrollBar();
-
- }
-
-
-
-
-
- void plExMainContainer_Resize(object sender, EventArgs e)
- {
- if (!this.TopLevel)
- {
- SetplExMainContainerSize(PanlOffset);
- SetScrollBarAttr();
- InitializeScrollBar();
- }
-
- }
-
- int scrollX = 0;
- int scrollY = 0;
- bool isShowCtlScrollBarV = false;
- bool isShowCtlScrollBarH = false;
- void ctlScrollBarV_Scroll(object sender, EventArgs e)
- {
-
-
-
- }
- void ctlScrollBarH_Scroll(object sender, EventArgs e)
- {
-
-
-
- }
-
-
-
-
- protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
- {
- base.OnPaint(e);
- SetplExMainContainerSize(PanlOffset);
- }
-
-
-
- public void SetplExMainContainerSize(int offset=0)
- {
- try
- {
-
- this.plFormMainContent.Location = new Point(0, this.TitleBgImageHeight);
-
- isShowCtlScrollBarH = this.plExMainContainer.HorizontalScroll.Visible;
- isShowCtlScrollBarV = this.plExMainContainer.VerticalScroll.Visible;
- if (IsCustomScrollBar)
- {
- if (isShowCtlScrollBarV)
- {
-
- this.plFormMainContent.Width = this.Width - offset;
- this.plExMainContainer.Width = this.plFormMainContent.Width + offset - 4;
- }
- else
- {
-
- this.plFormMainContent.Width = this.Width;
- this.plExMainContainer.Width = this.plFormMainContent.Width;
- }
- if (isShowCtlScrollBarH)
- {
-
- this.plFormMainContent.Height = this.Height - this.TitleBgImageHeight - this.BottomBgImageHeight - offset;
- this.plExMainContainer.Height = this.plFormMainContent.Height + offset - 4;
- }
- else
- {
-
- this.plFormMainContent.Height = this.Height - this.TitleBgImageHeight - this.BottomBgImageHeight;
- this.plExMainContainer.Height = this.plFormMainContent.Height;
- }
- }
- else
- {
- this.plFormMainContent.Width = this.Width;
- this.plFormMainContent.Height = this.Height - this.TitleBgImageHeight - this.BottomBgImageHeight;
- this.plExMainContainer.Width = this.plFormMainContent.Width;
- this.plExMainContainer.Height = this.plFormMainContent.Height;
- }
- }
- catch { }
- }
-
-
-
- public void InitializeScrollBar()
- {
- try
- {
- this.plExMainContainer.AutoScrollPosition = new Point(scrollX, scrollY);
-
-
-
-
-
-
-
-
- }
- catch { }
-
-
- }
-
-
-
-
- void SetScrollBarAttr()
- {
- if (IsCustomScrollBar)
- {
-
-
-
-
-
-
-
- }
-
- }
- bool isCustomScrollBar = false;
-
-
-
- [Browsable(false), Category("自定义窗体属性"), Description("设置是否使用自定义滚动条")]
- public bool IsCustomScrollBar
- {
- get { return isCustomScrollBar; }
-
- }
- private void btnAppFormMenu_MouseClick(object sender, MouseEventArgs e)
- {
- Button btn = sender as Button;
- Point point = new Point();
- point.Y = btn.Height;
- if (e.Button == MouseButtons.Left)
- {
- this.cmsSystemMeunList.Show(btn, point);
- }
- }
- private void tsmAbout_Click(object sender, EventArgs e)
- {
- frmSystemAbout frmAbout = new frmSystemAbout();
- frmAbout.ShowDialog(this);
- }
- }
- }
|