Jump to content

How to add this like on picture :S


Madza91
 Share

Recommended Posts

Hi, i want to know how to add this "button" like on picture to minimize to tray? :|

Posted Image

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

That is "MyPhoneExplorer" software... download that program and see <_<

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Ahh, I've always had trouble with gui, and what I do for something like that is to make a popup/tool window GUI, and make the border on you own(using images)then make images for the buttons and set your actions to those pictures as if they were buttons.

I'll share some of mine if you'd like

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

I tried to but my computer won't let me send PMs for some reason, I hit send but it freezes at a white screen so I'll just post it here.

This is an example of some Myspace Spamming program(irrevlant), but notice how I skinned the title bar using images, and setting images as buttons, also, you can recreate the title bar drag by using the Drag() Function

;code code code
Case $Pic1
Drag()
;more code
Func Drag()
    dllcall("user32.dll","int","ReleaseCapture")
    dllcall("user32.dll","int","SendMessage","hWnd", $Forma,"int",0xA1,"int", 2,"int", 0)
EndFunc

You'll have to make your own skin, though. Thats always a drag.

I wonder if I can delete downloads, i've hit my limit already...

Example.rar

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

oh, P.S. You'll want to extract that, otherwise itll do some weird stuff (like opening and closing a command prompts? I didn't program that in there....)

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

Here is Delphi elegant solutiom:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons;

type
  TForm1 = class(TForm)
    procedure FormResize(Sender: TObject);
  private
    { Private declarations }
    TitleButton: TRect;
    procedure DrawTitleButton;
    procedure WMSetText(var Msg: TWMSetText); message WM_SETTEXT;
    procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;
    procedure WMNCActivate(var Msg: TWMNCActivate); message WM_NCACTIVATE;
    procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
    procedure WMNCLButtonDown(var Msg: TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

const
  htTitleBtn = htSizeLast + 1;

implementation

{$R *.dfm}


procedure TForm1.DrawTitleButton;
var
  bmap: TBitmap;
  XFrame, XTtlBit, YTtlBit: Integer;
begin
  XFrame := GetSystemMetrics(SM_CXFRAME);
  XTtlBit := GetSystemMetrics(SM_CXSIZE);
  YTtlBit := GetSystemMetrics(SM_CYSIZE);
  TitleButton := Bounds(Width - XFrame - 4*XTtlBit + 2, XFrame + 2 , XTtlBit - 4 , YTtlBit - 4);
  Canvas.Handle := GetWindowDC(Self.Handle);
  try
    DrawButtonFace(Canvas, TitleButton, 1, bsAutoDetect, False, False, False);
    bmap := TBitmap.Create;
    bmap.LoadFromFile('info.bmp');
    TitleButton.Left := TitleButton.Left + 2;
    TitleButton.Top := TitleButton.Top + 2;
    TitleButton.Right := TitleButton.Right - 2;
    TitleButton.Bottom := TitleButton.Bottom - 2;
    Canvas.StretchDraw(TitleButton, bmap);
  finally
    ReleaseDC(Self.Handle, Canvas.Handle);
    bmap.Free;
    Canvas.Handle := 0;
  end;
end;

procedure TForm1.WMNCActivate(var Msg: TWMNCActivate);
begin
  Inherited;
  DrawTitleButton;
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  Perform(WM_NCACTIVATE, Word(Active), 0);
end;

procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);
begin
  Inherited;
  DrawTitleButton;
end;

procedure TForm1.WMSetText(var Msg: TWMSetText);
begin
  Inherited;
  DrawTitleButton;
end;

procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
  Inherited;
  with Msg do
    if PtInRect(TitleButton, Point(XPos - Left, YPos - Top)) then Result := htTitleBtn;
end;

procedure TForm1.WMNCLButtonDown(var Msg: TWMNCLButtonDown);
begin
  inherited;
  if (Msg.HitTest = htTitleBtn) then ShowMessage('Button was activated');
end;

end.

EDIT: here is code for DrawButtonFace

{ DrawButtonFace - returns the remaining usable area inside the Client rect.}
function DrawButtonFace(Canvas: TCanvas; const Client: TRect;
  BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown,
  IsFocused: Boolean): TRect;
var
  NewStyle: Boolean;
  R: TRect;
  DC: THandle;
