Hi All,
I am trying to supress the small black triangle that shows up in the
menus meaning the menuitem is parent. The reason for that is I
owner-drew my own 3D looking triangle in DrawItem using GraphicPath
glyph (drew lines making triangle). What I have right now is my 3D
triangle and default windows menu triangle on it.
Please help, thanks in advance

Re: Hiding/Removing the "Triangle" from Parent MenuItem by Eric

Eric
Wed Apr 27 10:32:55 CDT 2005

Are you calling base.DrawItem after your custom code? The call to base
should come first.
Maybe you could post a little code?

-Eric



Re: Hiding/Removing the "Triangle" from Parent MenuItem by Mick

Mick
Wed Apr 27 11:44:38 CDT 2005

You cannot stop the system from drawing the Menu arrow. You can override
everything or even create your menus via Interop and you will still get the
arrow. I couldn't even find a secret undocumented message to intercept when
I tried it. Quite why this paint is not included in the standard windows
Paint/NC_Paint/Print methods I don't know.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


<javadkhan@gmail.com> wrote in message
news:1114612733.210931.318500@g14g2000cwa.googlegroups.com...
> Hi All,
> I am trying to supress the small black triangle that shows up in the
> menus meaning the menuitem is parent. The reason for that is I
> owner-drew my own 3D looking triangle in DrawItem using GraphicPath
> glyph (drew lines making triangle). What I have right now is my 3D
> triangle and default windows menu triangle on it.
> Please help, thanks in advance
>



Re: Hiding/Removing the "Triangle" from Parent MenuItem by javadkhan

javadkhan
Wed Apr 27 15:11:49 CDT 2005

Here's the code where I am trying to do this.
I am not using base.DrawItem... Do I need to?


private: System::Void menuItem1_DrawItem(System::Object * sender,
System::Windows::Forms::DrawItemEventArgs * e)
{
System::Drawing::Font *f = new System::Drawing::Font(S"Microsoft
Sans Serif", 10, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point, (System::Byte)0);

MenuItem *mi = __try_cast<MenuItem*>(sender);

//contextMenu1->MenuItems->Item[e->Index]->Text
e->Graphics->DrawString(mi->Text->ToString(),
f, System::Drawing::Brushes::Black,
RectangleF::op_Implicit(e->Bounds),
StringFormat::GenericDefault);

if (mi->IsParent) {


Rectangle rect = e->Bounds;

// where to put a 9 x 5 triangle in rect:
//PointF *location = __nogc new PointF((rect.Width - 2.0 - 9.0)/2.0
+ rect.Left + 1.0,(rect.Height - 2.0 - 5.0)/2.0 + rect.Top + 1.0);
PointF *location = __nogc new PointF(rect.Left + rect.Width -
14,(rect.Height - 2.0 - 5.0)/2.0 + rect.Top + 1.0);

//location->X += 45;
//location->X += 0;
location->X += 0;
location->Y -= 3;


SizeF *size = __nogc new SizeF(10.0, 6.0);
System::Drawing::RectangleF *triangleRect = __nogc new
System::Drawing::RectangleF(*location, *size);

// draw the white triangle:
Drawing::Drawing2D::GraphicsPath *glyph = new
Drawing::Drawing2D::GraphicsPath();

//glyph->AddLine(triangleRect->Left, triangleRect->Top,
triangleRect->Right - 1 , triangleRect->Top);
//glyph->AddLine(triangleRect->Right - 1, triangleRect->Top,
triangleRect->Left + 4, triangleRect->Bottom -1 );
//glyph->AddLine(triangleRect->Left+2, triangleRect->Bottom,
triangleRect->Left+2, triangleRect->Top-3);
//glyph->AddLine(triangleRect->Left+2, triangleRect->Top-3,
triangleRect->Right-1, triangleRect->Top-2+(triangleRect->Bottom -
triangleRect->Top)/2.0);
glyph->AddLine(triangleRect->Left-1, triangleRect->Bottom+3,
triangleRect->Left-1, triangleRect->Top-2);
glyph->AddLine(triangleRect->Left-1, triangleRect->Top-2,
triangleRect->Right, triangleRect->Top + 4);
glyph->CloseFigure();

e->Graphics->FillPath(SystemBrushes::ActiveCaptionText, glyph);

// draw the dark triangle:
Drawing::Drawing2D::GraphicsPath *glyph2 = new
Drawing::Drawing2D::GraphicsPath();
glyph2->AddLine(triangleRect->Left-1, triangleRect->Bottom+1,
triangleRect->Left-1, triangleRect->Top-2);
glyph2->AddLine(triangleRect->Left-1, triangleRect->Top-2,
triangleRect->Right-1, triangleRect->Top-2+4);
glyph2->CloseFigure();

e->Graphics->FillPath(SystemBrushes::ControlDarkDark, glyph2);

// draw the same color triangle:
Drawing::Drawing2D::GraphicsPath *glyph3 = new
Drawing::Drawing2D::GraphicsPath();
glyph3->AddLine(triangleRect->Left+1, triangleRect->Bottom+1,
triangleRect->Left+1, triangleRect->Top+1);
glyph3->AddLine(triangleRect->Left+1, triangleRect->Top,
triangleRect->Right-4, triangleRect->Top+3);
glyph3->CloseFigure();


