Skip to main content
All docs
V22.2

DevExpress v25.1 Update — Your Feedback Matters

Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Custom Hint Window Example (C++Builder)

This example demonstrates how you can implement a custom hint window to display a bitmap with a hint text. Note that this type of window is displayed if the bar manager’s UseBarHintWindow property is True.

C++
Project.cpp
#include <vcl.h>
#pragma hdrstop
USERES("Project.res");
USEFORM("Unit1.cpp", Form1);
#include "Unit1.h"
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    try
    {
        Application->Initialize();
        dxBarHintWindowClass = __classid(TMyHint);
        Application->CreateForm(__classid(TForm1), &Form1);
        Application->Run();
    }
    catch (Exception &exception)
    {
        Application->ShowException(&exception);
    }
    return 0;
}
// C++Builder
Unit1.h
// ...
class TMyHint : public TdxBarHintWindow
{
private:
    Graphics::TBitmap * FBitmap;
protected:
    void __fastcall Paint(void);
public:
    __fastcall TMyHint(TComponent * AOwner);
    __fastcall ~TMyHint(void);
};
// C++Builder
Unit1.cpp
// ...
__fastcall TMyHint::TMyHint(TComponent * AOwner) : TdxBarHintWindow(AOwner)
{
  FBitmap = new Graphics::TBitmap;
  FBitmap->LoadFromFile("...");
}
__fastcall TMyHint::~TMyHint(void)
{
  delete FBitmap;
}
void __fastcall TMyHint::Paint(void)
{
  RECT R;
  R = ClientRect;
  DrawEdge(Canvas->Handle, &R, BDR_RAISEDOUTER, BF_RECT);
  Canvas->Draw(2 , (int)((Height - FBitmap->Height) / 2), FBitmap);
  Canvas->TextOut(FBitmap->Width + 2 , (int)((Height - Canvas->TextHeight(Caption))/2), Caption);
}
See Also