Click here to Skip to main content
15,885,216 members
Home / Discussions / C#
   

C#

 
QuestionHashTable elements not found in the same order as they are added Pin
mmdullah10-Jun-09 19:06
mmdullah10-Jun-09 19:06 
AnswerRe: HashTable elements not found in the same order as they are added [modified] Pin
Seikilos10-Jun-09 19:41
Seikilos10-Jun-09 19:41 
QuestionHow can i get the VISIBLE bounds of a control. [modified] Pin
hwswin10-Jun-09 18:15
hwswin10-Jun-09 18:15 
AnswerRe: How can i get the VISIBLE bounds of a control. Pin
Rob Philpott10-Jun-09 22:46
Rob Philpott10-Jun-09 22:46 
GeneralRe: How can i get the VISIBLE bounds of a control. Pin
hwswin11-Jun-09 15:21
hwswin11-Jun-09 15:21 
GeneralRe: How can i get the VISIBLE bounds of a control. Pin
hwswin11-Jun-09 17:35
hwswin11-Jun-09 17:35 
GeneralRe: How can i get the VISIBLE bounds of a control. Pin
Rob Philpott12-Jun-09 1:59
Rob Philpott12-Jun-09 1:59 
GeneralRe: How can i get the VISIBLE bounds of a control. Pin
hwswin12-Jun-09 5:13
hwswin12-Jun-09 5:13 
Thanks again!
Rob Philpott wrote:
The right and bottom line are probably not appearing because they're outside the clip rectangle


I use the Inflate(-2, -2) to make sure the Rectangle was inside the clip rectangle,but they're still not appearing.

follow is the test code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace draw
{
    public partial class Form1 : Form
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.panel1 = new System.Windows.Forms.Panel();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.panel1.SuspendLayout();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.Controls.Add(this.groupBox1);
            this.panel1.Location = new System.Drawing.Point(192, 141);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(200, 100);
            this.panel1.TabIndex = 0;
            // 
            // groupBox1
            // 
            this.groupBox1.Location = new System.Drawing.Point(91, 43);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(200, 100);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "groupBox1";
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(674, 358);
            this.Controls.Add(this.panel1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
            this.panel1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.GroupBox groupBox1;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Control ctrl = groupBox1;
            Control ctrlP;

            ctrlP = ctrl.Parent;
            Rectangle r = ctrl.Bounds;
            Rectangle rP = new Rectangle(0, 0, ctrlP.Width, ctrlP.Height);
            r.Intersect(rP);
            r.Inflate(-2, -2);

            Graphics g = ctrlP.CreateGraphics();
            Pen p = new Pen(Color.Red);
            p.Width = 1.5f;
            g.DrawRectangle(p, r);
            g.Dispose();
        }
    }
}

GeneralRe: How can i get the VISIBLE bounds of a control. Pin
hwswin12-Jun-09 5:39
hwswin12-Jun-09 5:39 
GeneralRe: How can i get the VISIBLE bounds of a control. Pin
Rob Philpott12-Jun-09 5:40
Rob Philpott12-Jun-09 5:40 
GeneralRe: How can i get the VISIBLE bounds of a control. Pin
hwswin12-Jun-09 5:47
hwswin12-Jun-09 5:47 
Questionwhat is the best and more professional GUI designing? Pin
cppwxwidgetsss10-Jun-09 17:57
cppwxwidgetsss10-Jun-09 17:57 
AnswerRe: what is the best and more professional GUI designing? Pin
N a v a n e e t h10-Jun-09 18:21
N a v a n e e t h10-Jun-09 18:21 
QuestionI want to do a control like vs2005 doc outline tool Pin
hwswin10-Jun-09 17:40
hwswin10-Jun-09 17:40 
AnswerRe: I want to do a control like vs2005 doc outline tool Pin
Christian Graus10-Jun-09 17:52
protectorChristian Graus10-Jun-09 17:52 
GeneralRe: I want to do a control like vs2005 doc outline tool Pin
hwswin10-Jun-09 18:09
hwswin10-Jun-09 18:09 
GeneralRe: I want to do a control like vs2005 doc outline tool Pin
S. Senthil Kumar10-Jun-09 23:59
S. Senthil Kumar10-Jun-09 23:59 
GeneralRe: I want to do a control like vs2005 doc outline tool Pin
hwswin11-Jun-09 15:30
hwswin11-Jun-09 15:30 
GeneralRe: I want to do a control like vs2005 doc outline tool Pin
S. Senthil Kumar11-Jun-09 21:06
S. Senthil Kumar11-Jun-09 21:06 
QuestionCommand Scripts Pin
bigjoe11a10-Jun-09 17:06
bigjoe11a10-Jun-09 17:06 
QuestionUm, Opening link in new tab - not new window? [modified] Pin
Baeltazor10-Jun-09 15:15
Baeltazor10-Jun-09 15:15 
Questionwriting a development environment Pin
JimLaVine10-Jun-09 14:45
JimLaVine10-Jun-09 14:45 
AnswerRe: writing a development environment Pin
Christian Graus10-Jun-09 14:48
protectorChristian Graus10-Jun-09 14:48 
AnswerRe: writing a development environment Pin
Luc Pattyn10-Jun-09 14:49
sitebuilderLuc Pattyn10-Jun-09 14:49 
GeneralRe: writing a development environment Pin
JimLaVine10-Jun-09 15:03
JimLaVine10-Jun-09 15:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.