Solved

Delphi ToolBar Problem

Posted on 2008-10-27
2
1,741 Views
Last Modified: 2013-11-23
I am making my application as resolution indepandant but toolbuttons are not calculated depends on my formula for resolution which is applying for other components

Below is mycode

for idx := 0 to -1 + self.ComponentCount do
  begin
    if Components[idx] is TControl then
    begin
      ctrl := TControl(Components[idx]) ;
      if (ctrl.Name = 'LEADImage1') or (ctrl.Name = 'OutputImage') then  continue;
      ctrl.Top := ctrl.Top * longint(screen.Height) div
                  ScreenHeight;
      ctrl.Height := ctrl.Height  * longint(screen.Height) div
                  ScreenHeight;
      ctrl.Left := ctrl.Left  * longint(screen.Width) div
                  ScreenWidth;
      ctrl.Width := ctrl.Width * longint(screen.Width) div
                  ScreenWidth;
      if GetPropInfo(ClassInfo, 'font')<>nil then
               Font.Size := (GetSystemMetrics(0)  div ScreenWidth)
                           *font.Size;
    end;
  end;
0
Comment
Question by:inampudi1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
dprochownik earned 500 total points
ID: 22810913
Toolbar button are specific component which don't decide about their size. You have to change button size for TToolBar component, which contains Toolbuttons

You can simply change yours procedure like this:


for idx := 0 to -1 + self.ComponentCount do
  begin
    if Components[idx] is TToolBar then
    begin
      TToolBar(Components[idx]).ButtonHeight := TToolBar(Components[idx]).ButtonHeight  * longint(screen.Height) div
                  ScreenHeight;
      TToolBar(Components[idx]).ButtonWidth := TToolBar(Components[idx]).ButtonWidth * longint(screen.Width) div
                  ScreenWidth;
    end
    else if Components[idx] is TControl then
    begin
      ctrl := TControl(Components[idx]) ;
      if (ctrl.Name = 'LEADImage1') or (ctrl.Name = 'OutputImage') then  continue;
      ctrl.Top := ctrl.Top * longint(screen.Height) div
                  ScreenHeight;
      ctrl.Height := ctrl.Height  * longint(screen.Height) div
                  ScreenHeight;
      ctrl.Left := ctrl.Left  * longint(screen.Width) div
                  ScreenWidth;
      ctrl.Width := ctrl.Width * longint(screen.Width) div
                  ScreenWidth;
      if GetPropInfo(ClassInfo, 'font')<>nil then
               Font.Size := (GetSystemMetrics(0)  div ScreenWidth)
                           *font.Size;
    end;
  end;

Open in new window

0
 

Author Closing Comment

by:inampudi1
ID: 31510222
thanks a lot for your assistance in solving my problem
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

623 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