Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > VCL

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-12-2017, 12:00 PM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default Imagelist to a canvas

I have a button and a Imagelist
I have used DrawFrameControl with good success to give me a edge for both up and down. InflateRect (R, -1, -1); has given a simple area of the canvas to paint my image.
Transparent := True; I need but I set the TransparentColor should be a bottom left pixel of the image?

TTBar(Parent).Images.Draw(Canvas, 0, 0, ImageIndex, );
Is this a good approach and can I deal with sizing ok some how
Many questions sorry as I cannot find a good editorial
Reply With Quote
  #2  
Old 12-13-2017, 08:28 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,270
Default

For sizing you might be in luck to just catch the WM_EXITSIZEMOVE event.
But since it's a button, what sizing do you have on that? A Form sizes, a button is normally static.

But what are you trying to write here? A TToolBar (based on you naming) implementation of your own?
If so, what does this do different then the default TToolBar (because you can add TToolButton and just assign images to it).
Reply With Quote
  #3  
Old 12-13-2017, 08:46 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

Yes a toolbar of a type, Imagelist handling like this is totally new territory to me

You said sizing is often static so I can use a simple draw - to the canvas
Images.Draw(Canvas, 0, 0, ImageIndex, .... );
correct. Or would you prefer something else?
Reply With Quote
  #4  
Old 12-13-2017, 11:44 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,270
Default

depends on what control you paint on.
But my question remains, what does this TTBar do different to a TToolBar?

Because TToolBar with TToolButton has already a reference to TImageList. So you obviously do a lot of other stuff. Without knowing this 'other stuff' and the structure of your component(s) it's not possible to answer if your way is the right way (and that is what you are after I guess).
Reply With Quote
  #5  
Old 12-13-2017, 09:39 PM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

I have TEdit, TCombobox working too, My buttons and placement is very sharp/good TGraphicControl dersendants. Flat option. I have auto ordering and temperately removal with visibility. I have 1 group of selected buttons where only one can be pressed, And all separators... as in TToolbar. Much of the object (sizing) is TToolbar fixed But have not used TToolWin as desendant component as no details good enough with Delphi's Q_Objects.
I have still a lot to do like graphics, designtime focus (that not hard), you will like designtime tools very much. Have not connected menus to drop down buttons and have not got slightly grayed menus as in Delphi IDE.

TEdit, TCombobox are not as high as a TToolBar button thinking to adjust?
I have to connect to the action manager yet, I do not have drag and drop, not planning on it.

May be latter set the TTBar to default to TToolbar size and adjust height for large internal buttons based on TTBar height. my question is what do I do with TEdit, TCombobox in the TTbar and graphics.
Have not finalized everything yet. I have most of the tools in my head to implement this.
Reply With Quote
  #6  
Old 12-14-2017, 07:51 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,270
Default

As long as you place components on your own TTBar and draw on them you're safe when resizing. Otherwise you'll have to catch that event I told you earlier and Repaint on it.
But you can always look at how the default TToolBar does these things and copy the parts you do like from there...
Reply With Quote
  #7  
Old 12-14-2017, 07:51 PM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

yes I'm familiar with WM_EXITSIZEMOVE event

its stretch drawing if I do sizing, centering the icon......
Reply With Quote
Reply

Tags
canvas, delphi 7

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:17 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.