Forum > Beginners
[SOLVED] Draw vertical line
tudi_x:
hi All,
i need to draw some vertical lines on a form / panel (between a tab control and list box). i am currently using the below to draw an horizontal line.
please advise if i could use BGRA to draw also a vertical line or what other options i would have (cross platform).
thank you
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses BGRAShape;constructor THLine.Create(AOwner: TWinControl; AlignLeft: TControl; ALength: word; AColor: TColor = clBlack);begin inherited Create(AOwner); self.UseRatioXY := True; self.RatioXY := 1000; self.ShapeType := stRegularPolygon; self.BorderColor := AColor; self.BorderWidth := 3; self.Width := ALength; self.Parent := AOwner;end;
tudi_x:
guess i would be using TShape:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type {vertical line} TVLine = class(TShape) public constructor Create(AOwner: TWinControl; ALength: word; AColor: TColor = clBlack); reintroduce; end; constructor TVLine.Create(AOwner: TWinControl; ALength: word; AColor: TColor = clBlack);begin inherited Create(AOwner); self.Brush.Color:= AColor; self.Width:= 3; self.Height:= ALength; self.Parent := AOwner; end;
howardpc:
--- Quote from: tudi_x on December 11, 2017, 11:31:54 am ---i need to draw some vertical lines on a form / panel
--- End quote ---
Does direct drawing on the form/panel's Canvas using Canvas.Line() not work for you?
tudi_x:
i do not know how to draw on TPanel as this component does not expose the Canvas.Line().
molly:
Huh ?
TPanel -> TCustomPanel -> TCustomControl . Canvas = TCanvas -> TFPCustomCanvas . Line.
Are you perhaps missing sources to FPC (or not configured correctly inside Lazarus where these are located) ? In which case Lazarus code editor is probably not able to show you methods from FPC classes.
Navigation
[0] Message Index
[#] Next page