Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -module(dl2).
- -export([start/0]).
- -include_lib("wx/include/wx.hrl").
- start() ->
- Wx = wx:new(),
- Frame = wxFrame:new(Wx, -1, "Line", [{size, {280, 180}}]),
- Panel = wxPanel:new(Frame),
- OnPaint = fun(_Evt, _Obj) ->
- %% io:format("now: ~p~n event: ~p~n object: ~p~n",[now(),_Evt,_Obj]),
- Paint = wxPaintDC:new(Panel),
- Pen = wxPen:new(),
- %% To change the color or width of the line un-comment these next two lines
- %% wxPen:setWidth(Pen, 3),
- %% wxPen:setColour(Pen, ?wxRED),
- wxDC:setPen(Paint, Pen),
- wxDC:drawLine(Paint, {50, 60}, {190,60}),
- wxPaintDC:destroy(Paint)
- end,
- wxFrame:connect(Panel, paint, [{callback, OnPaint}]),
- wxFrame:connect(Panel, close_window), % works
- % wxFrame:connect(Frame, close_window), %Frame, instead, doesn't work, why not?
- wxFrame:center(Frame),
- wxFrame:show(Frame).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement