last day (14 days later) » 

14:24
1
A: Customize TabPage tabs like Process Flow Arrows in Microsoft Dynamics CRM 2015

TaWSometimes I go crazy and pick up a challenge just for fun :-) Here is the result: I overlay the TabControl tabControl1 with a Panel tp. (Do pick better names!) Note that this must happen rather late or else the TabControl will pop to the top. I call them to order in the Shown event: priva...

TaW
TaW
Oh well, 'replace' is a bit exaggerated. DrawString works just fine. I just did a pixel by pixel comparison for the case at hand and am not so sure I prefer the slightly wider results of TextRenderer. (See for yourself!) - But it does have more options, so, certainly an improvement to keep in mind, expecially because of the greatly expanded TextFormatFlags.
Hi TaW! Wow according to the photo this looks amazing! Thanks for this! I just cannot make this work at my simple test form. I put TabControl with 3 tabs, called makeTabPanel after InitializeComponent, then added Shown event handler, but the panel never shows and Paint is never called, so Im seeing classic TabControl. Another thing: "sz" variable is not declared, I don't know what Size it is.
EDIT: I called makeTabPanel in Form_Shown, because ItemSize property is 0 before control is shown. Now it works fine! Thanks a lot again! I will try to make UserControl out of this.
TaW
TaW
Ah, ok, good luck!
Is there any reson why tabs are flickering when changing selection? I don't see any heavy operation in Paint handler, there is a Brush object and FillPath, DrawString calls. I set DoubleBuffered property to true but it is the same. I think that last tab flickers the most (there are 3 tabs in my example)
TaW
TaW
You are talking about your tabpages, right? If so, I don't know. They should behave just as without the overlay. Do they or is the flicker new?? If it is the overlay, please check how often it is called and if you call it more often than you expect..
14:24
I implemented your solution, I am talking about flickering regions (process arrows) that the code above is painting. It flickers like there is a lot of objects to paint, so the last is late to display propely...
TaW
TaW
Hi,
hm, that should not be; as you noted correctly the paint code is rather simple.
please put a breakpoint after you have noticed the flickering. in it check the tabAreas.Count it should be the same the tabpages count
Hi TaW, OK maybe you think there is a multiplication
TaW
TaW
what do you mean by 'multiplication'?
Im sorry, I dont know how to say :) There is always 3 tabArea-s
as Im having 3 tabpages
well this is not a big deal but i thought I could make this as smooth as possible
TaW
TaW
Also add a Console.Writeline("PAINTING" + tabAreas.Count()) to the beginning of the Paint event to see in the output pane how often it is called.
Well, is should paint totally smoothly indeed. So let try to figure this out..!
14:31
ok
I think Paint is called right, not to often, only on mouse click
TaW
TaW
Have you added any further tp.Invalidate (or whatever you have called it; tp is clearly a too short name, my bad..
ok, but make sure by adding the console call!
I added that (Trace.WriteLine)
flicker appears randomly on paint event
there is no Ivalidate at strange places, i just added Invalidate on Resize, but that is not called whe I click on a tabpage
TaW
TaW
Sounds correct. Hm, I'm pretty much out of ideas here. The same test could be applied to the makeTabPanel function, but that would trigger the invalidate>ppaint event chain itself..
I looked well if there is unwanted calls on every method, but I could not find anything. Is there a flicker in your example?
TaW
TaW
No, it paints without any delay let alone any flicker..
14:39
Here if I am clicking the same TabPage, it flickers after a number of clicks, the same effect when I change selection
TaW
TaW
Try this: change to tp.BackColor = Color.White; in the makeTabPanel and comment out e.Graphics.Clear(Color.White); in the Paint!
I did see a slight flicker every now and then when I clicked several times..
The same with BackColor. Yes, that is this flicker, it is not much, maybe the common use will not cause it
TaW
TaW
But it shouldn't be too annying, given that the user is going to see the pages changing as well..
Yes I think it's true, maybe I got too far by testing it :)
TaW
TaW
agreed.
14:48
thank you again with this code, my app will look great thanks to you :)
TaW
TaW
cool. bye..

last day (14 days later) »