我想在工具栏某个按钮的右上区域动态显示数字,类似360软件管家、软件升级图标上提示的数字,如何实现的
解决方案 »
- delphi中dbgrid的普遍重大问题 求助求助
- 想找一个c/s结构的进销存系统原代码,哪位有啊,帮帮我吧
- main--detail表问题
- 如何实现ViewStyle为vsReport的ListView鼠标拖动改变行排列顺序
- > >> >>>高分求解:如何开发类似于debug->view cpu中右下角那样的组件?要求直接从TCustomControl继承
- access数据库排序难题~~~~~~
- 如何才能让hint信息出来之后一直显示?
- 哪里有power designer 下?谢谢!
- 在线求助!!关于TQuery!!
- 有人用过ADEMCO685接警机开发接警中心软件吗?提供点资料和经验,不但有分还有钱分!!(内空)
- getmem的用法?再次提问!
- 求解静态编译 sqlite3的问题
你可以用eXeScope看看管家的EXE和DLL文件,看看图标是怎么一回事
desktopPath
=
System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
IWshRuntimeLibrary.WshShell shell=new WshShell();
IWshRuntimeLibrary.WshShortcut shortcut = (IWshRuntimeLibrary.WshShortcut)shell.CreateShortcut(desktopPath
+
"//个人日记本.lnk");
string
exePath
=
Application.ExecutablePath;
//exe路径
string
dirPath=System.Environment.CurrentDirectory;
//directory路径
//画图部分
Bitmap
icoImg = new Bitmap(this.Icon.ToBitmap());
Graphics graIco = Graphics.FromImage(icoImg);
graIco.DrawString("1", new Font("Eras Medium
ITC",
icoImg.Width/3), new SolidBrush(Color.Red),
icoImg.Width-icoImg.Width/2,
0); Icon ico
=
Icon.FromHandle(icoImg.GetHicon());
string
icoName
=
dirPath
+
"\\cns.ico";
Stream stream = new FileStream(icoName,
FileMode.Create); ico.Save(stream); graIco.Dispose();
icoImg.Dispose(); //创建图标
shortcut.WorkingDirectory
=
dirPath;
shortcut.TargetPath = exePath;
shortcut.IconLocation = dirPath
+
"\\cns.ico,0";
shortcut.WindowStyle = 1;
shortcut.Save();
type
TForm1 = class(TForm)
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ImageList3232: TImageList;
procedure FormCreate(Sender: TObject);
private
procedure ButtonMsg(var Message: TMessage);
public
end;
.............
procedure TForm1.ButtonMsg(var Message: TMessage);
var
X , Y : integer;
begin
if Message.Msg=WM_PAINT then begin
X := ToolButton1.ClientRect.Right - ToolBar1.Canvas.TextWidth('13') - 5;
Y := ToolButton1.ClientRect.Top + 3;
ToolBar1.Canvas.Brush.Color := clBlue;
ToolBar1.Canvas.Brush.Style := bsSolid;
ToolBar1.Canvas.TextOut(X , Y , '13');
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
//指定了就有,未指定就没有数字,注意ButtonMsg指定了对象,自行调整
ToolBar1.Buttons[0].WindowProc := ButtonMsg;
end;D7通过.其他版本自行测试
按钮, 数字都是图片
你的效果要求一般的话, 直接canvas画
否则, 还是图片吧