QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2564|回复: 0
打印 上一主题 下一主题

简单自画菜单效果

[复制链接]
字体大小: 正常 放大

3

主题

1

听众

29

积分

升级  25.26%

该用户从未签到

新人进步奖

跳转到指定楼层
1#
发表于 2004-9-30 19:33 |只看该作者 |正序浏览
|招呼Ta 关注Ta
<>//---------------------------------------------------------------------------
1 D' M3 s6 i$ C) k, M  C4 m# A2 M#include &lt;vcl.h&gt;
; ?& i3 k0 ]4 d( [! x#pragma hdrstop</P>
) Q- D, h7 p0 c" J$ E( R8 b; q<>#include "Unit1.h"
' b( p+ b; i" ^8 p/ P//---------------------------------------------------------------------------$ n0 H7 g, \6 P3 j2 h. R' _. e4 m
#pragma package(smart_init)
$ ~  [- R" M( C* |( n* [2 I$ P% D#pragma resource "*.dfm"5 L) I0 H/ s5 J  c8 E
TForm1 *Form1;</P>: w( u' @* g, s$ R7 f8 W
<>Graphics::TBitmap *bmp;                     * ]) N* Q6 f0 t' Y) |& P4 C
//---------------------------------------------------------------------------
2 W; _, L, K* K7 x__fastcall TForm1::TForm1(TComponent* Owner)
6 G/ ^  p% N- o  b    : TForm(Owner)( J) Z9 i8 q. h0 J3 l7 y
{
, y6 l0 S+ D, s. h5 p    bmp = new Graphics::TBitmap;           
/ `& q5 {; C: N    bmp-&gt;LoadFromFile("Bar.bmp");          + h$ W0 F% j; g: i: a# H; s- Q
}
' c' |' s. r  S% f5 K" H; w//---------------------------------------------------------------------------3 C7 O0 M0 c& g6 _
void __fastcall TForm1::BarItemMeasureItem(TObject *Sender,
1 }0 g' F2 G$ G$ K. w7 r5 g- B      TCanvas *ACanvas, int &amp;Width, int &amp;Height)! q0 {0 [0 i# P0 T
{
3 y" z, m8 b$ S# ]0 p    Width += 2;                     </P>
& L, C8 ?: N  f0 p- o2 c<>  Height *= BarItem-&gtarent-&gt;Count - 1;   $ k, z3 W. o5 c1 v7 g
}" b* c7 m1 }8 @" i) ^
//---------------------------------------------------------------------------! t0 O. p* _$ {- J  D* @# t
void __fastcall TForm1::BarItemDrawItem(TObject *Sender, TCanvas *ACanvas,
- V! I2 j0 @  |1 A      TRect &amp;ARect, bool Selected)9 c  e) v/ l! u4 r3 v, u1 f: u
{% n! \/ p) i1 [6 a6 t- a
    ACanvas-&gt;Draw(0, 0, bmp);               : q1 d  ^! F) g
}" q$ n- D' O6 C# I
//---------------------------------------------------------------------------1 d1 X4 B, z+ e; ~5 P
void __fastcall TForm1::FormDestroy(TObject *Sender)
- h- a$ D* f2 R{
" O5 y; r' b: U7 ~    delete bmp;                            6 @8 |6 M& S  q4 e1 n; C0 E( M
}7 x+ H( J  t+ V; T! l
//---------------------------------------------------------------------------</P>
zan
转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
您需要登录后才可以回帖 登录 | 注册地址

qq
收缩
  • 电话咨询

  • 04714969085
fastpost

关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

手机版|Archiver| |繁體中文 手机客户端  

蒙公网安备 15010502000194号

Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

GMT+8, 2026-10-27 08:13 , Processed in 0.545881 second(s), 52 queries .

回顶部