تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
استفسار عن اتجاه النص في ثيم
#1
اخواني قمت بتركيب عدة ثيمات لمشروعي ولكن تواجهني مشكلة وهي عند تحويل اتجاه اداة موجوده بالثيم من اليسار الى اليمين يصبح النص معكوس وللتوضيح سوف ارفق صورتين للتوضيح

عندما يكون اتجاه الاداه على اليسار يكون النص تمام كما بالصوره



المشكله عند تحويل الاداه الى الجهة اليمنى يصبح النص كما بالصوره معكوس



ارجو من لديه الحل افادتنا
الرد }}}
تم الشكر بواسطة:
#2
لازم تستخدم +GDI لكي ترسم التكست في الحدث Paint عند استخدام RightToLeft ومن الواضح ان الكونترول المستخدم لا يدعم هذه الخاصية

عموما إن لم تكن تجيد عمليات الرسم
حاول أن تقوم بخداع نظام التشغيل حين يقوم بعملية الرسم .... لكني لا أعلم هل هذا سيفلح معك ام لا .... لكن الفكرة تكمن في أن تقوم بعمل Reverse للحروف قبل الانتقال من اليسار الي اليمين


ايضا يمكنك ان تقوم بتعديل اماكن الكونترول برمجيا LayoutControl بأنك تحسب مكان كل كوترول ثم تقوم بتغير Location الخاص به و من الواضح انك فقط تحتاج الي تعديل location للنقطة X لا غير
الرد }}}
تم الشكر بواسطة:
#3
كل ما يهمني بالثيم هي اداة tabcontrol
الرد }}}
تم الشكر بواسطة:
#4
[/php]

