Matlab GUI Design Optical Effects (Transition) - user-interface
I have designed a GUI with uitabs. I want to achieve a smooth transition (optical effect) when the selected tab is changed. For it, I write the following callback:
function SelectionChangeCbk(src,evt)
oldTab = evt.OldValue;
newTab = evt.NewValue;
set([oldTab,newTab],'Visible','off');
drawnow;
pause(2);
set(newTab,'Visible','on');
end
However, I can get my target because this does not work (I have two tabs. The selected tab before the change is called oldTab and the new tab, selected after the change, is called newTab. I want that when I change from oldTab to newTab, first oldTab and newTab becomes invisible, then waiting for two seconds before newTab appears).
I have tried the application WindowAPI but it only works with figure handles.
P.D.: Here is the complete code:
function AA
fh = figure('Units','characters','Position',[-200.2 -77 214.8 46.154],...
'Menu','none','Toolbar','none','NumberTitle','off');
movegui(fh,'center');
warning off MATLAB:uitabgroup:OldVersion % turn off warning
htab = uitabgroup('Parent',fh,'BackgroundColor','k',...
'SelectionChangeCallback',#SelectionChangeCbk);
th1 = uitab('parent',htab,'title','Tab#1');
hPan1 = uipanel(th1,'title','Panel1','Units','characters',...
'Position',[27.24 27.163 217.92 13.038],'BorderType','line',...
'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan1,'Style','text','String','Text#1',...
'Units','normalized','Position',[0.117 0.617 0.208 0.128],...
'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan1,'Style','edit','String','300','Units',...
'normalized','Position',[0.354 0.623 0.228 0.128],...
'ForegroundColor','k','BackgroundColor','w');
uicontrol(hPan1,'Style','text','String','Text#2',...
'Units','normalized','Position',[0.156 0.248 0.166 0.128],...
'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan1,'Style','edit','String','1000','Units',...
'normalized','Position',[0.354 0.259 0.228 0.128],...
'ForegroundColor','k','BackgroundColor','w');
hPan2 = uipanel(th1,'title','Panel2','Units',...
'characters','Position',[27.24 7 217.92 13.038],...
'ForegroundColor','w','BackgroundColor','k','BorderType','line');
uicontrol(hPan2,'Style','text','String',...
'Text#3','Units','normalized',...
'Position',[0.112 0.632 0.215 0.128],'ForegroundColor',...
'w','BackgroundColor','k');
uicontrol(hPan2,'Style','edit','String','100','Units',...
'normalized','Position',[0.354 0.618 0.228 0.148],'ForegroundColor',...
'k','BackgroundColor','w');
uicontrol(hPan2,'Style','text','String','Text#4',...
'Units','normalized','Position',[0.171 0.248 0.15 0.128],'FontSize',...
9,'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan2,'Style','edit','String','100','Units',...
'normalized','Position',[0.354 0.235 0.228 0.148],...
'ForegroundColor','k','BackgroundColor','w');
th2 = uitab('parent',htab,'title','Tab#2','Units',...
'characters');
hPan3 = uipanel(th2,'title','Panel3','Units','characters',...
'Position',[4.248 24.462 217.552 16.923],'ForegroundColor','w',...
'BackgroundColor','k');
hPan31 = uipanel(hPan3,'title','Panel 3.1','Units','normalized',...
'Position',[0.017 0.13 0.496 0.816],'ForegroundColor','w',...
'BackgroundColor','k','BorderType','line');
uicontrol(hPan31,'Style','text','String','Text311','Units',...
'normalized','Position',[0.079 0.711 0.34 0.171],'FontSize',9,...
'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan31,'Style','edit','String','1000',...
'Units','normalized','Position',...
[0.455 0.8 0.242 0.099],'ForegroundColor','k',...
'BackgroundColor','w');
uicontrol(hPan31,'Style','edit','String','1000',...
'Units','normalized','Position',[0.455 0.451 0.241 0.133],...
'ForegroundColor','k','BackgroundColor','w');
uicontrol(hPan31,'Style','text','String','Label','Units','normalized',...
'Position',[0.741 0.437 0.101 0.151],'ForegroundColor',...
'w','BackgroundColor','k');
uicontrol(hPan31,'Style','edit','String','4','Units',...
'normalized','Position',[0.862 0.458 0.1 0.133],'ForegroundColor',...
'k','BackgroundColor','w');
hPan32 = uipanel(hPan3,'title','Panel 3.2','Units',...
'normalized','Position',[0.53 0.13 0.231 0.816],...
'ForegroundColor','w','BackgroundColor','k','BorderType',...
'line');
uicontrol(hPan32,'Style','text','String','TEXT34',...
'Value',0,'Units','normalized','Position',[0.094 0.483 0.443 0.133],...
'FontSize',9,'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan32,'Style','edit','String','10',...
'Units','normalized','Position',[0.63 0.47 0.275 0.133],'FontSize',...
9,'ForegroundColor','k','BackgroundColor','w');
hPan33 = uipanel(hPan3,'title','Panel 3.3','Units',...
'normalized','Position',[0.778 0.13 0.205 0.816],...
'ForegroundColor','w','BackgroundColor','k','BorderType','line');
uicontrol(hPan33,'Style','text','String','TEXT34',...
'Value',0,'Units','normalized','Position',[0.094 0.483 0.443 0.133],...
'FontSize',9,'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan33,'Style','edit','String','10',...
'Units','normalized','Position',[0.63 0.47 0.275 0.133],'FontSize',...
9,'ForegroundColor','k','BackgroundColor','w');
hPan4 = uipanel(th2,'title','Panel 4','Units','characters',...
'Position',[4.248 0.831 264.228 27],'ForegroundColor','w',...
'BackgroundColor','k');
hPan41 = uipanel(hPan4,'title','Panel 4.1','Units','normalized',...
'Position',[0.012 0.521 0.3 0.48],'ForegroundColor','w',...
'BackgroundColor','k','BorderType','line');
uicontrol(hPan41,'Style','text','String','TEXT34',...
'Value',0,'Units','normalized','Position',[0.094 0.483 0.443 0.133],...
'FontSize',9,'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan41,'Style','edit','String','10',...
'Units','normalized','Position',[0.63 0.47 0.275 0.133],'FontSize',...
9,'ForegroundColor','k','BackgroundColor','w');
% Subpanel "Intervalo de anĂ¡lisis"
hPan42 = uipanel(hPan4,'title','Panel 4.2','Units',...
'normalized','Position',[0.012 0.02 0.3 0.48],'ForegroundColor','w',...
'BackgroundColor','k','BorderType','line');
uicontrol(hPan42,'Style','text','String','TEXT34',...
'Value',0,'Units','normalized','Position',[0.094 0.483 0.443 0.133],...
'FontSize',9,'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan42,'Style','edit','String','10',...
'Units','normalized','Position',[0.63 0.47 0.275 0.133],'FontSize',...
9,'ForegroundColor','k','BackgroundColor','w');
hPan43 = uipanel(hPan4,'title','Panel 4.3',...
'Units','normalized','Position',[0.324 0.02 0.261 0.98],...
'ForegroundColor','w','BackgroundColor','k','BorderType','line');
uicontrol(hPan43,'Style','text','String','TEXT34',...
'Value',0,'Units','normalized','Position',[0.094 0.483 0.443 0.133],...
'FontSize',9,'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan43,'Style','edit','String','10',...
'Units','normalized','Position',[0.63 0.47 0.275 0.133],'FontSize',...
9,'ForegroundColor','k','BackgroundColor','w');
hPan44 = uipanel(hPan4,'title','Panel 4.4',...
'Units','normalized','Position',[0.597 0.02 0.391 0.98],...
'ForegroundColor','w','BackgroundColor','k','BorderType','line');
uicontrol(hPan44,'Style','text','String','TEXT34',...
'Value',0,'Units','normalized','Position',[0.094 0.483 0.443 0.133],...
'FontSize',9,'ForegroundColor','w','BackgroundColor','k');
uicontrol(hPan44,'Style','edit','String','10',...
'Units','normalized','Position',[0.63 0.47 0.275 0.133],'FontSize',...
9,'ForegroundColor','k','BackgroundColor','w');
function SelectionChangeCbk(src,evt)
oldTab = evt.OldValue;
newTab = evt.NewValue;
set([oldTab,newTab],'Visible','off');
drawnow;
pause(2);
set(newTab,'Visible','on');
end
end
I would not use uitabgroup. It is not documented, and its behavior is undefined. Instead, consider using the GUI Layout toolbox package from Matlab Central. By the way, the visibility is handled there by moving panels to far location unseen on the screen (Like (-100000,-100000) ) - it seems to be more robust than setting visibility.
Anyhow, there is no easy way to achieve smooth fade-in/fade-out transition in Matlab GUI, at least not a documented one.
Related
DWM Leaks Memory When No Monitor Connected Windows 8
Simply, if no monitor connected and you are doing some "windows" operation on windows 8 embedded, dwm.exe starts allocating memory and never stops. to regenerate and show you all the problem, i have written an application which is doing "Create a new Form and show it, if there is one created close it first" public partial class PopupWindows : Form { private Timer _t; private Form _form; public PopupWindows() { InitializeComponent(); this.Size = new Size(500, 500); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); _t = new Timer(); _t.Tick += (o, ea) => { _form?.Close(); (_form = new Form() { Size = this.Size }).Show(); }; _t.Interval = 1000; _t.Enabled = true; } } if you run this application and plug out the monitor, dwm start allocating pages here is the output from pslist -m when the monitor connected Name Pid VM WS Priv Priv Pk Faults NonP Page dwm 840 123528 14400 11264 13044 55125 7 212 after some time but still the monitor connected dwm 840 117144 15808 12732 13044 94051 7 200 disconnecting monitor and dwm.exe start allocating dwm 840 214660 14444 12664 13044 137409 13 400 below is the output where you can see allocation dwm.exe doing C:\PSTools>pslist.exe -m|findstr "dwm" dwm 840 251956 14460 12740 13044 137413 16 477 C:\PSTools>pslist.exe -m|findstr "dwm" dwm 840 251956 14460 12740 13044 137413 16 477 C:\PSTools>pslist.exe -m|findstr "dwm" dwm 840 251956 14460 12740 13044 137413 16 477 C:\PSTools>pslist.exe -m|findstr "dwm" dwm 840 252964 14460 12740 13044 137413 16 479 C:\PSTools>pslist.exe -m|findstr "dwm" dwm 840 252964 14460 12740 13044 137413 16 479 C:\PSTools>pslist.exe -m|findstr "dwm" dwm 840 253972 14460 12744 13044 137413 16 481 C:\PSTools>pslist.exe -m|findstr "dwm" dwm 840 253972 14460 12744 13044 137413 16 481 C:\PSTools>pslist.exe -m|findstr "dwm" dwm 840 254980 14460 12744 13044 137413 16 483 and this strange act dwm doing never stops till you connect a monitor or doing vnc connection to the computer. after some time on operation without monitor, every os component starts to complain about memory and a blue screen of death occurs at the end. let me show you the last one dwm 840 807516 15624 14216 17240 147413 50 1603 here is the output showing how many minutes my popupwindows.exe running Name Pid Pri Thd Hnd Priv CPU Time Elapsed Time PopupWindows 2052 6 4 138 9468 0:00:00.140 0:23:07.332 as you can see, after about 20 minutes without having a monitor on the device, dwm.exe using 807516 bytes VM and 1603 pages.
Acting like what vnc doing (copying whole screen bitmap to application memory regularly) solved the dwm's allocation problem (which i think dwm caches its outputs but no one come and ask for the changes so it keeps all of them in the memory and never cleans). below is the application which starts hidden and regularly copying screen image into app memory public partial class HiddenForm : Form { IntPtr _this; private System.Windows.Forms.Timer _timer; private Bitmap _bmp = null; public HiddenForm() { this.Visible = false; this.ShowInTaskbar = false; this.FormBorderStyle = FormBorderStyle.None; this.HandleCreated += (s, e) => _this = this.Handle; this.Load += (s, e) => this.Size = new Size(0, 0); CreateHandle(); CreateControl(); _timer = new System.Windows.Forms.Timer(); _timer.Tick += _timer_Tick; _timer.Interval = 2000; _timer.Start(); } private void _timer_Tick(object sender, EventArgs e) { if (Screen.PrimaryScreen == null) return; if (_bmp == null) { using (Graphics g = CreateGraphics()) { _bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, g); } } using (Graphics grp = Graphics.FromImage(_bmp)) { grp.CopyFromScreen(0, 0, 0, 0, _bmp.Size); } } } here is the output after starting my app Name Pid VM WS Priv Priv Pk Faults NonP Page dwm 832 117876 20188 19624 35004 184497 7 185 killing my app with pskill waiting a while dwm 832 182388 20264 19852 35004 421343 11 317 it starts increasing to re check our app i started it again by typing C:\HiddenForm.exe and dwm.exe memory allocation magically downed. dwm 832 126384 27900 27364 35144 556729 7 187
Avisynth total frames does not equal VirtualDub total frames
It appears that Dissolve and/or Fade change the total number of frames in .avs scripts. When I add up the total number of frames in the avs script and then load the avs script in Vdub the total number of frames is different. My real world example below shows a difference of 822 frames vs 1368 frames for the same script. I have run some basic tests which appear to support this hypothesis. Of course I may be doing something stupid. Any guidance would be greatly appreciated. Please let me know if I can clarify anything. Ffmpeg also borks on the same script which leads me to think this is an Avisynth issue. Or my lack of avs coding skills. System specs: Win7, FFmpeg version: 20170223-dcd3418 win32 shared, AVISynth version: 2.6 Test1.avs = 200 frames long = Expected behaviour LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\VSFilter.dll") v1=ImageReader("1.png", fps=24, start=1, end=100) v2=ImageReader("2.png", fps=24, start=1, end=100) video = v1 + v2 return video Test2.avs with return Dissolve = 195 frames long = Unexpected behaviour LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\VSFilter.dll") v1=ImageReader("1.png", fps=24, start=1, end=100) v2=ImageReader("2.png", fps=24, start=1, end=100) return Dissolve(v1, v2, 5) Test3.avs with fadeOut(fadeIn = 202 frames long = Unexpected behaviour LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\VSFilter.dll") v1=ImageReader("1.png", fps=24, start=1, end=100) v2=ImageReader("2.png", fps=24, start=1, end=100) fadeOut(fadeIn(v1 + v2, 60), 60) Test4.avs with dissolve and fade = 197 frames long = Unexpected behaviour LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\VSFilter.dll") v1=ImageReader("1.png", fps=24, start=1, end=100) v2=ImageReader("2.png", fps=24, start=1, end=100) v3 = Dissolve(v1, v2, 5) fadeOut(fadeIn(v3, 60), 60) Test5.avs explicity specifying frame rates on dissolve and fade = 197 frames = Unexpected behaviour LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\VSFilter.dll") v1=ImageReader("1.png", fps=24, start=1, end=100) v2=ImageReader("2.png", fps=24, start=1, end=100) v3 = Dissolve(v1, v2, 5, 24) fadeOut(fadeIn(v3, 60, $000000, 24), 60, $000000, 24) realExample = 822 frames long = Expected behaviour (this is what I want) LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\VSFilter.dll") v1=ImageReader("1.png", fps=24).trim(1,106) v3=ImageReader("3.png", fps=24).trim(1,471) v9=ImageReader("9.png", fps=24).trim(1,58) v10=ImageReader("10.png", fps=24).trim(1,35) v11=ImageReader("11.png", fps=24).trim(1,152) video = v1 + v3 + v9 + v10 + v11 return video realExample = 1368 frames long LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\VSFilter.dll") v1=ImageReader("1.png", fps=24).trim(1,106) v3=ImageReader("3.png", fps=24).trim(1,471) v9=ImageReader("9.png", fps=24).trim(1,58) v10=ImageReader("10.png", fps=24).trim(1,35) v11=ImageReader("11.png", fps=24).trim(1,152) d1 = Dissolve(v1, v3, 5) d3 = Dissolve(v3, v9, 5) d9 = Dissolve(v9, v10, 5) d10 = Dissolve(v10, v11, 5) fadeOut(fadeIn(d1 + d3 + d9 + d10,60),60)
You stated that some of your results gave "unexpected behavior", but you didn't specify what you expected them to be, so it's unclear what you think is wrong and where your misunderstanding lies. (When discussing problems, you should always state what results you got and what results you expected instead.) In your Dissolve example (Test2.avs), you say that 195 frames is unexpected, but that sounds correct to me. "Dissolving" two clips together means that the end of one clip overlaps with the beginning of a second clip as one gradually fades into the other; this is not the same as fading out the first clip and then fading in the second clip. The overlap means that the result must be shorter than the sum of the clips' individual lengths. You combined two 100-frame clips and specified a 5-frame overlap, so 100 + 100 - 5 = 195. In your FadeOut example (Test3.avs), you say that 202 frames is unexpected, but that also sounds correct to me. The documentation for FadeIn/FadeOut state: An additional color frame is added at the start/end, thus increasing the total frame count by one (or for FadeIO, by two). Since you made one call to FadeIn and one call to FadeOut in test3.avs, two extra frames were added. If you do not want this, then you can use FadeIn0/FadeOut0 (or FadeIO0 since you're using both), although note that with those functions, the first/last frame will not exactly be exactly black. If you want exactness, then simply trim off the first and/or last frames before using the normal FadeIn/FadeOut/FadeIO functions. Your "real examples" are comparing apples to oranges. The version with Dissolve dramatically increases the frame count because it's combining the same clips multiple times: d1 = Dissolve(v1, v3, 5) d3 = Dissolve(v3, v9, 5) ... fadeOut(fadeIn(d1 + d3 + d9 + d10,60),60) d1 and d3 each include a copy of the v3 clip, and then you spliced d1 and d3 together at the end, meaning that v3 is included twice. (This is also true for v9 and v10.) You probably intended to do something like: video = Dissolve(v1, v3, 5) video = Dissolve(video, v9, 5) video = Dissolve(video, v10, 5) video = Dissolve(video, v11, 5) video = FadeOut(FadeIn(video, 60), 60) or more succinctly: video = FadeIO(Dissolve(v1, v3, v9, v10, v11, 5), 60) The result should be 804 frames long: (822 frames from the original clips) - (4 dissolve points) * (5 frames of overlap per dissolve) + (2 frames from FadeIO). If you actually wanted to combine the clips by fading out and then fading in, then you could preserve the original frame count by doing: video = FadeIO0(v1, 60) \ + FadeIO0(v3, 60) \ + FadeIO0(v9, 60) \ + FadeIO0(v10, 60) \ + FadeIO0(v11, 60)
How to force legend entries as power of 10 in MATLAB
This is an extension of How to change display format of legend in MATLAB. I am looking for a way to force the legend entries in a particular format. In following code, they are displayed like Instead I want them in power of 10's. Like $10^{-1},10^{-2}$. Is there a way to do this? MWE: sig=[0.1 0.01 0.001 0.0001 0.00001]; for j=1:length(sig) for x=1:10 Cost(j,x) = 2*x+j; end plot(1:10,Cost(j,:)); end legend(strcat('\sigma^2_n=',num2str((sig)'))); set(h,'Interpreter','latex')
Simply log10 sig in the num2str and prepend the base: sig=[0.1 0.01 0.001 0.0001 0.00001]; for j=1:length(sig) for x=1:10 Cost(j,x) = 2*x+j; end hold('on'); plot(1:10,Cost(j,:)); end h=legend(strcat('$\sigma^2_n = 10^{',num2str((log10(sig))'),'}$')); set(h,'Interpreter','latex','fontsize',16) hold('off');
World of Warcraft UI - custom frame without addon
In World Of Warcraft I have created a little coords script that outputs current coords: local function ou(self,elapsed) px,py=GetPlayerMapPosition("player") DEFAULT_CHAT_FRAME:AddMessage(format("( %s ) [%f , %f]",GetZoneText(), px *100, py *100)) end local f = CreateFrame("frame") f:SetScript("OnUpdate", ou) This however spams default chat frame... How would I create custom frame and how would I access it? (I can't use custom channel with SendChatMessage) ...I would like to do this WITHOUT making an addon, thanks :)
I found a solution in storing frame in global variable, as I don't intend to create a plugin, the whole program requires a few macros (macro's maximum number of characters is 255). First macro - prepare function that will set frame attributes later f = input frame that will be set x = x coordinate of position y = y coordinate of position function setMyFrame(f,x,y) f:SetSize(288,100) f:SetPoint("TOPLEFT",UIParent,"TOPLEFT",x,y) f.text = f.text or f:CreateFontString(nil,"ARTWORK","QuestFont_Shadow_Huge") f.text:SetAllPoints(true) end Second macro - prepare coords function that will set current coords as frame's text ctotel = time elapsed since last update of the frame creft = how often should the frame be updated in SECONDS - good one is 0.1 - 10 times a second is performance friendly and fast enaugh to coords update f = input frame that will be updated i = "how long it's been since the last update call cycle" (you don't set that - it is inherited from the WoW system) ctotel = 0 creft = 0.1 function myCoords(f,i) ctotel = ctotel + i if ctotel >= creft then px,py=GetPlayerMapPosition("player") f.text:SetText(format("( %s ) [%f , %f]",GetZoneText(), px *100, py *100)) ctotel = 0 end end Third macro - store frame in global variable and set it and run update script with myCoords as callback myCoordsFrame = CreateFrame("Frame","MyCoordsFrame",UIParent) setMyFrame(myCoordsFrame, 500, 0) myCoordsFrame:SetScript("OnUpdate", myCoords) Of course in game all macros have to be preceeded with /run and have to be inlined - no line breaks - instead of linebreak just make space... Also you have to run macros in THIS ^^^ order (first=>second=>third) Advantage in setting frame and creft as globals: Frames can't be destroyed while in the world (you have to relog to destroy them) so when it's global you can later move it with /run setMyFrame(myCoordsFrame, NEW_X_COORDINATE, NEW_Y_COORDINATE) If you would like the coords to update slower/faster you can do it by resetting the creft - e.g. to almost realtime refresh every 0.05 or even 0.01 seconds: /run creft = 0.05 ... or even /run creft = 0.01 Make Coords movable - draggable by left mouse (credit to Wanderingfox from WoWhead): myCoordsFrame:SetMovable(true) myCoordsFrame:EnableMouse(true) myCoordsFrame:SetScript("OnMouseDown",function() myCoordsFrame:StartMoving() end) myCoordsFrame:SetScript("OnMouseUp",function() myCoordsFrame:StopMovingOrSizing() end) ...and as copy-paste ingame macro: /run myCoordsFrame:SetMovable(true) myCoordsFrame:EnableMouse(true) myCoordsFrame:SetScript("OnMouseDown",function() myCoordsFrame:StartMoving() end) myCoordsFrame:SetScript("OnMouseUp",function() myCoordsFrame:StopMovingOrSizing() end)
Replace background image by fading
I have a WinForm in VB.Net with some images at the background which change every 5 seconds by a timer. The problem is that they change immediately and this does not look nice. I would like to add some fade-in effects, but I got the error that opacity is not a property for tableLayout.backgroundimage. I can only fade the form, but that's not what I want. Here is my code: Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If imageNum > 3 Then imageNum = 1 End If Select Case imageNum Case 1 Me.TableLayoutPanel4.BackgroundImage = Global.posta1.My.Resources.Resources.foto1 For FadeIn = 0.0 To 1.1 Step 0.1 Me.Opacity = FadeIn Threading.Thread.Sleep(100) Next rd_btn1.Checked = False rd_btn2.Checked = True Case 2 Me.TableLayoutPanel4.BackgroundImage = Global.posta1.My.Resources.Resources.foto3 rd_btn2.Checked = False rd_btn3.Checked = True For FadeIn = 0.0 To 1.1 Step 0.1 Me.Opacity = FadeIn Threading.Thread.Sleep(100) Next Case 3 Me.TableLayoutPanel4.BackgroundImage = Global.posta1.My.Resources.Resources.foto2 For FadeIn = 0.0 To 1.1 Step 0.1 Me.Opacity = FadeIn Threading.Thread.Sleep(100) Next rd_btn3.Checked = False rd_btn1.Checked = True End Select imageNum = imageNum + 1 End Sub
As far as I do know it's not possible to set the opacity of a single control, maybe you can do it by drawing the control yourself but you have to research about that because I have no knowledge about drawing controls yourself..
I'm a novice but what I would think would work would be to draw (using the PaintEventArgs argument of the paint event of the control) to do this: Draw both the old and the new pic. Lessen the alpha value of the old pic, whilst increasing the new pic's alha value, until they are 0.0, and 1.0 Hope this helped. Sorry if it didn't. ;)