zoukankan      html  css  js  c++  java
  • 实现无标题栏但有边框的窗口

    本例效果图:

    代码文件:
    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls;

    type
    TForm1 = class(TForm)
    CheckBox1: TCheckBox;
    procedure CheckBox1Click(Sender: TObject);
    private
    procedure MyMsg(var Msg: TWMNCHitTest); message WM_NCHITTEST;
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.CheckBox1Click(Sender: TObject);
    begin
    SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) xor WS_CAPTION);
    if not CheckBox1.Checked then begin Hide; Show; end;
    end;

    procedure TForm1.MyMsg(var Msg: TWMNCHitTest);
    begin
    Inherited;
    if Msg.Result = HTCLIENT then Msg.Result := HTCAPTION;
    end;

    end.

    窗体文件:
    object Form1: TForm1
    Left = 0
    Top = 0
    Caption = 'Form1'
    ClientHeight = 107
    ClientWidth = 228
    Color = clBtnFace
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    OldCreateOrder = False
    PixelsPerInch = 96
    TextHeight = 13
    object CheckBox1: TCheckBox
    Left = 32
    Top = 40
    Width = 161
    Height = 17
    Caption = #26080#26631#39064#26639#20294#26377#36793#26694#30340#31383#21475
    TabOrder = 0
    OnClick = CheckBox1Click
    end
    end

  • 相关阅读:
    AJAX中所谓的异步
    前端性能优化方案
    文字超出隐藏
    创建值的两种方式及其区别
    单例模式
    自定义数据属性
    时间字符串的处理
    日期函数及时钟案例
    很low的四位验证码实现
    使用Ajax发送http请求(get&post请求)--转载
  • 原文地址:https://www.cnblogs.com/blogpro/p/11446871.html
Copyright © 2011-2022 走看看