Delphi paint

Hi,

-I need help about a delphi paint which I will design. I need to make a program with all the functions from paint.
- Also can you help me with an ideea or a source code for saving the files with .dxf extension

Please this is a very urgent problem.

Thank you

Comments

  • : Hi,
    :
    : -I need help about a delphi paint which I will design. I need to make a program with all the functions from paint.
    : - Also can you help me with an ideea or a source code for saving the files with .dxf extension
    :
    : Please this is a very urgent problem.
    :
    : Thank you
    :
    This site contains the description of the dxf format: http://www.autodesk.com/techpubs/autocad/acad2000/dxf/index.htm
    But you might also want to search for the type library, which reads/writes this format. Once you have found it, you can import the type library into Delphi and it will make a special unit for you containing the interface objects, which are implemented by the type library. From there you can use the ole automation to control those objects and perform whatever functions you like.
  • Thank you but how about the other problem to draw different things on a program? Does anyone knows how to make a menubar movable.
  • : Thank you but how about the other problem to draw different things on a program? Does anyone knows how to make a menubar movable.
    :
    To do that, you need to make the menu into a toolbar. Here is a generic code to do so:
    [code]
    procedure AddToToolBar(Form: TForm; ToolBar: TToolBar;
    Buttons: array of TComponent);
    var
    i: integer;
    b: TToolButton;
    begin
    for i := High(Buttons) downto Low(Buttons) do
    begin
    B := TToolButton.Create(Form);
    with B do
    begin
    Parent := ToolBar;
    if Buttons[i] = nil then
    begin
    Style := tbsSeparator;
    Width := 8;
    end else if Buttons[i] is TMenuItem then
    begin
    Style := tbsButton;
    MenuItem := TMenuItem(Buttons[i]);
    Caption := MenuItem.Caption;
    Width := ToolBar.Canvas.TextWidth(MenuItem.Caption);
    AutoSize := true;
    Grouped := true;
    end else if Buttons[i] is TBasicAction then
    begin
    Style := tbsButton;
    Action := TBasicAction(Buttons[i]);
    AutoSize := ToolBar.Images = nil;
    Grouped := ToolBar.Images = nil;
    end;
    end;
    end;
    end;

    procedure ResizeToolBar(ToolBar: TToolBar);
    var
    i: integer;
    begin
    with ToolBar do
    begin
    if ShowCaptions then
    begin
    Width := 0;
    for i := 0 to ButtonCount-1 do
    if Buttons[i].Visible then
    Width := Width + Buttons[i].Width;
    end else begin
    Width := ButtonCount*ButtonWidth;
    for i := 0 to ButtonCount-1 do
    if Buttons[i].Style in [tbsSeparator, tbsDivider] then
    Width := Width - (ButtonWidth - 8);
    end;
    end;
    end;

    procedure MenuToToolBar(Form: TForm; Menu: TMenu; ToolBar: TToolBar);
    var
    i: integer;
    begin
    Form.Menu := nil;
    for i := ToolBar.ButtonCount-1 downto 0 do
    ToolBar.Buttons[i].Free;
    for i := Menu.Items.Count-1 downto 0 do
    AddToToolBar(Form, ToolBar, [Menu.Items[i]]);
    with ToolBar do
    begin
    Flat := true;
    ShowCaptions := true;
    Images := nil;
    end;
    ResizeToolBar(ToolBar);
    end;
    [/code]
    You can call MenuToToolBar() to convert the MainMenu to a ToolBar. If you place that toolbar in a coolbar, you have a menu like IE.
  • Thanks a lot. I've done that and it works. I'm trying to find out how I can create the paint program.

    Thanks again.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories