如何调整面板用户Outlook的大小 [英] how to resize the panel user Outlook

查看:229
本文介绍了如何调整面板用户Outlook的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我尝试调整添加Outlook的用户面板的大小

这是我的代码:


hello,

I try to resize my user panel that I added Outlook

here is my code:


// Copyright (c) MEMOS Software s.r.o. All rights reserved.
//
// Outlook Panel Demostration
//
// File     : PanelContainer.cs
// Author   : Lukas Neumann <[EMAIL DELETED]>
// Created  : 080622
//

using System;
using System.Drawing;
using System.Windows.Forms;
namespace OutlookPanel
{
    /// <summary>
    /// Container control which mimics Outlook panel drawing style and which holds custom nested panel
    /// </summary>
    partial class PanelContainer : UserControl
    {
        /// <summary>
        /// Default constructor
        /// </summary>
        public PanelContainer()
        {
            InitializeComponent();
        }
        /// <summary>
        /// Attach nested panel control
        /// </summary>
        /// <param name="control"></param>
        public void AttachControl(UserControl control)
        {
            this.pnlContainer.Controls.Add(control);
            control.Dock = DockStyle.Fill;
        }
        /// <summary>
        /// Custom procedure for background drawing
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            using (Pen pen = new Pen(OutlookThemes.BorderColor))
            {
                //Draw a border around the control, to provide Outlook-like design
                Rectangle rect = new Rectangle(this.pnlContainer.Left - 1, this.pnlContainer.Top - 1, this.pnlContainer.Width + 1, this.pnlContainer.Height + 1);
                e.Graphics.DrawRectangle(pen, rect);
            }
        }
        /// <summary>
        /// Size change procedure
        /// </summary>
        /// <param name="e"></param>
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);
            //The size has been change, invalidate the control
            this.Invalidate();
        }
        /// <summary>
        /// Load event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BarControlContainer_Load(object sender, EventArgs e)
        {
            //Set the background color according to the current Outlook theme
            this.BackColor = OutlookThemes.BackgroundColor;
        }
    }
}



...

我指望你帮帮我.


[edit]
粗体转换为代码块:保留格式
电子邮件已删除:除非您真的喜欢垃圾邮件,否则切勿将电子邮件发布到任何公共论坛上
紧急性已删除:这可能对您来说很紧急,但对我们而言并非如此.如果您强调紧急性,就会使人烦恼,因为这会使他们认为您太懒了,无法及时开始家庭作业(无论是否如此).
OriginalGriff
[/edit]



...

I count on you to give me a hand.


[edit]
Bold converted to code block: it preserves the formatting
Email removed: never post your email to any public forum, unless you really like spam
Urgency deleted: it may be urgent to you, but it isn''t to us. You will annoy people if you stress the urgency, as it makes them think you were too lazy to start your homework in time (whether that is the case or not).
OriginalGriff
[/edit]

推荐答案

好吧,我不确定这是否会按您的预期工作.您不能使用该控件的Graphics 对象来绘制该控件的边界.更好,更可行的解决方案是确保您的子控件在所有4个面上都留有少量空白,然后外部控件在此空白区域上绘画.
Okay, I am not sure that will work as you expect. You cannot use that control''s Graphics object to draw outside the bounds of that control. A better and more workable solution would be to make sure that your child control leaves a small margin on all 4 sides, and then the outer control paints over this margin area.


这篇关于如何调整面板用户Outlook的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