begin
  NewStyle := ((Style = bsAutoDetect) and NewStyleControls) or (Style = bsNew);
      R := Client;
  with Canvas do
  begin
    if NewStyle then
    begin
      Brush.Color := clBtnFace;
      Brush.Style := bsSolid;
      DC := Canvas.Handle;  { Reduce calls to GetHandle }
          if IsDown then
      begin { DrawEdge is faster than Polyline }
        DrawEdge(DC, R, BDR_SUNKENINNER, BF_TOPLEFT);             { black    }
        DrawEdge(DC, R, BDR_SUNKENOUTER, BF_BOTTOMRIGHT);         { btnhilite }
        Dec(R.Bottom);
        Dec(R.Right);
        Inc(R.Top);
        Inc(R.Left);
        DrawEdge(DC, R, BDR_SUNKENOUTER, BF_TOPLEFT or BF_MIDDLE); { btnshadow }
      end
      else
      begin
        DrawEdge(DC, R, BDR_RAISEDOUTER, BF_BOTTOMRIGHT);         { black }
        Dec(R.Bottom);
        Dec(R.Right);
        DrawEdge(DC, R, BDR_RAISEDINNER, BF_TOPLEFT);             { btnhilite }
        Inc(R.Top);
        Inc(R.Left);
        DrawEdge(DC, R, BDR_RAISEDINNER, BF_BOTTOMRIGHT or BF_MIDDLE); { btnshadow }
      end;
    end
    else
    begin
      Pen.Color := clWindowFrame;
      Brush.Color := clBtnFace;
      Brush.Style := bsSolid;
      Rectangle(R.Left, R.Top, R.Right, R.Bottom);
          { round the corners - only applies to Win 3.1 style buttons }
      if IsRounded then
      begin
        Pixels[R.Left, R.Top] := clBtnFace;
        Pixels[R.Left, R.Bottom - 1] := clBtnFace;
        Pixels[R.Right - 1, R.Top] := clBtnFace;
        Pixels[R.Right - 1, R.Bottom - 1] := clBtnFace;
      end;
          if IsFocused then
      begin
        InflateRect(R, -1, -1);
        Brush.Style := bsClear;
        Rectangle(R.Left, R.Top, R.Right, R.Bottom);
      end;
          InflateRect(R, -1, -1);
      if not IsDown then
        Frame3D(Canvas, R, clBtnHighlight, clBtnShadow, BevelWidth)
      else
      begin
        Pen.Color := clBtnShadow;
        PolyLine([Point(R.Left, R.Bottom - 1), Point(R.Left, R.Top),
          Point(R.Right, R.Top)]);
      end;
    end;
  end;
      Result := Rect(Client.Left + 1, Client.Top + 1,
    Client.Right - 2, Client.Bottom - 2);
  if IsDown then OffsetRect(Result, 1, 1);
end;
Edited by Zedna
Link to comment
Share on other sites

@Zedna: Could you post a screenshot of what that code produces? I'm curious.

Here it is.

EDIT:

I tested it and there must be implemented also Maximinize/restore messages in similar way like WMSetText to it correct.

Also to be it absolutely perfect there should be implemented painting button in "Down" state when it's clicked.

info.bmp

post-6483-1194254241_thumb.png

Edited by Zedna
Link to comment
Share on other sites

I'm not sure, but why not create a picture control up there?

Thats what I recommended...

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

Ok...

... i have another question .. .

And this question is how to add this like on picture :P

but from this picture:

Posted Image

I don't know how to add icon 32x32 in listview item :/

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Maybe...

#include <GUIConstants.au3>

; Picture location
Dim $Picture1 = "C:\WINDOWS\PCHealth\HelpCtr\System\images\48x48\desktop_icon_01.bmp"
Dim $Picture2 = "C:\WINDOWS\PCHealth\HelpCtr\System\images\48x48\desktop_icon_02.bmp"
Dim $Picture3 = "C:\WINDOWS\PCHealth\HelpCtr\System\images\48x48\desktop_icon_03.bmp"

GUICreate("listview pics", 400, 200 )

$XSkin_lst = GuiCtrlCreateListView ("",10,10,120,150)
GUICtrlSetStyle(-1, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL))
for $x = 1 to 5
GUICtrlCreateListViewItem("Picture Here", $XSkin_lst)
GUICtrlSetImage(-1, $Picture1, 0)

GUICtrlCreateListViewItem("Another Here", $XSkin_lst)
GUICtrlSetImage(-1, $Picture2, 0)

GUICtrlCreateListViewItem("Guess what's Here", $XSkin_lst)
GUICtrlSetImage(-1, $Picture3, 0)
Next
$button = GuiCtrlCreateButton ("Select-a-Pic",10,170,100,20)
GuiSetState()


Do
  $msg = GuiGetMsg ()
     
   If $msg = $button Then MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($XSkin_lst)),2)
   
Until $msg = $GUI_EVENT_CLOSE

8)

NEWHeader1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...