ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
194
194
EMPFEHLEN
-
Hi!
Ich bin gerade dabei einen customRenderer für das ToolStrip-Control zu schreiben, so dass es sich unter XP optisch genauso verhält wie unter Vista (z.B. wie die grüne Toolbar im Windows Explorer). Dazu habe ich 3 png Grafiken erstellt, jeweils für Links, Rechts und die Mitte. Mein Problem ist jetzt, dass sie nicht richtig gezeichnet werden. Soll heißen, wenn ich z.B. das linke Bild (4 Pixel breit) an Position X=2, Y=0 zeichne, sieht es so aus wie das (vergrößerte) Bild im Anhang.
Es scheint so zu sein, dass der Ursprung der Textur immer gleich bleibt, auch wenn ich das zu zeichnende Rectangle in der Position verschiebe. Kann ich diesen Ursprung irgendwie beeinflussen? Oder kann ich mein Ziel anders erreichen?
Hier noch mein Code:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] Protected[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Overrides[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] OnRenderButtonBackground([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Windows.Forms.ToolStripItemRenderEventArgs) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] button [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ToolStripButton = e.Item [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] button.Selected [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] b [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Brush [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] bi [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Image [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' Left Image [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]bi = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Drawing.Bitmap([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]My[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Resources.toolstripbutton_overlay_hover_left) b = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] TextureBrush(bi) e.Graphics.FillRectangle(b, 2, 0, 4, 21) [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' Center Image [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]bi = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Drawing.Bitmap([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]My[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Resources.toolstripbutton_overlay_hover_center) b = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] TextureBrush(bi) e.Graphics.FillRectangle(b, 0, 0, (e.Item.ContentRectangle.Width - 8), 21) [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' Right Image [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]bi = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Drawing.Bitmap([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]My[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Resources.toolstripbutton_overlay_hover_right) b = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] TextureBrush(bi) e.Graphics.FillRectangle(b, 0, 0, 4, 21) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] button.Pressed [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]OrElse[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] button.Checked [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]e.Graphics.FillRectangle([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] SolidBrush(Color.CornflowerBlue), e.Item.ContentRectangle) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Else [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]e.Graphics.FillRectangle([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] SolidBrush(Color.Transparent), e.Item.ContentRectangle) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][/COLOR][/SIZE]
Ähnliche Themen
-
c# zeichnen
Von minfler im Forum .NET Grafik und SoundAntworten: 6Letzter Beitrag: 15.05.09, 11:46 -
Zeichnen
Von mal2000b im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 4Letzter Beitrag: 23.10.07, 20:10 -
Zeichnen
Von Ymaster im Forum PhotoshopAntworten: 3Letzter Beitrag: 11.07.07, 22:33 -
Säulen Zeichnen, Drachen zeichnen
Von RudeJava im Forum PhotoshopAntworten: 34Letzter Beitrag: 17.07.05, 09:34 -
Pad zum Zeichnen?
Von Carndret im Forum PhotoshopAntworten: 2Letzter Beitrag: 22.10.02, 18:09





Zitieren
Login