e->Graphics->FillPath(SystemBrushes::ControlLight, glyph3);

}
}


Re: Hiding/Removing the "Triangle" from Parent MenuItem by javadkhan

javadkhan
Thu Apr 28 15:17:53 CDT 2005

anybody?

javadkhan@gmail.com wrote:
> Here's the code where I am trying to do this.
> I am not using base.DrawItem... Do I need to?
>
>
> private: System::Void menuItem1_DrawItem(System::Object * sender,
> System::Windows::Forms::DrawItemEventArgs * e)
> {
> System::Drawing::Font *f = new System::Drawing::Font(S"Microsoft
> Sans Serif", 10, System::Drawing::FontStyle::Bold,
> System::Drawing::GraphicsUnit::Point, (System::Byte)0);
>
> MenuItem *mi = __try_cast<MenuItem*>(sender);
>
> //contextMenu1->MenuItems->Item[e->Index]->Text
> e->Graphics->DrawString(mi->Text->ToString(),
> f, System::Drawing::Brushes::Black,
> RectangleF::op_Implicit(e->Bounds),
> StringFormat::GenericDefault);
>
> if (mi->IsParent) {
>
>
> Rectangle rect = e->Bounds;
>
> // where to put a 9 x 5 triangle in rect:
> //PointF *location = __nogc new PointF((rect.Width - 2.0 -
9.0)/2.0
> + rect.Left + 1.0,(rect.Height - 2.0 - 5.0)/2.0 + rect.Top + 1.0);
> PointF *location = __nogc new PointF(rect.Left + rect.Width -
> 14,(rect.Height - 2.0 - 5.0)/2.0 + rect.Top + 1.0);
>
> //location->X += 45;
> //location->X += 0;
> location->X += 0;
> location->Y -= 3;
>
>
> SizeF *size = __nogc new SizeF(10.0, 6.0);
> System::Drawing::RectangleF *triangleRect = __nogc new
> System::Drawing::RectangleF(*location, *size);
>
> // draw the white triangle:
> Drawing::Drawing2D::GraphicsPath *glyph = new
> Drawing::Drawing2D::GraphicsPath();
>
> //glyph->AddLine(triangleRect->Left, triangleRect->Top,
> triangleRect->Right - 1 , triangleRect->Top);
> //glyph->AddLine(triangleRect->Right - 1, triangleRect->Top,
> triangleRect->Left + 4, triangleRect->Bottom -1 );
> //glyph->AddLine(triangleRect->Left+2, triangleRect->Bottom,
> triangleRect->Left+2, triangleRect->Top-3);
> //glyph->AddLine(triangleRect->Left+2, triangleRect->Top-3,
> triangleRect->Right-1, triangleRect->Top-2+(triangleRect->Bottom -
> triangleRect->Top)/2.0);
> glyph->AddLine(triangleRect->Left-1, triangleRect->Bottom+3,
> triangleRect->Left-1, triangleRect->Top-2);
> glyph->AddLine(triangleRect->Left-1, triangleRect->Top-2,
> triangleRect->Right, triangleRect->Top + 4);
> glyph->CloseFigure();
>
> e->Graphics->FillPath(SystemBrushes::ActiveCaptionText, glyph);
>
> // draw the dark triangle:
> Drawing::Drawing2D::GraphicsPath *glyph2 = new
> Drawing::Drawing2D::GraphicsPath();
> glyph2->AddLine(triangleRect->Left-1, triangleRect->Bottom+1,
> triangleRect->Left-1, triangleRect->Top-2);
> glyph2->AddLine(triangleRect->Left-1, triangleRect->Top-2,
> triangleRect->Right-1, triangleRect->Top-2+4);
> glyph2->CloseFigure();
>
> e->Graphics->FillPath(SystemBrushes::ControlDarkDark, glyph2);
>
> // draw the same color triangle:
> Drawing::Drawing2D::GraphicsPath *glyph3 = new
> Drawing::Drawing2D::GraphicsPath();
> glyph3->AddLine(triangleRect->Left+1, triangleRect->Bottom+1,
> triangleRect->Left+1, triangleRect->Top+1);
> glyph3->AddLine(triangleRect->Left+1, triangleRect->Top,
> triangleRect->Right-4, triangleRect->Top+3);
> glyph3->CloseFigure();
>
>
> e->Graphics->FillPath(SystemBrushes::ControlLight, glyph3);
>
> }
> }


Re: Hiding/Removing the "Triangle" from Parent MenuItem by Mick

Mick
Thu Apr 28 16:07:51 CDT 2005

I already gave you the answer!
You cannot stop the system from drawing the arrow when a menuitem has a
childmenu.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


<javadkhan@gmail.com> wrote in message
news:1114719473.772980.107770@o13g2000cwo.googlegroups.com...
> anybody?
>


Re: Hiding/Removing the "Triangle" from Parent MenuItem by javadkhan

javadkhan
Sun May 01 21:19:08 CDT 2005

ok... there is no any way I can change the way the default triangle is
displayed too?

Mick Doherty wrote:
> I already gave you the answer!
> You cannot stop the system from drawing the arrow when a menuitem has
a
> childmenu.
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.html
>
>
> <javadkhan@gmail.com> wrote in message
> news:1114719473.772980.107770@o13g2000cwo.googlegroups.com...
> > anybody?
> >