Rounded corners

I'm developing some gradient filled components with rounded corners.


I use

  Canvas.Brush.Style := bsClear;
  Canvas.Pen.Color := iStyleInUse.BorderColor;
  Canvas.RoundRect(0, 0, Width, Height, CornerRounding, CornerRounding);
  iBorderOffset := 1;
  Rgn1 := CreateRoundRectRgn(btnR.Left + iBorderOffset, btnR.Top + iBorderOffset, btnR.Right, btnR.Bottom, CornerRounding, CornerRounding);
  SelectClipRgn(Canvas.Handle, Rgn1);
  SavedHandle := SaveDC(Canvas.Handle);
  SMDrawGradient(Canvas, btnR, iStyleInUse.ColorFrom, iStyleInUse.ColorTo, iStyleInUse.Direction, 255);
  RestoreDC(Canvas.Handle, SavedHandle);
  SelectClipRgn(Canvas.Handle, 0);
  DeleteObject(Rgn1);

It works well apart from the fact that the corners aren't filled properly. It looks as though there's a transparent corner inside the real corner and I'm filling them with code like

{BottomLeft}
for X := 0 to CornerRounding - 1 do begin
  InsideBorder := False;
  for Y := Height - 1 downto Height - CornerRounding do begin
   if InsideBorder or (Canvas.Pixels[X, Y] <> NotThere)
    then InsideBorder := True;
   if InsideBorder and (Canvas.Pixels[X, Y] = NotThere)
    then Canvas.Pixels[X, Y] := Canvas.Pixels[X + 2, Y]
  end;
end;


Is there a better way?

Roy Lambert
0
Roy
6/24/2011 2:03:56 PM
public.delphi.vcl.writing 510 articles. 0 followers. Follow

0 Replies
820 Views

Similar Articles

[PageSpeed] 27

Reply:

Similar Artilces:

How can we display round cornered window, round button
Hi, Please let me know, How can we make to diaplay round cornered window instead on rectangle / How can we make to diaplay oval shaped window AND oval shaped button or round cornered button with gradient effects regards, C.Sakthivel Murugan sakthivel_cbe@yahoo.com ---== Posted via the PFCGuide Web Newsreader ==--- http://www.pfcguide.com/_newsgroups/group_list.asp If you are using PB 9.0 or above select the new visual style controls in the project. This would work only on Windows XP. -- HTH Satish "Sakthivel Murugan.C" <sakthivel_cbe@yahoo.com> wrote i...

Delphi Rounding
Hello All: I need to get currency numbers to properly round - I tried x:=round(Y*100)/100; but that does not consistently round in the traditional US manner of .5 to the next 1. I wrote the following function to accomplish this: class function TCommonPM.PRound(NumToRound: Currency): Currency; Var Subtotal: Currency; Sub2: Integer; begin Result:=NumToRound; Subtotal:=NumToRound*100; Sub2:=Trunc(Subtotal); If Subtotal-Sub2>=0.50 Then Sub2:=Sub2+1; Result:=Sub2/100; end; Is there a better way to do this ??? Should it be done i...

Rounded Corners
Hi folks I know this doesn't really come under Server Side development and if there's a better forum for this I'm happy to "re-post"! Regarding beta.asp.net Does anyone know how they achieved the "rounded corners" look for the different parts of the main page. It's something I'm really keen to develop and their source html seems very clean, but I don't know (obviously) what they have in their CSS. Thanks in advance Here's one free version of a rounded corner control I came across (with source as well): http://aspnet.4guysfromrolla.com/articles/081104-1.aspx   Hello...

Rounded Corners
Hi How to do rounded corners div?!! if you look at asp.net web page its all rounded courners, its so pretty, so how to do it this way?! another thing , is the buttons, how to do buttons as login buttons, its pretty as well thanks Hello asmgx, a> How to do rounded corners div?!! 1) using RoundedControl ASP.NET AJAX 2) using the CSS http://kalsey.com/2003/07/rounded_corners_in_css/Michael Nemtsev | Microsoft MVP [.NET/C#] | .Net Tips & Tricks Publication Hello, You need to use stylesheet for round corner, Please take a look here. http://www.html.it/articoli/nifty/i...

Rounded corner
I need some component rounded corner in my application. For example Table, TextBox, DropdownList, checkbox Is there a way to round them?   thanks This should give you a start: http://aspnet.4guysfromrolla.com/articles/072804-1.aspx Regards Mike [MVP - ASP/ASP.NET]My site...