#Region "MephTabcontrol"
Class MephTabcontrol : Inherits TabControl

   Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
       Dim P As GraphicsPath = New GraphicsPath()
       Dim ArcRectangleWidth As Integer = Curve * 2
       P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
       P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
       P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
       P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
       P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
       Return P
   End Function
   Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
       Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
       Dim P As GraphicsPath = New GraphicsPath()
       Dim ArcRectangleWidth As Integer = Curve * 2
       P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
       P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
       P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
       P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
       P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
       Return P
   End Function
   Sub New()
       SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
       DoubleBuffered = True
       SizeMode = TabSizeMode.Fixed
       ItemSize = New Size(35, 85)
   End Sub
   Protected Overrides Sub CreateHandle()
       MyBase.CreateHandle()
       Alignment = TabAlignment.Left
   End Sub

   Function ToPen(ByVal color As Color) As Pen
       Return New Pen(color)
   End Function

   Function ToBrush(ByVal color As Color) As Brush
       Return New SolidBrush(color)
   End Function

   Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
       Dim B As New Bitmap(Width, Height)
       Dim G As Graphics = Graphics.FromImage(B)
       Dim FF As New Font("Verdana", 8, FontStyle.Regular)
       Try : SelectedTab.BackColor = Color.FromArgb(50, 50, 50) : Catch : End Try
       G.Clear(Parent.FindForm.BackColor)

       G.FillRectangle(New SolidBrush(Color.FromArgb(50, 50, 50)), New Rectangle(0, 0, ItemSize.Height + 3, Height - 1)) 'Full Tab Background

       For i = 0 To TabCount - 1
           If i = SelectedIndex Then
               Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))
               Dim myBlend As New ColorBlend()
               myBlend.Colors = {Color.FromArgb(50, 50, 50), Color.FromArgb(50, 50, 50), Color.FromArgb(50, 50, 50)} 'Full Tab Background Gradient Accents
               myBlend.Positions = {0.0F, 0.5F, 1.0F}
               Dim lgBrush As New LinearGradientBrush(x2, Color.Black, Color.Black, 90.0F)
               lgBrush.InterpolationColors = myBlend
               G.FillRectangle(lgBrush, x2)
               'G.DrawRectangle(New Pen(Color.FromArgb(20, 20, 20)), x2) 'Full Tab Highlight Outline
               Dim tabRect As New Rectangle(GetTabRect(i).Location.X + 4, GetTabRect(i).Location.Y + 2, GetTabRect(i).Size.Width + 10, GetTabRect(i).Size.Height - 11)
               G.FillPath(New SolidBrush(Color.FromArgb(50, 50, 50)), RoundRect(tabRect, 4)) 'Highlight Fill Background

               Dim cFull As Color() = New Color() {Color.FromArgb(20, 20, 20), Color.FromArgb(40, 40, 40), Color.FromArgb(45, 45, 45), Color.FromArgb(46, 46, 46), Color.FromArgb(47, 47, 47), Color.FromArgb(48, 48, 48), Color.FromArgb(49, 49, 49), Color.FromArgb(50, 50, 50)}
               Draw.InnerGlow(G, New Rectangle(0, 0, ItemSize.Height + 3, Height - 1), cFull) ' Main Left Box Outline

               Dim cHighlight As Color() = New Color() {Color.FromArgb(20, 20, 20), Color.FromArgb(40, 40, 40), Color.FromArgb(45, 45, 45), Color.FromArgb(46, 46, 46), Color.FromArgb(47, 47, 47), Color.FromArgb(48, 48, 48), Color.FromArgb(49, 49, 49), Color.FromArgb(50, 50, 50)}
               Draw.InnerGlowRounded(G, tabRect, 4, cHighlight) ' Fill HighLight Inner

               G.SmoothingMode = SmoothingMode.HighQuality
               'Dim p() As Point = {New Point(ItemSize.Height - 3, GetTabRect(i).Location.Y + 20), New Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 14), New Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 27)}
               'G.FillPolygon(Brushes.White, p)

               If ImageList IsNot Nothing Then
                   Try
                       If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then

                           G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(x2.Location.X + 8, x2.Location.Y + 6))
                           DrawString(G, "      " & TabPages(i).Text.ToUpper, FF, Brushes.White, x2)
                       Else
                           DrawString(G, TabPages(i).Text, FF, Brushes.White, x2)
                       End If
                   Catch ex As Exception
                       DrawString(G, TabPages(i).Text, FF, Brushes.White, x2)
                   End Try
               Else
                   DrawString(G, TabPages(i).Text, FF, Brushes.White, x2)
               End If

               G.DrawLine(New Pen(Color.FromArgb(96, 110, 121)), New Point(x2.Location.X - 1, x2.Location.Y - 1), New Point(x2.Location.X, x2.Location.Y))
               G.DrawLine(New Pen(Color.FromArgb(96, 110, 121)), New Point(x2.Location.X - 1, x2.Bottom - 1), New Point(x2.Location.X, x2.Bottom))
           Else
               Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height + 1))
               'G.FillRectangle(New SolidBrush(Color.FromArgb(50, 50, 50)), x2) 'Tab Highlight
               G.DrawLine(New Pen(Color.FromArgb(96, 110, 121)), New Point(x2.Right, x2.Top), New Point(x2.Right, x2.Bottom))
               If ImageList IsNot Nothing Then
                   Try
                       If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then
                           G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(x2.Location.X + 8, x2.Location.Y + 6))
                           DrawString(G, TabPages(i).Text, FF, Brushes.White, x2)
                       Else
                           DrawString(G, TabPages(i).Text, FF, New SolidBrush(Color.FromArgb(210, 220, 230)), x2)
                       End If
                   Catch ex As Exception
                       DrawString(G, TabPages(i).Text, FF, New SolidBrush(Color.FromArgb(210, 220, 230)), x2)
                   End Try
               Else
                   DrawString(G, TabPages(i).Text, FF, New SolidBrush(Color.FromArgb(210, 220, 230)), x2)
               End If
           End If
           G.FillRectangle(New SolidBrush(Color.FromArgb(50, 50, 50)), New Rectangle(86, -1, Width - 86, Height + 1)) 'Page Fill Full

           Dim c As Color() = New Color() {Color.FromArgb(20, 20, 20), Color.FromArgb(40, 40, 40), Color.FromArgb(45, 45, 45), Color.FromArgb(46, 46, 46), Color.FromArgb(47, 47, 47), Color.FromArgb(48, 48, 48), Color.FromArgb(49, 49, 49), Color.FromArgb(50, 50, 50)}
           Draw.InnerGlowRounded(G, New Rectangle(86, 0, Width - 87, Height - 1), 3, c) ' Fill Page
       Next

       G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(50, 50, 50))), New Rectangle(0, 0, ItemSize.Height + 4, Height - 1)) 'Full Tab Outer Outline
       G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(20, 20, 20))), New Rectangle(1, 0, ItemSize.Height + 3, Height - 2)) 'Full Tab Inner Outline

       e.Graphics.DrawImage(B.Clone, 0, 0)
       'e.Graphics.DrawImage(B.Clone, New Rectangle(0, 0, Me.Width + 1, Me.Height))
       G.Dispose() : B.Dispose()
   End Sub
   Protected Sub DrawString(ByVal g As Graphics, ByVal txt As String, ByVal fnt As Font, ByVal clr As Brush, ByVal rec As Rectangle)
       If Me.RightToLeft = Windows.Forms.RightToLeft.Yes And Me.RightToLeftLayout = True Then
           g.MultiplyTransform(New System.Drawing.Drawing2D.Matrix(-1, 0, 0, 1, rec.Width, 0))
           g.DrawString(txt, fnt, New SolidBrush(Color.FromArgb(210, 220, 230)), New Rectangle(rec.X, rec.Y - 1, rec.Width, rec.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
           g.ResetTransform()
       Else
           g.DrawString(txt, fnt, New SolidBrush(Color.FromArgb(210, 220, 230)), New Rectangle(rec.X, rec.Y - 1, rec.Width, rec.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
       End If
   End Sub
End Class
#End Region

[/php]
الرد }}}
تم الشكر بواسطة: نسيم الترك1
#5
يسلمووووووو اخي على ردك ومساعدتك
ولكن ارجوا ان تخبرني ما هو الكود الذي قمت بالتعديل عليه لكي اقوم بالتعديل على باقي الثيمات
الرد }}}
تم الشكر بواسطة:
#6
اذا كنت ترييد التغيير في الكونترول الخاص بك عليك ان ترفع الكود لكي نستطيع ضبط عملية الرسم الخاصة به
لأنكــ ف النهاية ستحتاج للتعديل علي الكونترول حتي تتم عملية الرسم بالشكل المناسب

