Solved

How to paint standard Delphi control on some DC?

Posted on 1998-01-18
4
276 Views
Last Modified: 2010-04-04
How to paint standard Delphi control on some DC? For example I want to put TButton into form's caption. I can obtain caption's DC using WM_NCPAINT what then? Once again I want to put Delphi's TWinControl's descendant, not Windows button class.

Thanks!
0
Comment
Question by:_art_
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 100 total points
Comment Utility
You can use any TWinControl's "PaintTo" method if you have a DC.

E.g.
  MyButton.PaintTo(SomeDC, 10, 20);

JB
0
 

Author Comment

by:_art_
Comment Utility
Well not exactly. This draws control's actual image and
no more (btw it isn't working with TAnimate at some reasons).
What I need is to put fullly workable control with all its behavior into knowing DC.
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
To get a control to work in the non-client area, you need to trap other the NC messages: WM_NCHITTEST, WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_NCPAINT (you already do this).
0
 

Author Comment

by:_art_
Comment Utility
Yep, but how to do that? To put control there. My main task is to add TAnimate to the menu item (maybe you have seen CoolMenus - package of mine). TAnimate or any TWinControl's descendant that does AVI... It is no problem to write one but it has to be
WINDOWED control itself...

SendMessage(Handle, ACM_OPEN, 0, LongInt(FileName));
            ^^^^^^
Should be passed DC of windowed control but not menu item's or whatever's else.
Any working ideas will be appreciated (not just with points) :-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now