public DesignBindingPicker()
 {
     base.SuspendLayout();
     this.treeViewCtrl = new BindingPickerTree();
     this.treeViewCtrl.HotTracking = true;
     this.treeViewCtrl.BackColor = SystemColors.Window;
     this.treeViewCtrl.ForeColor = SystemColors.WindowText;
     this.treeViewCtrl.BorderStyle = BorderStyle.None;
     Size size = this.treeViewCtrl.Size;
     this.treeViewCtrl.Dock = DockStyle.Fill;
     this.treeViewCtrl.MouseMove += new MouseEventHandler(this.treeViewCtrl_MouseMove);
     this.treeViewCtrl.MouseLeave += new EventHandler(this.treeViewCtrl_MouseLeave);
     this.treeViewCtrl.AfterExpand += new TreeViewEventHandler(this.treeViewCtrl_AfterExpand);
     this.treeViewCtrl.AccessibleName = System.Design.SR.GetString("DesignBindingPickerTreeViewAccessibleName");
     DesignerUtils.ApplyTreeViewThemeStyles(this.treeViewCtrl);
     Label label = new Label {
         Height = 1,
         BackColor = SystemColors.ControlDark,
         Dock = DockStyle.Top
     };
     this.addNewCtrl = new BindingPickerLink();
     this.addNewCtrl.Text = System.Design.SR.GetString("DesignBindingPickerAddProjDataSourceLabel");
     this.addNewCtrl.TextAlign = ContentAlignment.MiddleLeft;
     this.addNewCtrl.BackColor = SystemColors.Window;
     this.addNewCtrl.ForeColor = SystemColors.WindowText;
     this.addNewCtrl.LinkBehavior = LinkBehavior.HoverUnderline;
     int height = this.addNewCtrl.Height;
     this.addNewCtrl.Dock = DockStyle.Fill;
     this.addNewCtrl.LinkClicked += new LinkLabelLinkClickedEventHandler(this.addNewCtrl_Click);
     Bitmap bitmap = new Bitmap(typeof(DesignBindingPicker), "AddNewDataSource.bmp");
     bitmap.MakeTransparent(Color.Magenta);
     PictureBox box = new PictureBox {
         Image = bitmap,
         BackColor = SystemColors.Window,
         ForeColor = SystemColors.WindowText,
         Width = height,
         Height = height,
         Dock = DockStyle.Left,
         SizeMode = PictureBoxSizeMode.CenterImage,
         AccessibleRole = AccessibleRole.Graphic
     };
     this.addNewPanel = new Panel();
     this.addNewPanel.Controls.Add(this.addNewCtrl);
     this.addNewPanel.Controls.Add(box);
     this.addNewPanel.Controls.Add(label);
     this.addNewPanel.Height = height + 1;
     this.addNewPanel.Dock = DockStyle.Bottom;
     Label label2 = new Label {
         Height = 1,
         BackColor = SystemColors.ControlDark,
         Dock = DockStyle.Top
     };
     this.helpTextCtrl = new HelpTextLabel();
     this.helpTextCtrl.TextAlign = ContentAlignment.TopLeft;
     this.helpTextCtrl.BackColor = SystemColors.Window;
     this.helpTextCtrl.ForeColor = SystemColors.WindowText;
     this.helpTextCtrl.Height *= 2;
     int num2 = this.helpTextCtrl.Height;
     this.helpTextCtrl.Dock = DockStyle.Fill;
     this.helpTextPanel = new Panel();
     this.helpTextPanel.Controls.Add(this.helpTextCtrl);
     this.helpTextPanel.Controls.Add(label2);
     this.helpTextPanel.Height = num2 + 1;
     this.helpTextPanel.Dock = DockStyle.Bottom;
     base.Controls.Add(this.treeViewCtrl);
     base.Controls.Add(this.addNewPanel);
     base.Controls.Add(this.helpTextPanel);
     base.ResumeLayout(false);
     base.Size = size;
     this.BackColor = SystemColors.Control;
     base.ActiveControl = this.treeViewCtrl;
     base.AccessibleName = System.Design.SR.GetString("DesignBindingPickerAccessibleName");
     base.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
 }