,أو لو كان الكود الخاص بالاخ Sami2105 يناسبك فاستخدم الكونترول الخاص به
الرد }}}
تم الشكر بواسطة:
#7
هذا هو الكود اخي 
ولكن لو ما في غلبه كمان اريد ان اعرف ما الذي يجب تغيره في الكود في حال اردت تغيير ثيم اخر


الملفات المرفقة
.zip   slc_theme (1).zip (الحجم : 18.66 ك ب / التحميلات : 43)
الرد }}}
تم الشكر بواسطة:
#8
#Region "SLCTabControl"
Class SLCTabControl
Inherits TabControl

Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
DoubleBuffered = True
SizeMode = TabSizeMode.Fixed
ItemSize = New Size(30, 120)

End Sub

Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Alignment = TabAlignment.Left
End Sub

Public Function Borderpts() As GraphicsPath
Dim P As New GraphicsPath()
Dim PS As New List(Of Point)

PS.Add(New Point(0, 0))
PS.Add(New Point(Width - 1, 0))
PS.Add(New Point(Width - 1, Height - 1))
PS.Add(New Point(0, Height - 1))



P.AddPolygon(PS.ToArray())
Return P
End Function

Public Function BorderptsInside() As GraphicsPath
Dim P As New GraphicsPath()
Dim PS As New List(Of Point)

