Results 1 to 9 of 9

Thread: painting a backround to a form in simba

  1. #1
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default painting a backround to a form in simba

    hola, i'm having trouble getting a backround onto the form in simba, D:

    i'm guessing its in

    SCAR Code:
    procedure paint(Sender: TObject);
    begin
      c := LoadBitmap(ScriptPath + 'background.bmp')
      DrawBitmap(c, form.CANVAS, 0, 0);
      freebitmap(c);
    end;

    but if it helps,

    SCAR Code:
    Form := CreateForm;
      with Form do
      begin
        Caption := 'Awkward Epic Flaxer';
        SetBounds(100, 100, 360, 200);
        BorderStyle := BSToolWindow;
        ONpaint:= @paint;
      end;

    first to help is sexy,
    Last edited by Awkwardsaw; 06-18-2010 at 03:24 AM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  2. #2
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Try:
    SCAR Code:
    Form := CreateForm;
      with Form do
      begin
        Caption := 'Awkward Epic Flaxer';
        SetBounds(100, 100, 360, 200);
        BorderStyle := BSToolWindow;
        paint;
      end;

    If not, then take out the freeBitmap() and just free it on form close.

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Try:
    SCAR Code:
    Form := CreateForm;
      with Form do
      begin
        Caption := 'Awkward Epic Flaxer';
        SetBounds(100, 100, 360, 200);
        BorderStyle := BSToolWindow;
        paint;
      end;

    If not, then take out the freeBitmap() and just free it on form close.
    nope, :\ thanks though
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  4. #4
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Hmm, that's weird. I do exactly the same thing in my Draynor form and it works fine. Try loading the image before initializing the form (just load the image before the CreateForm line.

  5. #5
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Hmm, that's weird. I do exactly the same thing in my Draynor form and it works fine. Try loading the image before initializing the form (just load the image before the CreateForm line.
    that's really weird, it still does nothing D:

    SCAR Code:
    program new;
    {$i srl\srl.scar}
    var
      Form : TFORM;
      labels : array [0..1] of array of TLabel;
      edits : array [0..1] of array of TEdit;
      combos : Array of TCOMBOBOX;
      buttons : Array [0..3] of TButton;
      v : Tvariantarray;
      c : integer;

    const
      column_one = 0;
      column_two = 1;

    procedure ButtonClick(Sender: TObject);
    begin
    end;

    procedure paint(Sender: TObject);
    begin
      DrawBitmap(c, form.CANVAS, 0, 0);
      //freebitmap(c);
    end;

    procedure closeform(Sender: TObject);
    begin
      freebitmap(c);
    end;

    procedure init;
    var
      i, ii, iii : integer;
      labelcaptions : array [0..1] of array of String;
      combotexts : array[0..1] of array of String;
      buttontexts : array of String;
    begin
      labelcaptions[column_one] :=
        ['Username:', 'Password:', 'Nick:', 'Pin:'];
      labelcaptions[column_two] :=
        ['Loads:', 'Server:', 'Signed:', 'Action:'];
      combotexts[0] := ['True', 'False'];
      combotexts[1] := ['[Lumby] Spin Flax', '[LLetya] Pick Flax', '[Cammy] Pick Flax', '[Cammy] Spin Flax', '[Cammy] Both'];
      buttontexts := ['Save', 'Load', 'Start', 'Stop'];
      Form := CreateForm;
      with Form do
      begin
        Caption := 'Awkward Epic Flaxer';
        SetBounds(100, 100, 360, 200);
        BorderStyle := BSToolWindow;
        ONpaint:= @paint;
       // ondestroy := @closeform;
      end;
      setarraylength(labels[column_one], 5);
      for i := 1 to 4 do
      begin
        labels[column_one][i] := TLabel.Create(Form);
        with labels[column_one][i] do
        begin
          Parent := Form;
          caption := labelcaptions[column_one][i - 1];
          left := 10;
          top := i * 28;
        end;
      end;

      setarraylength(labels[column_two], 5);
      for i := 1 to 4 do
      begin
        labels[column_two][i] := TLabel.Create(Form);
        with labels[column_two][i] do
        begin
          Parent := Form;
          caption := labelcaptions[column_two][i - 1];
          left := 200;
          top := i * 28;
        end;
      end;

      setarraylength(edits[column_one], 5);
      for i := 1 to 4 do
      begin
        edits[column_one][i] := Tedit.Create(Form);
        with edits[column_one][i] do
        begin
          Parent := Form;
          Height := 30;
          Width := 110;
          left := 75;
          top := i * 28;
        end;
      end;

      setarraylength(edits[column_two], 3);
      for i := 1 to 2 do
      begin
        edits[column_two][i] := Tedit.Create(Form);
        with edits[column_two][i] do
        begin
          Parent := Form;
          Height := 30;
          Width := 110;
          left := 250;
          top := i * 28;
        end;
      end;

      setarraylength(combos, 3);
      for i := 1 to 2 do
      begin
        combos[i] := Tcombobox.Create(Form);
        with combos[i] do
        begin
          Parent := Form;
          Height := 30;
          Width := 110;
          left := 250;
          top := 56 + i * 28;
          if i = 1 then iii := 1 else iii := 4;
          for II := 0 to iii do
            Items.Add(ComboTexts[i - 1][ii]);
        end;
      end;

      for I := 0 to 3 do
      begin
        Buttons[I] := TButton.Create(Form);
        with Buttons[I] do
        begin
          Parent := Form;
          height := 40;
          width := 90;
          left := i * 90;
          top := 142;
          Caption := buttontexts[i];
          OnClick := @ButtonClick;
        end;
      end;
      form.ShowModal;
      form.Free;
    end;
    begin
      c := LoadBitmap(ScriptPath + 'background.bmp');
      ThreadSafeCall('init',v);
    end.

    if it helps :\

    e : updated to the actual script
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  6. #6
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Are you sure it loads the bitmap correctly? What if you try it with a (smaller) bitmap using BitmapFromString?

  7. #7
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    that's really weird, it still does nothing D:

    SCAR Code:
    program new;
    {$i srl\srl.scar}
    var
      Form : TFORM;
      labels : array [0..1] of array of TLabel;
      edits : array [0..1] of array of TEdit;
      combos : Array of TCOMBOBOX;
      buttons : Array [0..3] of TButton;
      v : Tvariantarray;
      c : integer;

    const
      column_one = 0;
      column_two = 1;

    procedure ButtonClick(Sender: TObject);
    begin
    end;

    procedure paint(Sender: TObject);
    begin
      DrawBitmap(c, form.CANVAS, 0, 0);
      //freebitmap(c);
    end;

    procedure closeform(Sender: TObject);
    begin
      freebitmap(c);
    end;

    procedure init;
    var
      i, ii, iii : integer;
      labelcaptions : array [0..1] of array of String;
      combotexts : array[0..1] of array of String;
      buttontexts : array of String;
    begin
      labelcaptions[column_one] :=
        ['Username:', 'Password:', 'Nick:', 'Pin:'];
      labelcaptions[column_two] :=
        ['Loads:', 'Server:', 'Signed:', 'Action:'];
      combotexts[0] := ['True', 'False'];
      combotexts[1] := ['[Lumby] Spin Flax', '[LLetya] Pick Flax', '[Cammy] Pick Flax', '[Cammy] Spin Flax', '[Cammy] Both'];
      buttontexts := ['Save', 'Load', 'Start', 'Stop'];
      Form := CreateForm;
      with Form do
      begin
        Caption := 'Awkward Epic Flaxer';
        SetBounds(100, 100, 360, 200);
        BorderStyle := BSToolWindow;
        ONpaint:= @paint;
       // ondestroy := @closeform;
      end;
      setarraylength(labels[column_one], 5);
      for i := 1 to 4 do
      begin
        labels[column_one][i] := TLabel.Create(Form);
        with labels[column_one][i] do
        begin
          Parent := Form;
          caption := labelcaptions[column_one][i - 1];
          left := 10;
          top := i * 28;
        end;
      end;

      setarraylength(labels[column_two], 5);
      for i := 1 to 4 do
      begin
        labels[column_two][i] := TLabel.Create(Form);
        with labels[column_two][i] do
        begin
          Parent := Form;
          caption := labelcaptions[column_two][i - 1];
          left := 200;
          top := i * 28;
        end;
      end;

      setarraylength(edits[column_one], 5);
      for i := 1 to 4 do
      begin
        edits[column_one][i] := Tedit.Create(Form);
        with edits[column_one][i] do
        begin
          Parent := Form;
          Height := 30;
          Width := 110;
          left := 75;
          top := i * 28;
        end;
      end;

      setarraylength(edits[column_two], 3);
      for i := 1 to 2 do
      begin
        edits[column_two][i] := Tedit.Create(Form);
        with edits[column_two][i] do
        begin
          Parent := Form;
          Height := 30;
          Width := 110;
          left := 250;
          top := i * 28;
        end;
      end;

      setarraylength(combos, 3);
      for i := 1 to 2 do
      begin
        combos[i] := Tcombobox.Create(Form);
        with combos[i] do
        begin
          Parent := Form;
          Height := 30;
          Width := 110;
          left := 250;
          top := 56 + i * 28;
          if i = 1 then iii := 1 else iii := 4;
          for II := 0 to iii do
            Items.Add(ComboTexts[i - 1][ii]);
        end;
      end;

      for I := 0 to 3 do
      begin
        Buttons[I] := TButton.Create(Form);
        with Buttons[I] do
        begin
          Parent := Form;
          height := 40;
          width := 90;
          left := i * 90;
          top := 142;
          Caption := buttontexts[i];
          OnClick := @ButtonClick;
        end;
      end;
      form.ShowModal;
      form.Free;
    end;
    begin
      c := LoadBitmap(ScriptPath + 'background.bmp');
      ThreadSafeCall('init',v);
    end.

    if it helps :\

    e : updated to the actual script
    All I did was replace background.bmp with golf1.jpg (because I don't have your image), and it worked fine. Here's a pic -> http://i50.tinypic.com/34o1rif.png

  8. #8
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    All I did was replace background.bmp with golf1.jpg (because I don't have your image), and it worked fine. Here's a pic -> http://i50.tinypic.com/34o1rif.png
    :\. maby its just my image

    thanks

    e: yeah, D:. it was a .png not a .bmp

    Last edited by Awkwardsaw; 06-18-2010 at 02:09 PM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  9. #9
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    :\. maby its just my image

    thanks

    e: yeah, D:. it was a .png not a .bmp

    That shouldn't matter. The golf1 image I used was a .jpg, and every image I use in my Draynor script's form is a .png. Weird, but I'm glad it's working now.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •