|By Xin Yan||
|July 29, 2005 01:45 AM EDT||
One of the new features in Visual Studio 2005 (VS2005) is easier custom control development for .NET Compact Framework. This article is about how to use Visual Studio 2005 to create custom control for .NET Compact Framework and provide design-time support.
Introduction to Custom Control
A Windows Forms custom control is a class that derives directly or indirectly from System.Windows.Forms.Control or System.Windows.Forms.
UserControl. Using custom control technology, developers can easily create powerful, reusable and redistributable Windows Forms controls.
There are three common custom control scenarios:
- Combine existing controls to author a composite control. In this case, the custom control should derive from System.Windows.Forms.UserControl.
- Extend an existing control to add to its functionality. In this case, the custom control should derive from the existing control, such as System.Windows.Forms.TextBox.
- Author a control that doesn’t depend on existing WinForm controls. In this case, the custom control should derive from System.Windows.Forms.Control.
Visual Studio 2005 fully supports creating custom controls in .NET Compact Framework. In addition, custom control developers can create a great design-time experience for custom control users. Design-time support makes it easier for developers to use custom controls in Visual Studio 2005 Smart Device projects.
Usually, building a custom control for .NET Compact Framework consists of two steps:
- Code the custom control
- Add design-time support
In this article I am going to illustrate these steps by building a .NET Compact Framework custom control in Visual Studio 2005. The custom control is for sign-in forms and will look like Figure 1 on a Smartphone device. It is called SignInControl. Developers can utilize this custom control to implement a consistent sign-in experience for their apps. It has the following features:
- Can take user name and password input
- Provides animation functionality
- Can be easily used in Visual Studio 2005 designer
- Supports numeric input mode to help Smartphone users
To follow the article, you will need Visual Studio 2005 Beta 2 and Windows Mobile 5 Smartphone SDK.
Code the Custom Control
SignInControl uses Label and TextBox controls to take user input, and PictureBox to display the animation. Thus it should derive from UserControl.
The first step is to create a Visual Studio Smart Device project. Visual Studio 2005 has many Smart Device project types to choose from. In this example I am going to create a C# SmartPhone Windows Mobile 5 (code named Magneto) Control Library project called SignInControl (see Figure 2).
After creating the project, rename the UserControl1.cs to SignInControl.cs. To protect my custom control assembly from tampering, I also signed my assembly with a strong name key file (right click on the project in the solution explorer, select “Properties,” and click on “Signing” tab). Now I am ready to implement my custom control.
Go to the designer and drop two Label controls, two TextBox controls, one PictureBox control, and one Timer component. When doing this, notice the designer automatically displays snap-line to help aligning the controls. Set the Label controls to have proper text, and set the PasswordChar property of the password TextBox to “*.” Figure 3 is a screenshot of SignInControl in the designer.
Two properties should be added to SignInControl to give developers access to the user name and password entered. Their implementation simply gets or sets the Text property value on the corresponding TextBox controls.
Animation support is provided by the use of Timer and PictureBox. Add a Timer object to SignInControl, set its Interval property to 1000 (one second), and double click it to generate Timer.Tick event handler. The Timer object will raise an event every second. The PictureBox control’s image will be refreshed on each tick to achieve an animation effect.
The images for animation are set in AnimationImages property using ImageList. An AnimationMode property is provided so that developers can turn animation on or off. After adding the above implementation, SignInControl.cs looks like Listing 1.
|Jay Dixit 10/11/07 07:07:23 AM EDT|
Hi truly a great article but i am new for it and just have some queries.
Please help me for this.
|Jacques Herweijer 02/05/07 03:23:28 PM EST|
Hi great article, I completely understand the usercontrols now in a few minutes, its better than reading a book about it ! That however leaves me with 2 unanswered questions hope you can answer them.
My first question is, How can I access the properties of the labels as soon as the usercontrol is used on a form, so I can change the Text property depending on the form I am using it on, or do I have to create a new usercontrol that inhertis your example for each label Text I want to use and drop that one on my form. I think this is very much work for just setting a label.
And then my second one, How can I add controls to the usercontrol when I put it on my form ? For example if I wanted to add a button to the usercontrol when it is on my form but not in de usercontrol class itself (like a panel can contain controls) in Design-time ofcourse.
Hope you can and be willing to give me an answer because I cannot find these answers anywhere. I think its hard to search the web when some functionallity is not available for Smart Device projects.
Anyway Great article that give me a head start.
|.NET News Desk 07/28/05 02:49:36 PM EDT|
Creating Custom Controls for Microsoft .NET Compact Framework in Visual Studio 2005
|.NET News Desk 07/28/05 02:49:30 PM EDT|
Creating Custom Controls for Microsoft .NET Compact Framework in Visual Studio 2005
Data is the fuel that drives the machine learning algorithmic engines and ultimately provides the business value. In his session at 20th Cloud Expo, Ed Featherston, director/senior enterprise architect at Collaborative Consulting, will discuss the key considerations around quality, volume, timeliness, and pedigree that must be dealt with in order to properly fuel that engine.
Feb. 24, 2017 04:00 AM EST Reads: 3,787
SYS-CON Events announced today that DatacenterDynamics has been named “Media Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY. DatacenterDynamics is a brand of DCD Group, a global B2B media and publishing company that develops products to help senior professionals in the world's most ICT dependent organizations make risk-based infrastructure and capacity decisions.
Feb. 24, 2017 03:00 AM EST Reads: 1,815
"Matrix is an ambitious open standard and implementation that's set up to break down the fragmentation problems that exist in IP messaging and VoIP communication," explained John Woolf, Technical Evangelist at Matrix, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
Feb. 24, 2017 02:15 AM EST Reads: 13,194
Growth hacking is common for startups to make unheard-of progress in building their business. Career Hacks can help Geek Girls and those who support them (yes, that's you too, Dad!) to excel in this typically male-dominated world. Get ready to learn the facts: Is there a bias against women in the tech / developer communities? Why are women 50% of the workforce, but hold only 24% of the STEM or IT positions? Some beginnings of what to do about it! In her Day 2 Keynote at 17th Cloud Expo, Sandy Ca...
Feb. 24, 2017 01:45 AM EST Reads: 9,537
IoT is at the core or many Digital Transformation initiatives with the goal of re-inventing a company's business model. We all agree that collecting relevant IoT data will result in massive amounts of data needing to be stored. However, with the rapid development of IoT devices and ongoing business model transformation, we are not able to predict the volume and growth of IoT data. And with the lack of IoT history, traditional methods of IT and infrastructure planning based on the past do not app...
Feb. 24, 2017 01:00 AM EST Reads: 1,893
WebRTC services have already permeated corporate communications in the form of videoconferencing solutions. However, WebRTC has the potential of going beyond and catalyzing a new class of services providing more than calls with capabilities such as mass-scale real-time media broadcasting, enriched and augmented video, person-to-machine and machine-to-machine communications. In his session at @ThingsExpo, Luis Lopez, CEO of Kurento, introduced the technologies required for implementing these idea...
Feb. 23, 2017 11:30 PM EST Reads: 6,298
Why do your mobile transformations need to happen today? Mobile is the strategy that enterprise transformation centers on to drive customer engagement. In his general session at @ThingsExpo, Roger Woods, Director, Mobile Product & Strategy – Adobe Marketing Cloud, covered key IoT and mobile trends that are forcing mobile transformation, key components of a solid mobile strategy and explored how brands are effectively driving mobile change throughout the enterprise.
Feb. 23, 2017 11:00 PM EST Reads: 7,020
Apache Hadoop is emerging as a distributed platform for handling large and fast incoming streams of data. Predictive maintenance, supply chain optimization, and Internet-of-Things analysis are examples where Hadoop provides the scalable storage, processing, and analytics platform to gain meaningful insights from granular data that is typically only valuable from a large-scale, aggregate view. One architecture useful for capturing and analyzing streaming data is the Lambda Architecture, represent...
Feb. 23, 2017 10:00 PM EST Reads: 4,608
SYS-CON Events announced today that delaPlex will exhibit at SYS-CON's @CloudExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. delaPlex pioneered Software Development as a Service (SDaaS), which provides scalable resources to build, test, and deploy software. It’s a fast and more reliable way to develop a new product or expand your in-house team.
Feb. 23, 2017 09:15 PM EST Reads: 1,526
The explosion of new web/cloud/IoT-based applications and the data they generate are transforming our world right before our eyes. In this rush to adopt these new technologies, organizations are often ignoring fundamental questions concerning who owns the data and failing to ask for permission to conduct invasive surveillance of their customers. Organizations that are not transparent about how their systems gather data telemetry without offering shared data ownership risk product rejection, regu...
Feb. 23, 2017 08:45 PM EST Reads: 1,298
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo 2016 in New York. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place June 6-8, 2017, at the Javits Center in New York City, New York, is co-located with 20th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry p...
Feb. 23, 2017 08:30 PM EST Reads: 1,455
The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform and how we integrate our thinking to solve complicated problems. In his session at 19th Cloud Expo, Craig Sproule, CEO of Metavine, demonstrated how to move beyond today's coding paradigm and sh...
Feb. 23, 2017 07:45 PM EST Reads: 3,400
SYS-CON Events announced today that IoT Now has been named “Media Sponsor” of SYS-CON's 20th International Cloud Expo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY. IoT Now explores the evolving opportunities and challenges facing CSPs, and it passes on some lessons learned from those who have taken the first steps in next-gen IoT services.
Feb. 23, 2017 06:45 PM EST Reads: 1,459
SYS-CON Events announced today that WineSOFT will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Based in Seoul and Irvine, WineSOFT is an innovative software house focusing on internet infrastructure solutions. The venture started as a bootstrap start-up in 2010 by focusing on making the internet faster and more powerful. WineSOFT’s knowledge is based on the expertise of TCP/IP, VPN, SSL, peer-to-peer, mob...
Feb. 23, 2017 06:30 PM EST Reads: 1,727
As organizations realize the scope of the Internet of Things, gaining key insights from Big Data, through the use of advanced analytics, becomes crucial. However, IoT also creates the need for petabyte scale storage of data from millions of devices. A new type of Storage is required which seamlessly integrates robust data analytics with massive scale. These storage systems will act as “smart systems” provide in-place analytics that speed discovery and enable businesses to quickly derive meaningf...
Feb. 23, 2017 06:30 PM EST Reads: 6,298
The Internet of Things can drive efficiency for airlines and airports. In their session at @ThingsExpo, Shyam Varan Nath, Principal Architect with GE, and Sudip Majumder, senior director of development at Oracle, discussed the technical details of the connected airline baggage and related social media solutions. These IoT applications will enhance travelers' journey experience and drive efficiency for the airlines and the airports.
Feb. 23, 2017 06:00 PM EST Reads: 1,516
SYS-CON Media announced today that @WebRTCSummit Blog, the largest WebRTC resource in the world, has been launched. @WebRTCSummit Blog offers top articles, news stories, and blog posts from the world's well-known experts and guarantees better exposure for its authors than any other publication. @WebRTCSummit Blog can be bookmarked ▸ Here @WebRTCSummit conference site can be bookmarked ▸ Here
Feb. 23, 2017 06:00 PM EST Reads: 13,065
In his keynote at @ThingsExpo, Chris Matthieu, Director of IoT Engineering at Citrix and co-founder and CTO of Octoblu, focused on building an IoT platform and company. He provided a behind-the-scenes look at Octoblu’s platform, business, and pivots along the way (including the Citrix acquisition of Octoblu).
Feb. 23, 2017 05:45 PM EST Reads: 1,228
With billions of sensors deployed worldwide, the amount of machine-generated data will soon exceed what our networks can handle. But consumers and businesses will expect seamless experiences and real-time responsiveness. What does this mean for IoT devices and the infrastructure that supports them? More of the data will need to be handled at - or closer to - the devices themselves.
Feb. 23, 2017 05:30 PM EST Reads: 1,982
SYS-CON Events announced today that Dataloop.IO, an innovator in cloud IT-monitoring whose products help organizations save time and money, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Dataloop.IO is an emerging software company on the cutting edge of major IT-infrastructure trends including cloud computing and microservices. The company, founded in the UK but now based in San Fran...
Feb. 23, 2017 04:45 PM EST Reads: 2,558