开发者

How to implement this using Windows forms?

开发者 https://www.devze.com 2023-03-26 08:11 出处:网络
I have two problems with my windows form in Visual Basic .NET 2008. If you have worked with sticky notes you will understand me better.

I have two problems with my windows form in Visual Basic .NET 2008. If you have worked with sticky notes you will understand me better.

How to implement this using Windows forms?

Now my problems:

  1. If you look you'll see the background color of number 1 and 2 are diffrent but both belongs to the same control. How is this possible?
  2. In right bottom corner, there is something by which a user can resize the form. How I can开发者_开发知识库 do this?


Item 1: I think you are referring to LinearGradient Brush-- look in the System.Drawing.Drawing2D class.

Item 2: They are drawing a resize handler. You can try using the ControlPaint.DrawSizeGrip method or draw your own.

Update:

Per your comments, you can look into Owner-drawing a Windows.Forms TextBox


You can draw a gradient background by overriding OnPaintBackground():

    protected override void OnPaintBackground(PaintEventArgs e)
    {
        // set these to whatever you want 
        Color color1 = Color.LightBlue; 
        Color color2 = Color.DarkBlue;

        using (Brush backbrush =
            new LinearGradientBrush(e.ClipRectangle, color1, color2,
                LinearGradientMode.Vertical))
        {
            e.Graphics.FillRectangle(backbrush, e.ClipRectangle);
        }

    }

You can show the size gripper by setting the form's SizeGripStyle to Show:

SizeGripStyle = SizeGripStyle.Show;

Or just set it in the designer.

EDIT: Look at this page for creating a transparent textbox (if the textbox is transparent, the gradient form background will show through.)

0

精彩评论

暂无评论...
验证码 换一张
取 消