Round corners
I just installed the latest version of DNN and I wonder I can I get the round corners that a lot of other DNN site have? Thanks That is a module container. You can find the images and container.zip with the necessary HTML for the module container in the /portals/{GUID} directory.Josh Weinstein DNNSkins.com 4Birckhead Consulting Services...

Rounded Corners
Name: Camilo Sanchez Email: camilosanchez46atgmaildotcom Product: Firefox Summary: Rounded Corners Comments: Hi. Guys, I am a web developer, rounded corners support for firefox is so f**ng clever. I hope it continues and become a standard because it would really save as a lot of time. Thanks! Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.7; .NET CLR 3.5; ffco7) Gecko/2009021910 Firefox/3.0.7 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you...

Text.Write speed
Hi ! I have speed troubles for using Text.Write method in Delphi 2006, particularly with distant files (local network). For example, with the following code ("F" is a text file ; "Line" is an about 200-character string): ----- AssignFile(F, FileName); try Rewrite(F); for l := 1 to 100 do begin for c := 1 to Length(Line) do Write(F, Line[c]); Writeln(F); end; finally CloseFile(F); end; ----- On a distant file: Delphi 5 -> 0.08 seconds Delphi 2006 -> close to 8 seconds Is there a speci...

Delphi IS the VCL
Delphi IS the VCL! Oh, wait... sorry. I meant Winforms, not VCL. What was I thinking? I know! they got me too. Don't know what I was thinking. :) > {quote:title=Jay Faubion wrote:}{quote} > Delphi IS the VCL! > > Oh, wait... sorry. I meant Winforms, not VCL. > > What was I thinking? Jay Faubion wrote: > Delphi IS the VCL! > TButton Forever! ;-) W Jay Faubion wrote: > What was I thinking? Wasn't it called CLX ? Turbo Vision -> OWL -> VCL -> CLX -> Winforms -> ...... (to be continued) -- ...

Rounded Corners
I am looking to create the effect shown in the image (http://img291.imageshack.us/img291/4476/effectuc6.jpg) this is taken from www.asp.net. I was wondering if there is a specific technique to creating this rounded corner effect (e.g. a css class or server side ASP.Net component) or is this as simple as creating a gradient image with rounded corners and reusing throughout the site.  Many Thanks Stuart Here's a great tutorial on Rounded Corners with CSS and JavaScript. An excerpt: "Rounded corners are one of the most frequently requested CSS techniques. As with many things ...

No Rounded Corners
Is anyone else having problems with the corners not being rounded in the Gallery? It works fine in the admin section, but not in the actual pages. I checked the templates (both Orange and Blue) and both have the corner images in the template but it just doesn't show up. Here is an example: http://www.rattrick.com/nGallery/default.aspx Works for me. What browser/version are you using? Works fine here at home. Must be something wrong with my work PC. Thanks for checking it out for me. http://www.rattrick.com/nGallery/ I changed to the Orange theme (b/c the Blue didn't work) and th...

Web resources about - Rounded corners - public.delphi.vcl.writing

Close back rounded vowel - Wikipedia, the free encyclopedia
... follows this. However, a large number of linguists, perhaps a majority, prefer the terms "high" and "low". In most languages this rounded vowel ...

Circle Of Moms Makes Child Space Pages Even More Well-Rounded
There’s a new addition to the Circle of Moms — the popular Facebook application is offering new features to its Child Spaces pages. The site ...

New website to offer more rounded views of Dubai - The National
A new website promises to offer people a completely different view of one of the most famous cities in the world.

Shock me, a tennis player is not a well-rounded individual
Australia loves to play a game with its male tennis players called &quot;Compare Them to Pat Rafter&quot;. Problem is good guys like Rafter are ...

Bo Xilai supporters rounded up in advance of trial
China has arrested supporters and opponents of Bo Xilai before the fallen politician enters the dock for the country's biggest political trial ...

China stockmarket: Journalists, traders, officials rounded up in wake of 'panic and disorder'
Chinese state media announced a slew of confessions on Monday following investigations into recent stock market gyrations.

Women make church more rounded
God, says my favourite theologian Hans Urs Von Balthasar, is the point at which truth, beauty and justice merge. I like that, very much.

Will Apple also update the next iPads with rounded edges?
... iPhone 6 . The existing design, top, has the familiar flat front and tapered, chamfered edge. The bottom one, Hajek’s concept, has the rounded ...

Samsung Hinges Its Defense in Apple Case on Rectangles and Rounded Corners
... ultimately decide the case. In essence, Samsung argues that a lot of the iPhone’s design — and several of its design patents — amount to rounded ...


Resources last updated: 12/8/2015 10:21:27 AM