Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TabCtrl » How to plot image in one tab based on TabCtrl (How to plot image in one tab based on TabCtrl)
How to plot image in one tab based on TabCtrl [message #47385] Wed, 11 January 2017 07:02 Go to next message
coldspider is currently offline  coldspider
Messages: 2
Registered: January 2017
Location: Taiwan
Junior Member
Hi All

I've found some plot image example with ImageDraw.

In my application, I want to draw image on one of my tab with TabCtrl.
Is there any simple example to let me study?

Thanks a lot.
Re: How to plot image in one tab based on TabCtrl [message #47397 is a reply to message #47385] Thu, 12 January 2017 02:51 Go to previous message
coldspider is currently offline  coldspider
Messages: 2
Registered: January 2017
Location: Taiwan
Junior Member
Hi All

I find a easy way, just use label and do it.

I refer to example [ImageDraw] : http://www.ultimatepp.org/reference$ImageDraw$en-us.html

#ifndef _ImageDrawwithtab_ImageDrawwithtab_h
#define _ImageDrawwithtab_ImageDrawwithtab_h

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define LAYOUTFILE <ImageDrawwithtab/ImageDrawwithtab.lay>
#include <CtrlCore/lay.h>

class ImageDrawwithtab : public WithImageDrawwithtabLayout<TopWindow> {

	WithTab1Layout<ParentCtrl> tab1layout;
	WithTab2Layout<ParentCtrl> tab2layout;
	Image img;

public:
	typedef ImageDrawwithtab CLASSNAME;
	ImageDrawwithtab();
};

#endif


#include "ImageDrawwithtab.h"

ImageDrawwithtab::ImageDrawwithtab()
{
	CtrlLayout(*this, "Window title");
	CtrlLayout(tab1layout);
	CtrlLayout(tab2layout);
	
	tab.Add(tab1layout,"tab1");
	tab.Add(tab2layout,"tab2");
	
	ImageDraw w(100, 100);
        w.DrawRect(0, 0, 100, 100, SGray);
        w.DrawEllipse(0, 0, 100, 100, SGreen);
        w.DrawText(0, 0, "ImageDraw!", Arial(13).Bold(), SYellow);
        img = w;
	
	tab1layout.tab1label.SetImage(img);
	tab2layout.tab2label.SetImage(img);
	
	
}

GUI_APP_MAIN
{
	ImageDrawwithtab().Run();
}


LAYOUT(ImageDrawwithtabLayout, 296, 208)
	ITEM(TabCtrl, tab, LeftPosZ(8, 280).TopPosZ(20, 180))
END_LAYOUT

LAYOUT(Tab1Layout, 256, 164)
	ITEM(Label, tab1label, LeftPosZ(0, 236).TopPosZ(0, 128))
END_LAYOUT

LAYOUT(Tab2Layout, 260, 160)
	ITEM(Label, tab2label, LeftPosZ(0, 240).TopPosZ(0, 132))
END_LAYOUT


[Updated on: Thu, 12 January 2017 02:54]

Report message to a moderator

Previous Topic: How to use TabBar CancelClose/WhenClose?
Next Topic: Background color of layout
Goto Forum:
  


Current Time: Thu Mar 28 12:05:39 CET 2024

Total time taken to generate the page: 0.01162 seconds