コード例 #2
0
 public DesignBindingPicker()
 {
     base.SuspendLayout();
     if (!isScalingInitialized)
     {
         if (System.Windows.Forms.DpiHelper.IsScalingRequired)
         {
             minimumHeight = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(250);
             minimumWidth = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(250);
         }
         isScalingInitialized = true;
     }
     this.treeViewCtrl = new BindingPickerTree();
     this.treeViewCtrl.HotTracking = true;
     this.treeViewCtrl.BackColor = SystemColors.Window;
     this.treeViewCtrl.ForeColor = SystemColors.WindowText;
     this.treeViewCtrl.BorderStyle = BorderStyle.None;
     Size size = this.treeViewCtrl.Size;
     this.treeViewCtrl.Dock = DockStyle.Fill;
     this.treeViewCtrl.MouseMove += new MouseEventHandler(this.treeViewCtrl_MouseMove);
     this.treeViewCtrl.MouseLeave += new EventHandler(this.treeViewCtrl_MouseLeave);
     this.treeViewCtrl.AfterExpand += new TreeViewEventHandler(this.treeViewCtrl_AfterExpand);
     this.treeViewCtrl.AccessibleName = System.Design.SR.GetString("DesignBindingPickerTreeViewAccessibleName");
     DesignerUtils.ApplyTreeViewThemeStyles(this.treeViewCtrl);
     Label label = new Label {
         Height = 1,
         BackColor = SystemColors.ControlDark,
         Dock = DockStyle.Top
     };
     this.addNewCtrl = new BindingPickerLink();
     this.addNewCtrl.Text = System.Design.SR.GetString("DesignBindingPickerAddProjDataSourceLabel");
     this.addNewCtrl.TextAlign = ContentAlignment.MiddleLeft;
     this.addNewCtrl.BackColor = SystemColors.Window;
     this.addNewCtrl.ForeColor = SystemColors.WindowText;
     this.addNewCtrl.LinkBehavior = LinkBehavior.HoverUnderline;
     int height = this.addNewCtrl.Height;
     int num2 = this.addNewCtrl.Height;
     this.addNewCtrl.Dock = DockStyle.Fill;
     this.addNewCtrl.LinkClicked += new LinkLabelLinkClickedEventHandler(this.addNewCtrl_Click);
     Bitmap logicalBitmap = new Bitmap(System.Drawing.BitmapSelector.GetResourceStream(typeof(DesignBindingPicker), "AddNewDataSource.bmp"));
     logicalBitmap.MakeTransparent(Color.Magenta);
     if (System.Windows.Forms.DpiHelper.IsScalingRequired)
     {
         System.Windows.Forms.DpiHelper.ScaleBitmapLogicalToDevice(ref logicalBitmap);
         height = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(this.addNewCtrl.Height);
         num2 = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(this.addNewCtrl.Height);
     }
     PictureBox box = new PictureBox {
         Image = logicalBitmap,
         BackColor = SystemColors.Window,
         ForeColor = SystemColors.WindowText,
         Width = num2,
         Height = height,
         Dock = DockStyle.Left,
         SizeMode = PictureBoxSizeMode.CenterImage,
         AccessibleRole = AccessibleRole.Graphic
     };
     this.addNewPanel = new Panel();
     this.addNewPanel.Controls.Add(this.addNewCtrl);
     this.addNewPanel.Controls.Add(box);
     this.addNewPanel.Controls.Add(label);
     this.addNewPanel.Height = height + 1;
     this.addNewPanel.Dock = DockStyle.Bottom;
     Label label2 = new Label {
         Height = 1,
         BackColor = SystemColors.ControlDark,
         Dock = DockStyle.Top
     };
     this.helpTextCtrl = new HelpTextLabel();
     this.helpTextCtrl.TextAlign = ContentAlignment.TopLeft;
     this.helpTextCtrl.BackColor = SystemColors.Window;
     this.helpTextCtrl.ForeColor = SystemColors.WindowText;
     this.helpTextCtrl.Height *= 2;
     int num3 = this.helpTextCtrl.Height;
     if (System.Windows.Forms.DpiHelper.IsScalingRequired)
     {
         num3 = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(num3);
     }
     this.helpTextCtrl.Dock = DockStyle.Fill;
     this.helpTextPanel = new Panel();
     this.helpTextPanel.Controls.Add(this.helpTextCtrl);
     this.helpTextPanel.Controls.Add(label2);
     this.helpTextPanel.Height = num3 + 1;
     this.helpTextPanel.Dock = DockStyle.Bottom;
     base.Controls.Add(this.treeViewCtrl);
     base.Controls.Add(this.addNewPanel);
     base.Controls.Add(this.helpTextPanel);
     base.ResumeLayout(false);
     base.Size = size;
     this.BackColor = SystemColors.Control;
     base.ActiveControl = this.treeViewCtrl;
     base.AccessibleName = System.Design.SR.GetString("DesignBindingPickerAccessibleName");
     base.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
 }