Groups | Blog | Home
all groups > dotnet drawing api > november 2003 >

dotnet drawing api : Help me with Pen.


KVV
11/27/2003 5:25:30 PM
Hello, All!

SolidBrush brush = new SolidBrush(SystemColors.Control);
e.Graphics.FillRectangle(brush,Rect);

Why this code draws picture1(see attach)
and this

Pen pen = new Pen(brush,drawWidth);
pen.Alignment = PenAlignment.Inset;
e.Graphics.DrawRectangle(pen,Rect);

draws picture2?(take a look on small rose pixels)

How to get picture1 using pen?

With best regards, KVV. E-mail: kvv_vlad@ua.fm


begin 666 1.PNG
MB5!.1PT*&@H````-24A$4@```& ````^" (```!;?HGH`````7-21T(`KLX<
MZ0````1G04U!``"QCPO\804````@8TA230``>B8``("$``#Z````@.@``'4P
M``#J8 ``.I@``!=PG+I1/ ```8=)1$%4>%[MG$$.@C 0177G-5R:N/'^=\ %
MQJ5>PQV6$ TVE$YFAIK",^QT.M/7_V$JZ/[>-KM2K]/YHDCUO%U34:_T<(?T
M6_*H8R@X`"IV=*K7HVU2QTSE+E&A7@#]Z"/""J#8/0#JW2HW9AT*DL]GO/XN
M40"*3_\15@`!:.J,(^\`4! *0D&+-ME8#(MMP6+RB\ZXBW&)JL-B+E/5-=D`
M8K,Z]5V2?)N&@E 0"DKYQ>74CL6PV!8L)K_HZ)J=F:@Z+ :@S-TR``'HLZ56
MW5CM4! *0D'"QQ^P6.9!$0`M`LAE5Z7K(>MH% &4<1Z `&2[S*,@%(2"%FT4
ML1@6LUF,W3R[^:H5I-M EHSZL\5*3K7&7+L:BRY9,X RM $$()LA4="&%?3]
M4:9%0U(%A626-.5CQP5;BA=->UB*\I/TRF@I/C_M871+#J]YJL>Q%)\'-)1E
MR:&>F$N@L?*5`S+2Z94A7"5[)F$BQX^YU+Q:0-$?+ZBYKQ:0FD@4* 7DE:^Z
:<0"46;(W!(Q=W1#!D1,`````245.1*Y"8((`
`
end
Bob Powell [MVP]
11/27/2003 5:34:40 PM
There is a bug in the Pen Alignment system so you can't rely on it.

How wide is drawWidth??

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

Bob Powell [MVP]
11/27/2003 6:20:48 PM
Yes, there really is a bug in pen alignment.

It might help to get you a solution if we knew why you need to draw with a
pen and not a brush and whether the goal os just a grey rectangle or
something more significant.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

KVV
11/27/2003 7:00:36 PM
Hello, Bob!
You wrote on Thu, 27 Nov 2003 17:34:40 +0100:

BPM> How wide is drawWidth??
any from 1 ÔÏ .........
Any PenAlignment - same result :((((
It is really bug in pen?

With best regards, KVV. E-mail: kvv_vlad@ua.fm

KVV
11/27/2003 7:47:16 PM
Hello, Bob!
You wrote on Thu, 27 Nov 2003 18:20:48 +0100:

BPM> It might help to get you a solution if we knew why you need to draw
BPM> with a pen and not a brush and whether the goal os just a grey
BPM> rectangle or something more significant.

I want to draw a scaleable border on the my Panel derived from MS Panel

With best regards, KVV. E-mail: kvv_vlad@ua.fm

Bob Powell [MVP]
11/28/2003 11:57:28 AM
Hmm I see,

Well, you can do it the quick and dirty way and draw a border inside the
window and offset your client drawing by the border width or you can do it
the right way and create a custom CreateParams override along with a custom
WndProc that handles WM_NCCREATE etc properly. This last involves interop.

Either way, you cannot draw outside the bounds of your window to add a
border to the outside so that fudge is out of the question. Well, you can,
but it means drawing on the desktop window which is even more of a nasty
hack.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

Bob Powell [MVP]
11/28/2003 1:47:38 PM
I know how to do it but I'm sorry, I don't have any code that does just now.

Hunting around on the web I don't see any articles I can point you to that
have immediate relavence to your problem so it's definitely a great subject
for further investigation.

If I have some spare time later I might make it into a tips and tricks
article.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

KVV
11/28/2003 1:47:57 PM
Hello, Bob!
You wrote on Fri, 28 Nov 2003 11:57:28 +0100:

BPM> can do it the right way and create a custom CreateParams override
BPM> along with a custom WndProc that handles WM_NCCREATE etc properly.
BPM> This last involves interop.
Can You help me with that (send me example) how can I draw border of the
window using Border3DStyle enum as property of my window?

With best regards, KVV.

AddThis Social Bookmark Button