PS.Add(New Point(1, 1))
PS.Add(New Point(122, 1))
PS.Add(New Point(122, Height - 2))
PS.Add(New Point(1, Height - 2))



P.AddPolygon(PS.ToArray())
Return P
End Function

Public Function BigBorder() As GraphicsPath
Dim P As New GraphicsPath()
Dim PS As New List(Of Point)

PS.Add(New Point(50, 1))
PS.Add(New Point(349, 50))
PS.Add(New Point(349, 50))
PS.Add(New Point(50, 349))

P.AddPolygon(PS.ToArray())
Return P
End Function

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)



Dim b As New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
g.Clear(Color.White)




'//Big square shadow







Dim GP1 As GraphicsPath = Borderpts()
g.DrawPath(Pens.LightGray, GP1)


'// small border
Dim tmp1 As GraphicsPath = BorderptsInside()

Dim PB2 As PathGradientBrush
PB2 = New PathGradientBrush(tmp1)
PB2.CenterColor = Color.FromArgb(250, 250, 250)
PB2.SurroundColors = {Color.FromArgb(237, 237, 237)}
PB2.FocusScales = New PointF(0.9F, 0.9F)

g.FillPath(PB2, tmp1)
g.DrawPath(Pens.Gray, tmp1)




'// items






For i = 0 To TabCount - 1

Dim rec As Rectangle = GetTabRect(i)
Dim rec2 As Rectangle = rec


'//inside small
rec2.Width -= 3
rec2.Height -= 3
rec2.Y += 1
rec2.X += 1




If i = SelectedIndex Then



Dim linear As New LinearGradientBrush(New Rectangle(rec2.X + 108, rec2.Y + 1, 10, rec2.Height - 1), Color.FromArgb(227, 227, 227), Color.Transparent, 180.0F)
Dim linear3 As New LinearGradientBrush(New Rectangle(rec2.X, rec2.Y + 1, 10, rec2.Height - 1), Color.FromArgb(227, 227, 227), Color.Transparent, 180.0F)


g.FillRectangle(New SolidBrush(Color.FromArgb(242, 242, 242)), rec2)
g.DrawRectangle(Pens.White, rec2)
g.DrawRectangle(New Pen(Color.FromArgb(70, Color.FromArgb(39, 93, 127)), 2), rec)
g.FillRectangle(linear, New Rectangle(rec2.X + 113, rec2.Y + 1, 6, rec2.Height - 1))
g.FillRectangle(linear3, New Rectangle(rec2.X, rec2.Y + 1, 6, rec2.Height - 1))
'// circle


g.SmoothingMode = SmoothingMode.HighQuality
' g.DrawEllipse(New Pen(Color.FromArgb(200, 200, 200), 3), New Rectangle(rec2.X + 6.5, rec2.Y + 7, 14, 14))
' g.DrawEllipse(New Pen(Color.FromArgb(150, 150, 150), 1), New Rectangle(rec2.X + 6.5, rec2.Y + 7, 14, 14))


Dim GPF As New GraphicsPath
GPF.AddEllipse(New Rectangle(rec2.X + 8, rec2.Y + 8, 12, 12))
Dim PB3 As PathGradientBrush
PB3 = New PathGradientBrush(GPF)
PB3.CenterPoint = New Point(rec2.X - 10, rec2.Y - 10)
PB3.CenterColor = Color.FromArgb(56, 142, 196)
PB3.SurroundColors = {Color.FromArgb(64, 106, 140)}
PB3.FocusScales = New PointF(0.9F, 0.9F)


g.FillPath(PB3, GPF)

