QQ登录

只需要一步,快速开始

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

简单自画菜单效果

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

3

主题

1

听众

29

积分

升级  25.26%

该用户从未签到

新人进步奖

跳转到指定楼层
1#
发表于 2004-9-30 19:33 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>//---------------------------------------------------------------------------9 [+ M8 B* F! r: `
#include &lt;vcl.h&gt;, s4 Z: T. U" Q7 U5 V) J
#pragma hdrstop</P>
! Z3 s, }6 S% v) t, x<>#include "Unit1.h"
: e, u% r: N9 a7 M//---------------------------------------------------------------------------
6 U, l8 n: H- u4 T: ?: h# N#pragma package(smart_init)) o. u/ f6 p7 N
#pragma resource "*.dfm"
3 ~6 D- ~3 i4 D+ JTForm1 *Form1;</P>/ w) K6 I6 o$ Y1 F, b
<>Graphics::TBitmap *bmp;                       v/ A( t6 J; `, F, H! s5 `# ^3 ?
//---------------------------------------------------------------------------! V7 e% z) h. S$ I
__fastcall TForm1::TForm1(TComponent* Owner)" d# c. ]  i6 b" s+ u1 v
    : TForm(Owner)
; z- V  A8 Q) A! Z3 f3 X5 l{
  J/ ^& d) L: l" n: U9 N. ?    bmp = new Graphics::TBitmap;           ; X! g/ X; X1 r) d: {/ o) p
    bmp-&gt;LoadFromFile("Bar.bmp");          3 C6 J6 j7 w4 ^* W! ?3 R, h9 W
}- M/ X8 d% e; V
//---------------------------------------------------------------------------( ~7 D6 |& T( X4 }2 N
void __fastcall TForm1::BarItemMeasureItem(TObject *Sender,+ \9 y: H' ~4 S" u, u
      TCanvas *ACanvas, int &amp;Width, int &amp;Height)- N, I" I0 _# d
{: H- A" J( w$ T' Y6 X' G2 M/ k
    Width += 2;                     </P>
; o) S" {- ?, G& U/ B<>  Height *= BarItem-&gtarent-&gt;Count - 1;   
; N3 W, |9 j" U: t" x) m; J}6 U4 l) d( `( y# K$ K3 j
//---------------------------------------------------------------------------
2 L$ p. K' j5 q7 f2 Tvoid __fastcall TForm1::BarItemDrawItem(TObject *Sender, TCanvas *ACanvas,# A/ Q5 r0 J* z3 ^3 e4 d1 y
      TRect &amp;ARect, bool Selected)
3 p: ~: T2 Z9 j8 n1 K- R( [{
; K/ a" M7 W3 o! U9 G; ?    ACanvas-&gt;Draw(0, 0, bmp);               
7 a; T5 t$ `" K4 O' Q4 X6 l8 U}
0 b4 t8 b: ~8 d& i: ~//---------------------------------------------------------------------------# N3 i1 ?& h+ R$ P1 P& q
void __fastcall TForm1::FormDestroy(TObject *Sender): V. O; T- o9 r" r7 c
{: ~: F) {) p% G
    delete bmp;                            % O3 J$ l4 j- A+ U# l
}' `+ Q# R$ J# C  w
//---------------------------------------------------------------------------</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-6-12 06:16 , Processed in 0.434708 second(s), 51 queries .

回顶部