g.DrawPath(New Pen(Color.FromArgb(49, 63, 86)), GPF)
g.SetClip(GPF)
g.FillEllipse(New SolidBrush(Color.FromArgb(40, Color.WhiteSmoke)), New Rectangle(rec2.X + 10.5, rec2.Y + 11, 6, 6))
g.ResetClip()



g.SmoothingMode = SmoothingMode.None

Else

g.SmoothingMode = SmoothingMode.HighQuality
Dim linear As New LinearGradientBrush(New Rectangle(rec2.X + 108, rec2.Y + 1, 10, rec2.Height - 1), Color.FromArgb(227, 227, 227), Color.Transparent, 180.0F)
Dim linear3 As New LinearGradientBrush(New Rectangle(rec2.X, rec2.Y + 1, 10, rec2.Height - 1), Color.FromArgb(227, 227, 227), Color.Transparent, 180.0F)


g.FillRectangle(New SolidBrush(Color.FromArgb(242, 242, 242)), rec2)
g.DrawRectangle(Pens.White, rec2)
g.DrawRectangle(New Pen(Color.FromArgb(70, Color.FromArgb(39, 93, 127)), 2), rec)
g.FillRectangle(linear, New Rectangle(rec2.X + 113, rec2.Y + 1, 6, rec2.Height - 1))
g.FillRectangle(linear3, New Rectangle(rec2.X, rec2.Y + 1, 6, rec2.Height - 1))


g.FillEllipse(Brushes.LightGray, New Rectangle(rec2.X + 8, rec2.Y + 8, 12, 12))
g.DrawEllipse(New Pen(Color.FromArgb(100, 100, 100), 1), New Rectangle(rec2.X + 8, rec2.Y + 8, 12, 12))
g.SmoothingMode = SmoothingMode.None

End If

If Me.RightToLeft = Windows.Forms.RightToLeft.Yes And Me.RightToLeftLayout = True Then
g.MultiplyTransform(New System.Drawing.Drawing2D.Matrix(-1, 0, 0, 1, rec.Width, 0))
g.DrawString(TabPages(i).Text, Font, New SolidBrush(Color.FromArgb(56, 106, 137)), rec, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
g.ResetTransform()
Else
g.DrawString(TabPages(i).Text, Font, New SolidBrush(Color.FromArgb(56, 106, 137)), rec, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End If
Next




e.Graphics.DrawImage(b.Clone, 0, 0)
g.Dispose()
b.Dispose()
MyBase.OnPaint(e)
End Sub
End Class
#End Region
الرد }}}
تم الشكر بواسطة: نسيم الترك1
#9
مشكور اخي ويعطيك العافيه
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [VB.NET] استفسار Nani 3 1,249 10-04-24, 04:35 AM
آخر رد: emadahmed1995
  [سؤال] استفسار toe 2 98 26-03-24, 08:13 PM
آخر رد: mrfenix93
  بحث بالكومبو بوكس لا ى جزء من النص Lathe1 3 479 28-02-24, 02:59 AM
آخر رد: معاند الحظ
  استفسار هام جدا سلام و محبه2090 1 146 17-02-24, 08:26 PM
آخر رد: عبدالله الدوسري
  ممكن استفسار عن m3u8 malekmohamed155 0 235 20-01-24, 07:47 PM
آخر رد: malekmohamed155
  [VB.NET] استخلاص جزء محدد من نص وإضافته إلى بداية النص ؟ AmeenRashed 2 227 02-01-24, 10:06 AM
آخر رد: AmeenRashed
Tongue استفسار بسيط عن كريستال ريبورت waataanys 1 317 30-11-23, 04:44 PM
آخر رد: Taha Okla
  [سؤال] استفسار ahmed_king2023 2 390 02-11-23, 01:13 PM
آخر رد: ahmed_king2023
  [VB.NET] استفسار dsa 1 276 09-10-23, 01:20 PM
آخر رد: Ahmed5
Video استفسار حول استعلام في SQL devpos 2 286 27-09-23, 04:25 PM
آخر رد: devpos

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم